annotate src/w32fns.c @ 23314:87acd2b6ce97

(w32_color_map_lookup): New function. (x_to_w32_color): Approximate colors ending in numbers if necessary.
author Geoff Voelker <voelker@cs.washington.edu>
date Thu, 24 Sep 1998 02:14:55 +0000
parents 95a213639589
children 4587be644789
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"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31 #include "w32term.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
32 #include "frame.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 #include "window.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 #include "buffer.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 #include "dispextern.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 #include "keyboard.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 #include "blockinput.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38 #include "paths.h"
16593
4ed80eda6fac Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
39 #include "w32heap.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40 #include "termhooks.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 #include <commdlg.h>
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
43 #include <shellapi.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 extern void abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 extern void free_frame_menubar ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47 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
48 extern int quit_char;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 /* 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
51 Lisp_Object Vw32_color_map;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
53 /* 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
54 Lisp_Object Vw32_pass_alt_to_system;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
55
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
56 /* 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
57 to alt_modifier. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
58 Lisp_Object Vw32_alt_is_meta;
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
59
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
60 /* 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
61 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
62 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
63
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
64 /* 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
65 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
66 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
67
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
68 /* Enable palette management. */
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_palette;
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 /* 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
72 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
73 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
74
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
75 /* 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
76 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
77 Lisp_Object Vw32_mouse_move_interval;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
78
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
79 /* The name we're using in resource queries. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
80 Lisp_Object Vx_resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
81
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 /* Non nil if no window manager is in use. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
83 Lisp_Object Vx_no_window_manager;
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 /* The background and shape of the mouse pointer, and shape when not
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86 over text or in the modeline. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87 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
88 /* The shape when over mouse-sensitive text. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89 Lisp_Object Vx_sensitive_text_pointer_shape;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
91 /* Color of chars displayed in cursor box. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
92 Lisp_Object Vx_cursor_fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
93
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
94 /* Nonzero if using Windows. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
95 static int w32_in_use;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
96
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
97 /* Search path for bitmap files. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
98 Lisp_Object Vx_bitmap_file_path;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
99
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
100 /* Evaluate this expression to rebuild the section of syms_of_w32fns
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
101 that initializes and staticpros the symbols declared below. Note
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
102 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
103 evaluate this expression.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
104
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
105 (progn
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
106 ;; Accumulate a list of the symbols we want to initialize from the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
107 ;; declarations at the top of the file.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
108 (goto-char (point-min))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
109 (search-forward "/\*&&& symbols declared here &&&*\/\n")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
110 (let (symbol-list)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
111 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
112 (setq symbol-list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
113 (cons (buffer-substring (match-beginning 1) (match-end 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
114 symbol-list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
115 (forward-line 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
116 (setq symbol-list (nreverse symbol-list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
117 ;; Delete the section of syms_of_... where we initialize the symbols.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
118 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
119 (let ((start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
120 (while (looking-at "^ Q")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
121 (forward-line 2))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
122 (kill-region start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
123 ;; Write a new symbol initialization section.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
124 (while symbol-list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
125 (insert (format " %s = intern (\"" (car symbol-list)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
126 (let ((start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
127 (insert (substring (car symbol-list) 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
128 (subst-char-in-region start (point) ?_ ?-))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
130 (setq symbol-list (cdr symbol-list)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
131
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
132 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
133
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
134 /*&&& symbols declared here &&&*/
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
135 Lisp_Object Qauto_raise;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
136 Lisp_Object Qauto_lower;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
137 Lisp_Object Qbackground_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138 Lisp_Object Qbar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
139 Lisp_Object Qborder_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
140 Lisp_Object Qborder_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
141 Lisp_Object Qbox;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
142 Lisp_Object Qcursor_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
143 Lisp_Object Qcursor_type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
144 Lisp_Object Qforeground_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
145 Lisp_Object Qgeometry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146 Lisp_Object Qicon_left;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147 Lisp_Object Qicon_top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148 Lisp_Object Qicon_type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149 Lisp_Object Qicon_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150 Lisp_Object Qinternal_border_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151 Lisp_Object Qleft;
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
152 Lisp_Object Qright;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 Lisp_Object Qmouse_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 Lisp_Object Qnone;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
155 Lisp_Object Qparent_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 Lisp_Object Qscroll_bar_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157 Lisp_Object Qsuppress_icon;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158 Lisp_Object Qtop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 Lisp_Object Qundefined_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 Lisp_Object Qvertical_scroll_bars;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161 Lisp_Object Qvisibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
162 Lisp_Object Qwindow_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 Lisp_Object Qx_frame_parameter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
164 Lisp_Object Qx_resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 Lisp_Object Quser_position;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 Lisp_Object Quser_size;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 Lisp_Object Qdisplay;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
168
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
169 /* 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
170 #define LMOUSE 1
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
171 #define MMOUSE 2
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
172 #define RMOUSE 4
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
173
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
174 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
175 static W32Msg saved_mouse_button_msg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
176 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
177 static W32Msg saved_mouse_move_msg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
178 static unsigned mouse_move_timer;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
179
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
180 /* W95 mousewheel handler */
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
181 unsigned int msh_mousewheel = 0;
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
182
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
183 #define MOUSE_BUTTON_ID 1
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
184 #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
185
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
186 /* The below are defined in frame.c. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
187 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
188 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
190 extern Lisp_Object Vwindow_system_version;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
191
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
192 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
193
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
194 extern Lisp_Object last_mouse_scroll_bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
195 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
196
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
197 /* From w32term.c. */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
198 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
199
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
200
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
201 /* 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
202 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
203 check_w32 ()
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
204 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
205 if (! w32_in_use)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
206 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
207 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
208
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
209 /* Nonzero if we can use mouse menus.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
210 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
211
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
212 int
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
213 have_menus_p ()
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
214 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
215 return w32_in_use;
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
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
218 /* 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
219 and checking validity for W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
220
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
221 FRAME_PTR
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
222 check_x_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
223 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
224 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
225 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
226
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
227 if (NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
228 f = selected_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
229 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
230 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
231 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
232 f = XFRAME (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
233 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
234 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
235 error ("non-w32 frame used");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
236 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
237 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
238
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
239 /* 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
240 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
241 the first display on the list. */
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 static struct w32_display_info *
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
244 check_x_display_info (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
245 Lisp_Object frame;
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 if (NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
248 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
249 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
250 return FRAME_W32_DISPLAY_INFO (selected_frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
251 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
252 return &one_w32_display_info;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
253 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
254 else if (STRINGP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
255 return x_display_info_for_name (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
257 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
258 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
259
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
260 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
261 f = XFRAME (frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
262 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
263 error ("non-w32 frame used");
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
264 return FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
265 }
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
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
268 /* Return the Emacs frame-object corresponding to an w32 window.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
269 It could be the frame's main window or an icon window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
270
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
271 /* 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
272
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
273 struct frame *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
274 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
275 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
276 HWND wdesc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
277 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
278 Lisp_Object tail, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
279 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
280
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
281 for (tail = Vframe_list; GC_CONSP (tail); tail = XCONS (tail)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
282 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
283 frame = XCONS (tail)->car;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
284 if (!GC_FRAMEP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
285 continue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
286 f = XFRAME (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
287 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
288 || FRAME_W32_DISPLAY_INFO (f) != dpyinfo)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
289 continue;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
290 if (FRAME_W32_WINDOW (f) == wdesc)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
291 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
292 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
293 return 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
294 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
295
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
296
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
297
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
298 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
299 id, which is just an int that this section returns. Bitmaps are
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
300 reference counted so they can be shared among frames.
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 Bitmap indices are guaranteed to be > 0, so a negative number can
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
303 be used to indicate no bitmap.
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 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
306 the bitmaps yourself. That is, creating a bitmap from the same
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
307 data more than once will not be caught. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
308
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
309
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
310 /* Functions to access the contents of a bitmap, given an id. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
311
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
312 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
313 x_bitmap_height (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
314 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
315 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
316 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
317 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].height;
13434
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
320 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
321 x_bitmap_width (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
322 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
324 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
325 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
326 }
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 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
329 x_bitmap_pixmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
330 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
331 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
333 return (int) FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
334 }
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 /* Allocate a new bitmap record. Returns index of new record. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
338
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
340 x_allocate_bitmap_record (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
341 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
342 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
343 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344 int i;
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 if (dpyinfo->bitmaps == NULL)
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 dpyinfo->bitmaps_size = 10;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349 dpyinfo->bitmaps
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
350 = (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
351 dpyinfo->bitmaps_last = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 return 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
353 }
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_last < dpyinfo->bitmaps_size)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 return ++dpyinfo->bitmaps_last;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 for (i = 0; i < dpyinfo->bitmaps_size; ++i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
359 if (dpyinfo->bitmaps[i].refcount == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
360 return i + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
361
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 dpyinfo->bitmaps_size *= 2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363 dpyinfo->bitmaps
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
364 = (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
365 dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
366 return ++dpyinfo->bitmaps_last;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
369 /* 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
370
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
371 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
372 x_reference_bitmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
373 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
374 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
375 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
376 ++FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
13434
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379 /* 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
380
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
382 x_create_bitmap_from_data (f, bits, width, height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
384 char *bits;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
385 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
387 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 Pixmap bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
390
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
391 bitmap = CreateBitmap (width, height,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
392 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
393 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
394 bits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
395
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
396 if (! bitmap)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
398
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399 id = x_allocate_bitmap_record (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
400 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
401 dpyinfo->bitmaps[id - 1].file = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
402 dpyinfo->bitmaps[id - 1].hinst = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
403 dpyinfo->bitmaps[id - 1].refcount = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
404 dpyinfo->bitmaps[id - 1].depth = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
405 dpyinfo->bitmaps[id - 1].height = height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
406 dpyinfo->bitmaps[id - 1].width = width;
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 return id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
409 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
410
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
411 /* Create bitmap from file FILE for frame F. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
412
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
413 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
414 x_create_bitmap_from_file (f, file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
415 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
416 Lisp_Object file;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
417 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
418 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
419 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
420 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
421 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
422 Pixmap bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423 int xhot, yhot, result, id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
424 Lisp_Object found;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425 int fd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426 char *filename;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427 HINSTANCE hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
428
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
429 /* Look for an existing bitmap with the same name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
430 for (id = 0; id < dpyinfo->bitmaps_last; ++id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
431 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
432 if (dpyinfo->bitmaps[id].refcount
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
433 && dpyinfo->bitmaps[id].file
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
434 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 ++dpyinfo->bitmaps[id].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
437 return id + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
438 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
439 }
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 /* Search bitmap-file-path for the file, if appropriate. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
442 fd = openp (Vx_bitmap_file_path, file, "", &found, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
443 if (fd < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
444 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
445 close (fd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
446
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
447 filename = (char *) XSTRING (found)->data;
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 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
450
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
451 if (hinst == NULL)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
452 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
453
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
454
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
455 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
456 filename, &width, &height, &bitmap, &xhot, &yhot);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
457 if (result != BitmapSuccess)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
458 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
459
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
460 id = x_allocate_bitmap_record (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
461 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
462 dpyinfo->bitmaps[id - 1].refcount = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
463 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
464 dpyinfo->bitmaps[id - 1].depth = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
465 dpyinfo->bitmaps[id - 1].height = height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
466 dpyinfo->bitmaps[id - 1].width = width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
467 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
468
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
469 return id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
470 #endif
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
473 /* Remove reference to bitmap with id number ID. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
474
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
475 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
476 x_destroy_bitmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
477 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
478 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
479 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
480 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
481
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
482 if (id > 0)
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 --dpyinfo->bitmaps[id - 1].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
485 if (dpyinfo->bitmaps[id - 1].refcount == 0)
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 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
488 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
489 if (dpyinfo->bitmaps[id - 1].file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
490 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
491 free (dpyinfo->bitmaps[id - 1].file);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
492 dpyinfo->bitmaps[id - 1].file = NULL;
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 UNBLOCK_INPUT;
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 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
497 }
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 /* Free all the bitmaps for the display specified by DPYINFO. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
500
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
501 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
502 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
503 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
504 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
505 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
506 for (i = 0; i < dpyinfo->bitmaps_last; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
507 if (dpyinfo->bitmaps[i].refcount > 0)
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 DeleteObject (dpyinfo->bitmaps[i].pixmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
510 if (dpyinfo->bitmaps[i].file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
511 free (dpyinfo->bitmaps[i].file);
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 dpyinfo->bitmaps_last = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
514 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
515
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
516 /* Connect the frame-parameter names for W32 frames
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
517 to the ways of passing the parameter values to the window system.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
518
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
519 The name of a parameter, as a Lisp symbol,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
520 has an `x-frame-parameter' property which is an integer in Lisp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
521 but can be interpreted as an `enum x_frame_parm' in C. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
522
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
523 enum x_frame_parm
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 X_PARM_FOREGROUND_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
526 X_PARM_BACKGROUND_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
527 X_PARM_MOUSE_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
528 X_PARM_CURSOR_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
529 X_PARM_BORDER_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
530 X_PARM_ICON_TYPE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
531 X_PARM_FONT,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
532 X_PARM_BORDER_WIDTH,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
533 X_PARM_INTERNAL_BORDER_WIDTH,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
534 X_PARM_NAME,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
535 X_PARM_AUTORAISE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
536 X_PARM_AUTOLOWER,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
537 X_PARM_VERT_SCROLL_BAR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
538 X_PARM_VISIBILITY,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
539 X_PARM_MENU_BAR_LINES
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
540 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
541
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
542
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
543 struct x_frame_parm_table
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
544 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
545 char *name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
546 void (*setter)( /* struct frame *frame, Lisp_Object val, oldval */ );
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
547 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
548
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
549 void x_set_foreground_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
550 void x_set_background_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
551 void x_set_mouse_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
552 void x_set_cursor_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
553 void x_set_border_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
554 void x_set_cursor_type ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
555 void x_set_icon_type ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
556 void x_set_icon_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
557 void x_set_font ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
558 void x_set_border_width ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
559 void x_set_internal_border_width ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
560 void x_explicitly_set_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
561 void x_set_autoraise ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
562 void x_set_autolower ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
563 void x_set_vertical_scroll_bars ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
564 void x_set_visibility ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
565 void x_set_menu_bar_lines ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
566 void x_set_scroll_bar_width ();
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
567 void x_set_title ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
568 void x_set_unsplittable ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
569
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
570 static struct x_frame_parm_table x_frame_parms[] =
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
571 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
572 "auto-raise", x_set_autoraise,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
573 "auto-lower", x_set_autolower,
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
574 "background-color", x_set_background_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
575 "border-color", x_set_border_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
576 "border-width", x_set_border_width,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
577 "cursor-color", x_set_cursor_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
578 "cursor-type", x_set_cursor_type,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
579 "font", x_set_font,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
580 "foreground-color", x_set_foreground_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
581 "icon-name", x_set_icon_name,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
582 "icon-type", x_set_icon_type,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
583 "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
584 "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
585 "mouse-color", x_set_mouse_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
586 "name", x_explicitly_set_name,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
587 "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
588 "title", x_set_title,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
589 "unsplittable", x_set_unsplittable,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
590 "vertical-scroll-bars", x_set_vertical_scroll_bars,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
591 "visibility", x_set_visibility,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
592 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
593
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
594 /* 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
595 the Lisp symbol names of parameters relevant to W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
596
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
597 init_x_parm_symbols ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
598 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
599 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
600
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
601 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
602 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
603 make_number (i));
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 /* Change the parameters of FRAME as specified by ALIST.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
607 If a parameter is not specially recognized, do nothing;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
608 otherwise call the `x_set_...' function for that parameter. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
609
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
610 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
611 x_set_frame_parameters (f, alist)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
612 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
613 Lisp_Object alist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
614 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
615 Lisp_Object tail;
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 /* If both of these parameters are present, it's more efficient to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
618 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
619 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
620 int width, height;
13434
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 /* Same here. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
623 Lisp_Object left, top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
624
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
625 /* Same with these. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
626 Lisp_Object icon_left, icon_top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
627
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
628 /* Record in these vectors all the parms specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
629 Lisp_Object *parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
630 Lisp_Object *values;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
631 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
632 int left_no_change = 0, top_no_change = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
633 int icon_left_no_change = 0, icon_top_no_change = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
634
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
635 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
636 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
637 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
638
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
639 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
640 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
641
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
642 /* Extract parm names and values into those vectors. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
643
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
644 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
645 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
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 Lisp_Object elt, prop, val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
648
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
649 elt = Fcar (tail);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
650 parms[i] = Fcar (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
651 values[i] = Fcdr (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
652 i++;
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
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
655 top = left = Qunbound;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
656 icon_left = icon_top = Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
657
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
658 /* 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
659 width = FRAME_WIDTH (f);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
660 height = FRAME_HEIGHT (f);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
661
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
662 /* Now process them in reverse of specified order. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
663 for (i--; i >= 0; i--)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
664 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
665 Lisp_Object prop, val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
666
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
667 prop = parms[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
668 val = values[i];
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 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
671 width = XFASTINT (val);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
672 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
673 height = XFASTINT (val);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
674 else if (EQ (prop, Qtop))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
675 top = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
676 else if (EQ (prop, Qleft))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
677 left = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
678 else if (EQ (prop, Qicon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
679 icon_top = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
680 else if (EQ (prop, Qicon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
681 icon_left = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
682 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
683 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
684 register Lisp_Object param_index, old_value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
685
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
686 param_index = Fget (prop, Qx_frame_parameter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
687 old_value = get_frame_param (f, prop);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
688 store_frame_param (f, prop, val);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
689 if (NATNUMP (param_index)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
690 && (XFASTINT (param_index)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
691 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
692 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
693 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
694 }
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 /* Don't die if just one of these was set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
697 if (EQ (left, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
698 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
699 left_no_change = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
700 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
701 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
702 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
703 XSETINT (left, f->output_data.w32->left_pos);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
704 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
705 if (EQ (top, Qunbound))
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 top_no_change = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
708 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
709 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
710 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
711 XSETINT (top, f->output_data.w32->top_pos);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
712 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
713
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
714 /* 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
715 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))
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 icon_left_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
718 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
719 if (NILP (icon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
720 XSETINT (icon_left, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
721 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
722 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
723 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
724 icon_top_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
725 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
726 if (NILP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
727 XSETINT (icon_top, 0);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
730 /* Don't set these parameters unless they've been explicitly
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
731 specified. The window might be mapped or resized while we're in
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
732 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
733 code has asked for it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
734
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
735 Don't set these parameters unless they actually differ from the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
736 window's current parameters; the window may not actually exist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
737 yet. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
738 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
739 Lisp_Object frame;
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 check_frame_size (f, &height, &width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
742
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
743 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
744
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
745 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
746 || 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
747 Fset_frame_size (frame, make_number (width), make_number (height));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
748
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
749 if ((!NILP (left) || !NILP (top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
750 && ! (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
751 && ! (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
752 && NUMBERP (top) && XINT (top) == f->output_data.w32->top_pos))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
753 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
754 int leftpos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
755 int toppos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
756
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
757 /* Record the signs. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
758 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
759 if (EQ (left, Qminus))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
760 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
761 else if (INTEGERP (left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
762 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
763 leftpos = XINT (left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
764 if (leftpos < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
765 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
766 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
767 else if (CONSP (left) && EQ (XCONS (left)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
768 && CONSP (XCONS (left)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
769 && INTEGERP (XCONS (XCONS (left)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
770 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
771 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
772 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
773 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
774 else if (CONSP (left) && EQ (XCONS (left)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
775 && CONSP (XCONS (left)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
776 && INTEGERP (XCONS (XCONS (left)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
777 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
778 leftpos = XINT (XCONS (XCONS (left)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
779 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
780
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
781 if (EQ (top, Qminus))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
782 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
783 else if (INTEGERP (top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
784 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
785 toppos = XINT (top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
786 if (toppos < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
787 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
788 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
789 else if (CONSP (top) && EQ (XCONS (top)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
790 && CONSP (XCONS (top)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
791 && INTEGERP (XCONS (XCONS (top)->cdr)->car))
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 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
794 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
795 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
796 else if (CONSP (top) && EQ (XCONS (top)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
797 && CONSP (XCONS (top)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
798 && INTEGERP (XCONS (XCONS (top)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
799 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
800 toppos = XINT (XCONS (XCONS (top)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
801 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
802
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
803
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
804 /* 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
805 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
806 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
807
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
808 f->output_data.w32->win_gravity = NorthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
809
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
810 /* Actually set that position, and convert to absolute. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
811 x_set_offset (f, leftpos, toppos, -1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
812 }
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 if ((!NILP (icon_left) || !NILP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
815 && ! (icon_left_no_change && icon_top_no_change))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
816 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
817 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
818 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
819
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
820 /* Store the screen positions of frame F into XPTR and YPTR.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
821 These are the positions of the containing window manager window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
822 not Emacs's own window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
823
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
824 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
825 x_real_positions (f, xptr, yptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
826 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
827 int *xptr, *yptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
828 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
829 POINT pt;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
830
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
831 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
832 RECT rect;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
833
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
834 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
835 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
836
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
837 pt.x = rect.left;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
838 pt.y = rect.top;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
839 }
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
840
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
841 ClientToScreen (FRAME_W32_WINDOW(f), &pt);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
842
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
843 *xptr = pt.x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
844 *yptr = pt.y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
845 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
846
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
847 /* Insert a description of internally-recorded parameters of frame X
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
848 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
849 Only parameters that are specific to W32
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
850 and whose values are not correctly recorded in the frame's
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
851 param_alist need to be considered here. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
852
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
853 x_report_frame_params (f, alistptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
854 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
855 Lisp_Object *alistptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
856 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
857 char buf[16];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
858 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
859
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
860 /* Represent negative positions (off the top or left screen edge)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
861 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
862 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
863 if (f->output_data.w32->left_pos >= 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
864 store_in_alist (alistptr, Qleft, tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
865 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
866 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
867
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
868 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
869 if (f->output_data.w32->top_pos >= 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
870 store_in_alist (alistptr, Qtop, tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
871 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
872 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
873
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
874 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
875 make_number (f->output_data.w32->border_width));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
876 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
877 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
878 sprintf (buf, "%ld", (long) FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
879 store_in_alist (alistptr, Qwindow_id,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
880 build_string (buf));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
881 store_in_alist (alistptr, Qicon_name, f->icon_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
882 FRAME_SAMPLE_VISIBILITY (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
883 store_in_alist (alistptr, Qvisibility,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
884 (FRAME_VISIBLE_P (f) ? Qt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
885 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
886 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
887 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
888 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
889
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
890
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
891 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
892 "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
893 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
894 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
895 (red, green, blue, name)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
896 Lisp_Object red, green, blue, name;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
897 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
898 Lisp_Object rgb;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
899 Lisp_Object oldrgb = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
900 Lisp_Object entry;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
901
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
902 CHECK_NUMBER (red, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
903 CHECK_NUMBER (green, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
904 CHECK_NUMBER (blue, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
905 CHECK_STRING (name, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
906
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
907 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
908
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
909 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
910
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
911 /* 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
912 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
913 if (NILP (entry))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
914 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
915 entry = Fcons (name, rgb);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
916 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
917 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
918 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
919 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
920 oldrgb = Fcdr (entry);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
921 Fsetcdr (entry, rgb);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
922 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
923
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
924 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
925
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
926 return (oldrgb);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
927 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
928
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
929 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
930 "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
931 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
932 \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
933 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
934 R G B name\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
935 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
936 (filename)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
937 Lisp_Object filename;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
938 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
939 FILE *fp;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
940 Lisp_Object cmap = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
941 Lisp_Object abspath;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
942
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
943 CHECK_STRING (filename, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
944 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
945
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
946 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
947 if (fp)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
948 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
949 char buf[512];
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
950 int red, green, blue;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
951 int num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
952
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
953 BLOCK_INPUT;
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 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
956 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
957 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
958 char *name = buf + num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
959 num = strlen (name) - 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
960 if (name[num] == '\n')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
961 name[num] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
962 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
963 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
964 cmap);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
965 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
966 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
967 fclose (fp);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
968
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
969 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
970 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
971
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
972 return cmap;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
973 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
974
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
975 /* The default colors for the w32 color map */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
976 typedef struct colormap_t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
977 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
978 char *name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
979 COLORREF colorref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
980 } colormap_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
981
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
982 colormap_t w32_color_map[] =
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
983 {
14983
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
984 {"snow" , PALETTERGB (255,250,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
985 {"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
986 {"GhostWhite" , PALETTERGB (248,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
987 {"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
988 {"WhiteSmoke" , PALETTERGB (245,245,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
989 {"gainsboro" , PALETTERGB (220,220,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
990 {"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
991 {"FloralWhite" , PALETTERGB (255,250,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
992 {"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
993 {"OldLace" , PALETTERGB (253,245,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
994 {"linen" , PALETTERGB (250,240,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
995 {"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
996 {"AntiqueWhite" , PALETTERGB (250,235,215)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
997 {"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
998 {"PapayaWhip" , PALETTERGB (255,239,213)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
999 {"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
1000 {"BlanchedAlmond" , PALETTERGB (255,235,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1001 {"bisque" , PALETTERGB (255,228,196)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1002 {"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
1003 {"PeachPuff" , PALETTERGB (255,218,185)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1004 {"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
1005 {"NavajoWhite" , PALETTERGB (255,222,173)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1006 {"moccasin" , PALETTERGB (255,228,181)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1007 {"cornsilk" , PALETTERGB (255,248,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1008 {"ivory" , PALETTERGB (255,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1009 {"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
1010 {"LemonChiffon" , PALETTERGB (255,250,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1011 {"seashell" , PALETTERGB (255,245,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1012 {"honeydew" , PALETTERGB (240,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1013 {"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
1014 {"MintCream" , PALETTERGB (245,255,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1015 {"azure" , PALETTERGB (240,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1016 {"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
1017 {"AliceBlue" , PALETTERGB (240,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1018 {"lavender" , PALETTERGB (230,230,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1019 {"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
1020 {"LavenderBlush" , PALETTERGB (255,240,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1021 {"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
1022 {"MistyRose" , PALETTERGB (255,228,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1023 {"white" , PALETTERGB (255,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1024 {"black" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1025 {"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
1026 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1027 {"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
1028 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1029 {"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
1030 {"DimGray" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1031 {"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
1032 {"DimGrey" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1033 {"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
1034 {"SlateGray" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1035 {"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
1036 {"SlateGrey" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1037 {"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
1038 {"LightSlateGray" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1039 {"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
1040 {"LightSlateGrey" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1041 {"gray" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1042 {"grey" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1043 {"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
1044 {"LightGrey" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1045 {"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
1046 {"LightGray" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1047 {"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
1048 {"MidnightBlue" , PALETTERGB ( 25, 25,112)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1049 {"navy" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1050 {"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
1051 {"NavyBlue" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1052 {"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
1053 {"CornflowerBlue" , PALETTERGB (100,149,237)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1054 {"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
1055 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1056 {"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
1057 {"SlateBlue" , PALETTERGB (106, 90,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1058 {"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
1059 {"MediumSlateBlue" , PALETTERGB (123,104,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1060 {"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
1061 {"LightSlateBlue" , PALETTERGB (132,112,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1062 {"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
1063 {"MediumBlue" , PALETTERGB ( 0, 0,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1064 {"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
1065 {"RoyalBlue" , PALETTERGB ( 65,105,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1066 {"blue" , PALETTERGB ( 0, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1067 {"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
1068 {"DodgerBlue" , PALETTERGB ( 30,144,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1069 {"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
1070 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1071 {"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
1072 {"SkyBlue" , PALETTERGB (135,206,235)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1073 {"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
1074 {"LightSkyBlue" , PALETTERGB (135,206,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1075 {"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
1076 {"SteelBlue" , PALETTERGB ( 70,130,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1077 {"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
1078 {"LightSteelBlue" , PALETTERGB (176,196,222)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1079 {"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
1080 {"LightBlue" , PALETTERGB (173,216,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1081 {"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
1082 {"PowderBlue" , PALETTERGB (176,224,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1083 {"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
1084 {"PaleTurquoise" , PALETTERGB (175,238,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1085 {"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
1086 {"DarkTurquoise" , PALETTERGB ( 0,206,209)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1087 {"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
1088 {"MediumTurquoise" , PALETTERGB ( 72,209,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1089 {"turquoise" , PALETTERGB ( 64,224,208)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1090 {"cyan" , PALETTERGB ( 0,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1091 {"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
1092 {"LightCyan" , PALETTERGB (224,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1093 {"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
1094 {"CadetBlue" , PALETTERGB ( 95,158,160)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1095 {"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
1096 {"MediumAquamarine" , PALETTERGB (102,205,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1097 {"aquamarine" , PALETTERGB (127,255,212)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1098 {"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
1099 {"DarkGreen" , PALETTERGB ( 0,100, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1100 {"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
1101 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1102 {"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
1103 {"DarkSeaGreen" , PALETTERGB (143,188,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1104 {"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
1105 {"SeaGreen" , PALETTERGB ( 46,139, 87)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1106 {"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
1107 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1108 {"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
1109 {"LightSeaGreen" , PALETTERGB ( 32,178,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1110 {"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
1111 {"PaleGreen" , PALETTERGB (152,251,152)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1112 {"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
1113 {"SpringGreen" , PALETTERGB ( 0,255,127)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1114 {"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
1115 {"LawnGreen" , PALETTERGB (124,252, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1116 {"green" , PALETTERGB ( 0,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1117 {"chartreuse" , PALETTERGB (127,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1118 {"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
1119 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1120 {"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
1121 {"GreenYellow" , PALETTERGB (173,255, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1122 {"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
1123 {"LimeGreen" , PALETTERGB ( 50,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1124 {"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
1125 {"YellowGreen" , PALETTERGB (154,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1126 {"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
1127 {"ForestGreen" , PALETTERGB ( 34,139, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1128 {"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
1129 {"OliveDrab" , PALETTERGB (107,142, 35)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1130 {"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
1131 {"DarkKhaki" , PALETTERGB (189,183,107)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1132 {"khaki" , PALETTERGB (240,230,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1133 {"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
1134 {"PaleGoldenrod" , PALETTERGB (238,232,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1135 {"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
1136 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1137 {"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
1138 {"LightYellow" , PALETTERGB (255,255,224)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1139 {"yellow" , PALETTERGB (255,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1140 {"gold" , PALETTERGB (255,215, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1141 {"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
1142 {"LightGoldenrod" , PALETTERGB (238,221,130)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1143 {"goldenrod" , PALETTERGB (218,165, 32)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1144 {"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
1145 {"DarkGoldenrod" , PALETTERGB (184,134, 11)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1146 {"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
1147 {"RosyBrown" , PALETTERGB (188,143,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1148 {"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
1149 {"IndianRed" , PALETTERGB (205, 92, 92)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1150 {"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
1151 {"SaddleBrown" , PALETTERGB (139, 69, 19)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1152 {"sienna" , PALETTERGB (160, 82, 45)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1153 {"peru" , PALETTERGB (205,133, 63)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1154 {"burlywood" , PALETTERGB (222,184,135)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1155 {"beige" , PALETTERGB (245,245,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1156 {"wheat" , PALETTERGB (245,222,179)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1157 {"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
1158 {"SandyBrown" , PALETTERGB (244,164, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1159 {"tan" , PALETTERGB (210,180,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1160 {"chocolate" , PALETTERGB (210,105, 30)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1161 {"firebrick" , PALETTERGB (178,34, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1162 {"brown" , PALETTERGB (165,42, 42)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1163 {"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
1164 {"DarkSalmon" , PALETTERGB (233,150,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1165 {"salmon" , PALETTERGB (250,128,114)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1166 {"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
1167 {"LightSalmon" , PALETTERGB (255,160,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1168 {"orange" , PALETTERGB (255,165, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1169 {"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
1170 {"DarkOrange" , PALETTERGB (255,140, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1171 {"coral" , PALETTERGB (255,127, 80)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1172 {"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
1173 {"LightCoral" , PALETTERGB (240,128,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1174 {"tomato" , PALETTERGB (255, 99, 71)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1175 {"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
1176 {"OrangeRed" , PALETTERGB (255, 69, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1177 {"red" , PALETTERGB (255, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1178 {"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
1179 {"HotPink" , PALETTERGB (255,105,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1180 {"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
1181 {"DeepPink" , PALETTERGB (255, 20,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1182 {"pink" , PALETTERGB (255,192,203)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1183 {"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
1184 {"LightPink" , PALETTERGB (255,182,193)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1185 {"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
1186 {"PaleVioletRed" , PALETTERGB (219,112,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1187 {"maroon" , PALETTERGB (176, 48, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1188 {"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
1189 {"MediumVioletRed" , PALETTERGB (199, 21,133)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1190 {"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
1191 {"VioletRed" , PALETTERGB (208, 32,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1192 {"magenta" , PALETTERGB (255, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1193 {"violet" , PALETTERGB (238,130,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1194 {"plum" , PALETTERGB (221,160,221)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1195 {"orchid" , PALETTERGB (218,112,214)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1196 {"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
1197 {"MediumOrchid" , PALETTERGB (186, 85,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1198 {"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
1199 {"DarkOrchid" , PALETTERGB (153, 50,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1200 {"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
1201 {"DarkViolet" , PALETTERGB (148, 0,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1202 {"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
1203 {"BlueViolet" , PALETTERGB (138, 43,226)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1204 {"purple" , PALETTERGB (160, 32,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1205 {"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
1206 {"MediumPurple" , PALETTERGB (147,112,219)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1207 {"thistle" , PALETTERGB (216,191,216)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1208 {"gray0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1209 {"grey0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1210 {"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
1211 {"DarkGrey" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1212 {"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
1213 {"DarkGray" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1214 {"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
1215 {"DarkBlue" , PALETTERGB ( 0, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1216 {"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
1217 {"DarkCyan" , PALETTERGB ( 0,139,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1218 {"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
1219 {"DarkMagenta" , PALETTERGB (139, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1220 {"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
1221 {"DarkRed" , PALETTERGB (139, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1222 {"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
1223 {"LightGreen" , PALETTERGB (144,238,144)},
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1224 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1225
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1226 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
1227 0, 0, 0, "Return the default color map.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1228 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1229 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1230 int i;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1231 colormap_t *pc = w32_color_map;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1232 Lisp_Object cmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1233
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1234 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1235
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1236 cmap = Qnil;
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 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
1239 pc++, i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1240 cmap = Fcons (Fcons (build_string (pc->name),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1241 make_number (pc->colorref)),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1242 cmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1243
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1244 UNBLOCK_INPUT;
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 return (cmap);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1249 Lisp_Object
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1250 w32_to_x_color (rgb)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1251 Lisp_Object rgb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1252 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1253 Lisp_Object color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1254
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1255 CHECK_NUMBER (rgb, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1256
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1257 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1258
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1259 color = Frassq (rgb, Vw32_color_map);
13434
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 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1262
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1263 if (!NILP (color))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1264 return (Fcar (color));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1265 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1266 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1267 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1268
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1269 COLORREF
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1270 w32_color_map_lookup (colorname)
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1271 char *colorname;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1272 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1273 Lisp_Object tail, ret = Qnil;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1274
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1275 BLOCK_INPUT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1276
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1277 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
1278 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1279 register Lisp_Object elt, tem;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1280
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1281 elt = Fcar (tail);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1282 if (!CONSP (elt)) continue;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1283
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1284 tem = Fcar (elt);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1285
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1286 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0)
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1287 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1288 ret = XUINT (Fcdr (elt));
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1289 break;
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
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1292 QUIT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1293 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1294
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 UNBLOCK_INPUT;
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 return ret;
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
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1301 COLORREF
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1302 x_to_w32_color (colorname)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1303 char * colorname;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1304 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1305 register Lisp_Object tail, ret = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1306
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1307 BLOCK_INPUT;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1308
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1309 if (colorname[0] == '#')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1310 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1311 /* 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
1312 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1313 int size;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1314 color = colorname + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1315
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1316 size = strlen(color);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1317 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
1318 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1319 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1320 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1321 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1322 size /= 3;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1323 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1324
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1325 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1326 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1327 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1328 char t;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1329 unsigned long value;
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 /* 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
1332 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
1333 our numbers, and we don't. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1334 if (!isxdigit(color[0]) || color[1] == 'x')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1335 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1336 t = color[size];
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1337 color[size] = '\0';
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1338 value = strtoul(color, &end, 16);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1339 color[size] = t;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1340 if (errno == ERANGE || end - color != size)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1341 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1342 switch (size)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1343 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1344 case 1:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1345 value = value * 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1346 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1347 case 2:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1348 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1349 case 3:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1350 value /= 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1351 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1352 case 4:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1353 value /= 0x100;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1354 break;
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 colorval |= (value << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1357 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1358 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1359 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1360 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1361 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1362 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1363 color = end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1364 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1365 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1366 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1367 else if (strnicmp(colorname, "rgb:", 4) == 0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1368 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1369 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1370 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1371 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1372 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1373
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1374 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1375 color = colorname + 4;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1376 for (i = 0; i < 3; i++)
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 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1379 unsigned long value;
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 /* 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
1382 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
1383 our numbers, and we don't. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1384 if (!isxdigit(color[0]) || color[1] == 'x')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1385 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1386 value = strtoul(color, &end, 16);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1387 if (errno == ERANGE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1388 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1389 switch (end - color)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1390 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1391 case 1:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1392 value = value * 0x10 + value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1393 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1394 case 2:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1395 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1396 case 3:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1397 value /= 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1398 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1399 case 4:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1400 value /= 0x100;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1401 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1402 default:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1403 value = ULONG_MAX;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1404 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1405 if (value == ULONG_MAX)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1406 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1407 colorval |= (value << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1408 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1409 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1410 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1411 if (*end != '\0')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1412 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1413 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1414 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1415 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1416 if (*end != '/')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1417 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1418 color = end + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1419 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1420 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1421 else if (strnicmp(colorname, "rgbi:", 5) == 0)
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 /* This is an RGB Intensity specification. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1424 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1425 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1426 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1427 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1428
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1429 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1430 color = colorname + 5;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1431 for (i = 0; i < 3; i++)
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 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1434 double value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1435 UINT val;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1436
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1437 value = strtod(color, &end);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1438 if (errno == ERANGE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1439 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1440 if (value < 0.0 || value > 1.0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1441 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1442 val = (UINT)(0x100 * value);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1443 /* 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
1444 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
1445 fixes the 1.0 case. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1446 if (val == 0x100)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1447 val = 0xFF;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1448 colorval |= (val << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1449 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1450 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1451 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1452 if (*end != '\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 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1455 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1456 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1457 if (*end != '/')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1458 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1459 color = end + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1460 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1461 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1462 /* 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
1463 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
1464 RGB. */
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1465
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1466 /* 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
1467 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
1468 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
1469 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
1470 ret = w32_color_map_lookup (colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1471 if (NILP (ret))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1472 {
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1473 int len = strlen (colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1474
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1475 if (isdigit (colorname[len - 1]))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1476 {
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1477 char *ptr, *approx = alloca (len);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1478
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1479 strcpy (approx, colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1480 ptr = &approx[len - 1];
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1481 while (ptr > approx && isdigit (*ptr))
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1482 *ptr-- = '\0';
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1483
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1484 ret = w32_color_map_lookup (approx);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1485 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1486 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1487
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1488 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1489 return ret;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1490 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1491
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1492
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1493 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1494 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
1495 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1496 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
1497 LOGPALETTE * log_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1498 HPALETTE new_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1499 int i;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1500
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1501 /* 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
1502 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
1503 return;
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 log_palette = (LOGPALETTE *)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1506 alloca (sizeof (LOGPALETTE) +
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1507 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
1508 log_palette->palVersion = 0x300;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1509 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
1510
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1511 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
1512 for (i = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1513 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
1514 i++, list = list->next)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1515 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
1516
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1517 new_palette = CreatePalette (log_palette);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1518
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1519 enter_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1520
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1521 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
1522 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
1523 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
1524
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1525 /* 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
1526 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
1527
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1528 leave_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1529 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1530
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1531 #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
1532 #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
1533 do \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1534 { \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1535 pe.peRed = GetRValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1536 pe.peGreen = GetGValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1537 pe.peBlue = GetBValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1538 pe.peFlags = 0; \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1539 } while (0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1540
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1541 #if 0
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1542 /* 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
1543 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1544 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
1545 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1546 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
1547
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1548 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
1549 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1550
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1551 /* 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
1552 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1553 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1554 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
1555 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1556 ++list->refcount;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1557 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1558 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1559 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1560 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1561
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1562 /* 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
1563 list = (struct w32_palette_entry *)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1564 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
1565 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
1566 list->refcount = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1567 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
1568 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
1569 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
1570
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1571 /* 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
1572 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
1573 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1574
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1575 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1576 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
1577 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1578 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
1579 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
1580
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1581 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
1582 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1583
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1584 /* 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
1585 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1586 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1587 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
1588 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1589 if (--list->refcount == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1590 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1591 *prev = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1592 xfree (list);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1593 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
1594 break;
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 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1597 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1598 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1599 prev = &list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1600 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1601 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1602
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1603 /* 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
1604 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
1605 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1606 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1607
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1608 /* Decide if color named COLOR is valid for the display associated with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1609 the selected frame; if so, return the rgb values in COLOR_DEF.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1610 If ALLOC is nonzero, allocate a new colormap cell. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1611
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1612 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1613 defined_color (f, color, color_def, alloc)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1614 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1615 char *color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1616 COLORREF *color_def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1617 int alloc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1618 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1619 register Lisp_Object tem;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1620
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1621 tem = x_to_w32_color (color);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1622
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1623 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1624 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1625 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
1626 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1627 struct w32_palette_entry * entry =
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1628 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
1629 struct w32_palette_entry ** prev =
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1630 &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
1631
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1632 /* 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
1633 while (entry)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1634 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1635 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
1636 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1637 prev = &entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1638 entry = entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1639 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1640
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1641 if (entry == NULL && alloc)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1642 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1643 /* 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
1644 entry = (struct w32_palette_entry *)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1645 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
1646 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
1647 entry->next = NULL;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1648 *prev = entry;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1649 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
1650
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1651 /* 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
1652 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
1653 }
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 /* 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
1656 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
1657 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
1658 *color_def = XUINT (tem) | 0x2000000;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1659 return 1;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1660 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1661 else
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1662 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1663 return 0;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1664 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1665 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1666
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1667 /* 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
1668 suitable for screen F.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1669 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
1670 ARG says. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1671
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1672 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1673 x_decode_color (f, arg, def)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1674 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1675 Lisp_Object arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1676 int def;
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 COLORREF cdef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1679
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1680 CHECK_STRING (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1681
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1682 if (strcmp (XSTRING (arg)->data, "black") == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1683 return BLACK_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1684 else if (strcmp (XSTRING (arg)->data, "white") == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1685 return WHITE_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1686
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1687 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
1688 return 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 /* defined_color is responsible for coping with failures
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1691 by looking for a near-miss. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1692 if (defined_color (f, XSTRING (arg)->data, &cdef, 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1693 return cdef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1694
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1695 /* defined_color failed; return an ultimate default. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1696 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1697 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1698
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1699 /* Functions called only from `x_set_frame_param'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1700 to set individual parameters.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1701
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1702 If FRAME_W32_WINDOW (f) is 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1703 the frame is being created and its window does not exist yet.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1704 In that case, just record the parameter's new value
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1705 in the standard place; do not attempt to change the window. */
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 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1708 x_set_foreground_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1709 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1710 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1711 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1712 f->output_data.w32->foreground_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1713 = 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
1714
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1715 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1716 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1717 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1718 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1719 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1720 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1721 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1722
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1723 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1724 x_set_background_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1725 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1726 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1727 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1728 Pixmap temp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1729 int mask;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1730
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1731 f->output_data.w32->background_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1732 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1733
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1734 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1735 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1736 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
1737
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1738 recompute_basic_faces (f);
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 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1741 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1742 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1743 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1744
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1745 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1746 x_set_mouse_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1747 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1748 Lisp_Object arg, oldval;
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 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1751 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
1752 #endif
17632
d2915156a803 (x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents: 16884
diff changeset
1753 int count;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1754 int mask_color;
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 if (!EQ (Qnil, arg))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1757 f->output_data.w32->mouse_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1758 = 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
1759 mask_color = f->output_data.w32->background_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1760 /* No invisible pointers. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1761 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
1762 && 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
1763 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
1764
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1765 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1766 BLOCK_INPUT;
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 /* 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
1769 count = x_catch_errors (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1770
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1771 if (!EQ (Qnil, Vx_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1772 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1773 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
1774 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1775 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1776 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1777 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
1778 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
1779
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1780 if (!EQ (Qnil, Vx_nontext_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1781 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1782 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
1783 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1784 XINT (Vx_nontext_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1785 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1786 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1787 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
1788 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
1789
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1790 if (!EQ (Qnil, Vx_mode_pointer_shape))
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 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
1793 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1794 XINT (Vx_mode_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1795 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1796 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1797 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
1798 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
1799
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1800 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape))
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 CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1803 cross_cursor
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1804 = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1805 XINT (Vx_sensitive_text_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1806 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1807 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1808 cross_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1809
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1810 /* 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
1811 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
1812 x_uncatch_errors (FRAME_W32_DISPLAY (f), count);
13434
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 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1815 XColor fore_color, back_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1816
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1817 fore_color.pixel = f->output_data.w32->mouse_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1818 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
1819 XQueryColor (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1820 DefaultColormap (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1821 DefaultScreen (FRAME_W32_DISPLAY (f))),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1822 &fore_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1823 XQueryColor (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1824 DefaultColormap (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1825 DefaultScreen (FRAME_W32_DISPLAY (f))),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1826 &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1827 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1828 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1829 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1830 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1831 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1832 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1833 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1834 &fore_color, &back_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1835 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1836
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1837 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1838 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1839 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1840 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1841
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1842 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
1843 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
1844 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
1845
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1846 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
1847 && 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
1848 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
1849 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
1850
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1851 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
1852 && 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
1853 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
1854 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
1855 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
1856 && 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
1857 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
1858 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
1859
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1860 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1861 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1862 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1863 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1864
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1865 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1866 x_set_cursor_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1867 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1868 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1869 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1870 unsigned long fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1871
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1872 if (!EQ (Vx_cursor_fore_pixel, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1873 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1874 WHITE_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1875 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1876 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
1877 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
1878
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1879 /* 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
1880 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
1881 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1882 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
1883 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
1884 fore_pixel = f->output_data.w32->background_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1885 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1886 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
1887
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1888 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1889 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1890 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1891 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1892 x_display_cursor (f, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1893 x_display_cursor (f, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1894 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1895 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1896 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1897
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1898 /* Set the border-color of frame F to value described by ARG.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1899 ARG can be a string naming a color.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1900 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
1901 Note that this does not fully take effect if done before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1902 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
1903
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1904 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1905 x_set_border_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1906 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1907 Lisp_Object arg, oldval;
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 unsigned char *str;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1910 int pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1911
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1912 CHECK_STRING (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1913 str = XSTRING (arg)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1914
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1915 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1916
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1917 x_set_border_pixel (f, pix);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1918 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1919
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1920 /* Set the border-color of frame F to pixel value PIX.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1921 Note that this does not fully take effect if done before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1922 F has an window. */
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 x_set_border_pixel (f, pix)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1925 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1926 int pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1927 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1928 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
1929
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1930 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
1931 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1932 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1933 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1934 }
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1937 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1938 x_set_cursor_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1939 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1940 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1941 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1942 if (EQ (arg, Qbar))
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 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
1945 f->output_data.w32->cursor_width = 2;
13434
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 else if (CONSP (arg) && EQ (XCONS (arg)->car, Qbar)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1948 && INTEGERP (XCONS (arg)->cdr))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1949 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1950 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
1951 f->output_data.w32->cursor_width = XINT (XCONS (arg)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1952 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1953 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1954 /* Treat anything unknown as "box cursor".
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1955 It was bad to signal an error; people have trouble fixing
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1956 .Xdefaults with Emacs, when it has something bad in it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1957 FRAME_DESIRED_CURSOR (f) = filled_box_cursor;
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 /* Make sure the cursor gets redrawn. This is overkill, but how
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1960 often do people change cursor types? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1961 update_mode_lines++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1962 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1963
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1964 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1965 x_set_icon_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1966 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1967 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1968 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1969 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1970 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1971 int result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1972
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1973 if (STRINGP (arg))
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 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1976 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1977 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1978 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1979 return;
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 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1982 if (NILP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1983 result = x_text_icon (f,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1984 (char *) XSTRING ((!NILP (f->icon_name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1985 ? f->icon_name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1986 : f->name))->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1987 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1988 result = x_bitmap_icon (f, arg);
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 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1991 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1992 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1993 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1994 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1995
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1996 /* If the window was unmapped (and its icon was mapped),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1997 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
1998 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1999 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2000 #ifdef USE_X_TOOLKIT
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2001 XtPopup (f->output_data.w32->widget, XtGrabNone);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2002 #endif
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2003 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2004 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2005
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2006 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2007 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2008 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2009 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2010
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2011 /* Return non-nil if frame F wants a bitmap icon. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2012
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2013 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2014 x_icon_type (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2015 FRAME_PTR f;
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 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2018
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2019 tem = assq_no_quit (Qicon_type, f->param_alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2020 if (CONSP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2021 return XCONS (tem)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2022 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2023 return Qnil;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2026 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2027 x_set_icon_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2028 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2029 Lisp_Object arg, oldval;
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 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2032 int result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2033
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2034 if (STRINGP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2035 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2036 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2037 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2038 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2039 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2040 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2041
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2042 f->icon_name = arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2043
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2044 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2045 if (f->output_data.w32->icon_bitmap != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2046 return;
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 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2049
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2050 result = x_text_icon (f,
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2051 (char *) XSTRING ((!NILP (f->icon_name)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2052 ? f->icon_name
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2053 : !NILP (f->title)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2054 ? f->title
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2055 : f->name))->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2056
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2057 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2058 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2059 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2060 error ("No icon window available");
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2063 /* If the window was unmapped (and its icon was mapped),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2064 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
2065 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2066 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2067 #ifdef USE_X_TOOLKIT
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2068 XtPopup (f->output_data.w32->widget, XtGrabNone);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2069 #endif
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2070 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2071 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2072
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2073 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2074 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2075 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2076 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2077
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2078 extern Lisp_Object x_new_font ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2079
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2080 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2081 x_set_font (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2082 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2083 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2084 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2085 Lisp_Object result;
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2086 Lisp_Object frame;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2087
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2088 CHECK_STRING (arg, 1);
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 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2091 result = x_new_font (f, XSTRING (arg)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2092 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2093
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2094 if (EQ (result, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2095 error ("Font \"%s\" is not defined", XSTRING (arg)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2096 else if (EQ (result, Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2097 error ("the characters of the given font have varying widths");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2098 else if (STRINGP (result))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2099 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2100 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2101 store_frame_param (f, Qfont, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2102 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2103 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2104 abort ();
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2105
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2106 XSETFRAME (frame, f);
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2107 call1 (Qface_set_after_frame_default, frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2108 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2109
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2110 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2111 x_set_border_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2112 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2113 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2114 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2115 CHECK_NUMBER (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2116
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2117 if (XINT (arg) == f->output_data.w32->border_width)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2118 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2119
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2120 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2121 error ("Cannot change the border width of a window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2122
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2123 f->output_data.w32->border_width = XINT (arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2124 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2125
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2126 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2127 x_set_internal_border_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2128 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2129 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2130 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2131 int mask;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2132 int old = f->output_data.w32->internal_border_width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2133
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2134 CHECK_NUMBER (arg, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2135 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
2136 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
2137 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
2138
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2139 if (f->output_data.w32->internal_border_width == old)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2140 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2141
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2142 if (FRAME_W32_WINDOW (f) != 0)
13434
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 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2145 x_set_window_size (f, 0, f->width, f->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2146 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2147 SET_FRAME_GARBAGED (f);
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 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2150
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2151 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2152 x_set_visibility (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2153 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2154 Lisp_Object value, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2155 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2156 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2157 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2158
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2159 if (NILP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2160 Fmake_frame_invisible (frame, Qt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2161 else if (EQ (value, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2162 Ficonify_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2163 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2164 Fmake_frame_visible (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2165 }
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 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2168 x_set_menu_bar_lines (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2169 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2170 Lisp_Object value, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2171 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2172 int nlines;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2173 int olines = FRAME_MENU_BAR_LINES (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2174
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2175 /* Right now, menu bars don't work properly in minibuf-only frames;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2176 most of the commands try to apply themselves to the minibuffer
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2177 frame itslef, and get an error because you can't switch buffers
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2178 in or split the minibuffer window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2179 if (FRAME_MINIBUF_ONLY_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2180 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2181
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2182 if (INTEGERP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2183 nlines = XINT (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2184 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2185 nlines = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2186
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2187 FRAME_MENU_BAR_LINES (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2188 if (nlines)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2189 FRAME_EXTERNAL_MENU_BAR (f) = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2190 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2191 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2192 if (FRAME_EXTERNAL_MENU_BAR (f) == 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2193 free_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2194 FRAME_EXTERNAL_MENU_BAR (f) = 0;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2195
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2196 /* 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
2197 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
2198 set correctly. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2199 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
2200 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2201 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2202
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2203 /* 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
2204 w32_id_name.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2205
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2206 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
2207 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
2208 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
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 EXPLICIT is zero, that indicates that Emacs redisplay code is
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2211 suggesting a new name, which lisp code should override; if
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2212 F->explicit_name is set, ignore the new name; otherwise, set it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2213
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2214 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2215 x_set_name (f, name, explicit)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2216 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2217 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2218 int explicit;
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 /* Make sure that requests from lisp code override requests from
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2221 Emacs redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2222 if (explicit)
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 we're switching from explicit to implicit, we had better
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2225 update the mode lines and thereby update the title. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2226 if (f->explicit_name && NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2227 update_mode_lines = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2228
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2229 f->explicit_name = ! NILP (name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2230 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2231 else if (f->explicit_name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2232 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2233
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2234 /* 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
2235 if (NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2236 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2237 /* Check for no change needed in this very common case
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2238 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
2239 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2240 XSTRING (f->name)->data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2241 return;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2242 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2243 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2244 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2245 CHECK_STRING (name, 0);
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 /* Don't change the name if it's already NAME. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2248 if (! NILP (Fstring_equal (name, f->name)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2249 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2250
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2251 f->name = name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2252
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2253 /* 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
2254 the name parameter. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2255 if (! NILP (f->title))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2256 name = f->title;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2257
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2258 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2259 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2260 BLOCK_INPUT;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2261 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2262 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2263 }
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2266 /* This function should be called when the user's lisp code has
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2267 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
2268 redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2269 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2270 x_explicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2271 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2272 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2273 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2274 x_set_name (f, arg, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2275 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2276
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2277 /* This function should be called by Emacs redisplay code to set the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2278 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
2279 lisp code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2280 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2281 x_implicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2282 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2283 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2284 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2285 x_set_name (f, arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2286 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2287
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2288 /* 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
2289 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
2290
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2291 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
2292 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
2293 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
2294
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2295 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
2296 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
2297 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
2298
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2299 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2300 x_set_title (f, name)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2301 struct frame *f;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2302 Lisp_Object name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2303 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2304 /* 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
2305 if (EQ (name, f->title))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2306 return;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2307
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2308 update_mode_lines = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2309
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2310 f->title = name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2311
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2312 if (NILP (name))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2313 name = f->name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2314
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2315 if (FRAME_W32_WINDOW (f))
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 BLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2318 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
2319 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2320 }
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
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2323 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2324 x_set_autoraise (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2325 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2326 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2327 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2328 f->auto_raise = !EQ (Qnil, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2329 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2330
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2331 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2332 x_set_autolower (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2333 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2334 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2335 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2336 f->auto_lower = !EQ (Qnil, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2337 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2338
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2339 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2340 x_set_unsplittable (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2341 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2342 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2343 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2344 f->no_split = !NILP (arg);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2347 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2348 x_set_vertical_scroll_bars (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2349 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2350 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2351 {
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2352 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
2353 || (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
2354 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f))
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2355 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2356 {
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2357 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = NILP (arg) ?
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2358 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
2359 /* 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
2360 on MS-Windows. */
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2361 EQ (Qleft, arg)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2362 ? 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
2363 : vertical_scroll_bar_right;
13434
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 /* We set this parameter before creating the window for the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2366 frame, so we can get the geometry right from the start.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2367 However, if the window hasn't been created yet, we shouldn't
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2368 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
2369 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2370 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2371 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2372 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2373
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2374 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2375 x_set_scroll_bar_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2376 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2377 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2378 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2379 if (NILP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2380 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2381 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2382 FRAME_SCROLL_BAR_COLS (f) = 2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2383 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2384 else if (INTEGERP (arg) && XINT (arg) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2385 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2386 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2387 int wid = FONT_WIDTH (f->output_data.w32->font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2388 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2389 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
2390 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2391 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2392 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2393 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2394
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2395 /* Subroutines of creating an frame. */
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 /* Make sure that Vx_resource_name is set to a reasonable value.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2398 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
2399
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2400 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2401 validate_x_resource_name ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2402 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2403 int len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2404 /* Number of valid characters in the resource name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2405 int good_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2406 /* Number of invalid characters in the resource name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2407 int bad_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2408 Lisp_Object new;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2409 int i;
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 if (STRINGP (Vx_resource_name))
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 unsigned char *p = XSTRING (Vx_resource_name)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2414 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2415
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2416 len = XSTRING (Vx_resource_name)->size;
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 /* Only letters, digits, - and _ are valid in resource names.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2419 Count the valid characters and count the invalid ones. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2420 for (i = 0; i < len; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2421 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2422 int c = p[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2423 if (! ((c >= 'a' && c <= 'z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2424 || (c >= 'A' && c <= 'Z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2425 || (c >= '0' && c <= '9')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2426 || c == '-' || c == '_'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2427 bad_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2428 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2429 good_count++;
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 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2432 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2433 /* Not a string => completely invalid. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2434 bad_count = 5, good_count = 0;
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 /* If name is valid already, return. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2437 if (bad_count == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2438 return;
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 /* If name is entirely invalid, or nearly so, use `emacs'. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2441 if (good_count == 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2442 || (good_count == 1 && bad_count > 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2443 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2444 Vx_resource_name = build_string ("emacs");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2445 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2446 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2447
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2448 /* Name is partly valid. Copy it and replace the invalid characters
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2449 with underscores. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2450
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2451 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2452
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2453 for (i = 0; i < len; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2454 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2455 int c = XSTRING (new)->data[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2456 if (! ((c >= 'a' && c <= 'z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2457 || (c >= 'A' && c <= 'Z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2458 || (c >= '0' && c <= '9')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2459 || c == '-' || c == '_'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2460 XSTRING (new)->data[i] = '_';
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 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2463
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 extern char *x_get_string_resource ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2466
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2467 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
2468 "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
2469 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
2470 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
2471 the name specified by the `-name' or `-rn' command-line arguments.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2472 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2473 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
2474 class, respectively. You must specify both of them or neither.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2475 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2476 and the class is `Emacs.CLASS.SUBCLASS'.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2477 (attribute, class, component, subclass)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2478 Lisp_Object attribute, class, component, subclass;
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 register char *value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2481 char *name_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2482 char *class_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2483
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2484 CHECK_STRING (attribute, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2485 CHECK_STRING (class, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2486
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2487 if (!NILP (component))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2488 CHECK_STRING (component, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2489 if (!NILP (subclass))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2490 CHECK_STRING (subclass, 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2491 if (NILP (component) != NILP (subclass))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2492 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2493
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2494 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2495
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2496 /* Allocate space for the components, the dots which separate them,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2497 and the final '\0'. Make them big enough for the worst case. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2498 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2499 + (STRINGP (component)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2500 ? XSTRING (component)->size : 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2501 + XSTRING (attribute)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2502 + 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2503
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2504 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2505 + XSTRING (class)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2506 + (STRINGP (subclass)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2507 ? XSTRING (subclass)->size : 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2508 + 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2509
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2510 /* Start with emacs.FRAMENAME for the name (the specific one)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2511 and with `Emacs' for the class key (the general one). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2512 strcpy (name_key, XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2513 strcpy (class_key, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2514
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2515 strcat (class_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2516 strcat (class_key, XSTRING (class)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2517
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2518 if (!NILP (component))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2519 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2520 strcat (class_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2521 strcat (class_key, XSTRING (subclass)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2522
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2523 strcat (name_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2524 strcat (name_key, XSTRING (component)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2525 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2526
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2527 strcat (name_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2528 strcat (name_key, XSTRING (attribute)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2529
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2530 value = x_get_string_resource (Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2531 name_key, class_key);
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 if (value != (char *) 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2534 return build_string (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2535 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2536 return Qnil;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2539 /* Used when C code wants a resource value. */
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 char *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2542 x_get_resource_string (attribute, class)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2543 char *attribute, *class;
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 register char *value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2546 char *name_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2547 char *class_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2548
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2549 /* Allocate space for the components, the dots which separate them,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2550 and the final '\0'. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2551 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2552 + strlen (attribute) + 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2553 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2554 + strlen (class) + 2);
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 sprintf (name_key, "%s.%s",
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2557 XSTRING (Vinvocation_name)->data,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2558 attribute);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2559 sprintf (class_key, "%s.%s", EMACS_CLASS, class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2560
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2561 return x_get_string_resource (selected_frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2562 name_key, class_key);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2563 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2564
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2565 /* Types we might convert a resource string into. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2566 enum resource_types
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2567 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2568 number, boolean, string, symbol
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2569 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2570
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2571 /* Return the value of parameter PARAM.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2572
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2573 First search ALIST, then Vdefault_frame_alist, then the X defaults
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2574 database, using ATTRIBUTE as the attribute name and CLASS as its class.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2575
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2576 Convert the resource to the type specified by desired_type.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2577
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2578 If no default is specified, return Qunbound. If you call
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2579 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
2580 and don't let it get stored in any Lisp-visible variables! */
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 static Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2583 x_get_arg (alist, param, attribute, class, type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2584 Lisp_Object alist, param;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2585 char *attribute;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2586 char *class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2587 enum resource_types type;
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 register Lisp_Object tem;
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 tem = Fassq (param, alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2592 if (EQ (tem, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2593 tem = Fassq (param, Vdefault_frame_alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2594 if (EQ (tem, Qnil))
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2597 if (attribute)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2598 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2599 tem = Fx_get_resource (build_string (attribute),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2600 build_string (class),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2601 Qnil, Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2602
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2603 if (NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2604 return Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2605
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2606 switch (type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2607 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2608 case number:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2609 return make_number (atoi (XSTRING (tem)->data));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2610
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2611 case boolean:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2612 tem = Fdowncase (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2613 if (!strcmp (XSTRING (tem)->data, "on")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2614 || !strcmp (XSTRING (tem)->data, "true"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2615 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2616 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2617 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2618
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2619 case string:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2620 return tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2621
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2622 case symbol:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2623 /* As a special case, we map the values `true' and `on'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2624 to Qt, and `false' and `off' to Qnil. */
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 Lisp_Object lower;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2627 lower = Fdowncase (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2628 if (!strcmp (XSTRING (lower)->data, "on")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2629 || !strcmp (XSTRING (lower)->data, "true"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2630 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2631 else if (!strcmp (XSTRING (lower)->data, "off")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2632 || !strcmp (XSTRING (lower)->data, "false"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2633 return Qnil;
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 Fintern (tem, 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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2638 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2639 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2640 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2641 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2642 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2643 return Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2644 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2645 return Fcdr (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2646 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2647
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2648 /* Record in frame F the specified or default value according to ALIST
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2649 of the parameter named PARAM (a Lisp symbol).
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2650 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
2651 on the frame named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2652 If that is not found either, use the value DEFLT. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2653
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2654 static Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2655 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2656 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2657 Lisp_Object alist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2658 Lisp_Object prop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2659 Lisp_Object deflt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2660 char *xprop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2661 char *xclass;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2662 enum resource_types type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2663 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2664 Lisp_Object tem;
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 tem = x_get_arg (alist, prop, xprop, xclass, type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2667 if (EQ (tem, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2668 tem = deflt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2669 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2670 return tem;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2673 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
2674 "Parse an X-style geometry string STRING.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2675 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2676 The properties returned may include `top', `left', `height', and `width'.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2677 The value of `left' or `top' may be an integer,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2678 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
2679 or a list (- N) meaning -N pixels relative to bottom/right corner.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2680 (string)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2681 Lisp_Object string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2682 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2683 int geometry, x, y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2684 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2685 Lisp_Object result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2686
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2687 CHECK_STRING (string, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2688
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2689 geometry = XParseGeometry ((char *) XSTRING (string)->data,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2690 &x, &y, &width, &height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2691
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2692 result = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2693 if (geometry & XValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2694 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2695 Lisp_Object element;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2696
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2697 if (x >= 0 && (geometry & XNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2698 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2699 else if (x < 0 && ! (geometry & XNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2700 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2701 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2702 element = Fcons (Qleft, make_number (x));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2703 result = Fcons (element, 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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2706 if (geometry & YValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2707 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2708 Lisp_Object element;
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 if (y >= 0 && (geometry & YNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2711 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2712 else if (y < 0 && ! (geometry & YNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2713 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2714 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2715 element = Fcons (Qtop, make_number (y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2716 result = Fcons (element, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2717 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2718
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2719 if (geometry & WidthValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2720 result = Fcons (Fcons (Qwidth, make_number (width)), result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2721 if (geometry & HeightValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2722 result = Fcons (Fcons (Qheight, make_number (height)), result);
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 return result;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2727 /* Calculate the desired size and position of this window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2728 and return the flags saying which aspects were specified.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2729
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2730 This function does not make the coordinates positive. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2731
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2732 #define DEFAULT_ROWS 40
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2733 #define DEFAULT_COLS 80
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2734
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2735 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2736 x_figure_window_size (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2737 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2738 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2739 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2740 register Lisp_Object tem0, tem1, tem2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2741 int height, width, left, top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2742 register int geometry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2743 long window_prompting = 0;
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 /* Default values if we fall through.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2746 Actually, if that happens we should get
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2747 window manager prompting. */
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2748 SET_FRAME_WIDTH (f, DEFAULT_COLS);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2749 f->height = DEFAULT_ROWS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2750 /* Window managers expect that if program-specified
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2751 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
2752 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
2753 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2754
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2755 tem0 = x_get_arg (parms, Qheight, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2756 tem1 = x_get_arg (parms, Qwidth, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2757 tem2 = x_get_arg (parms, Quser_size, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2758 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2759 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2760 if (!EQ (tem0, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2761 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2762 CHECK_NUMBER (tem0, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2763 f->height = XINT (tem0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2764 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2765 if (!EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2766 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2767 CHECK_NUMBER (tem1, 0);
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2768 SET_FRAME_WIDTH (f, XINT (tem1));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2769 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2770 if (!NILP (tem2) && !EQ (tem2, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2771 window_prompting |= USSize;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2772 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2773 window_prompting |= PSize;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2774 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2775
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2776 f->output_data.w32->vertical_scroll_bar_extra
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2777 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2778 ? 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2779 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2780 ? 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
2781 : (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
2782 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
2783 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
2784
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2785 tem0 = x_get_arg (parms, Qtop, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2786 tem1 = x_get_arg (parms, Qleft, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2787 tem2 = x_get_arg (parms, Quser_position, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2788 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2789 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2790 if (EQ (tem0, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2791 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2792 f->output_data.w32->top_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2793 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2794 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2795 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2796 && CONSP (XCONS (tem0)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2797 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2798 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2799 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
2800 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2801 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2802 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2803 && CONSP (XCONS (tem0)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2804 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2805 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2806 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
2807 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2808 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
2809 f->output_data.w32->top_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2810 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2811 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2812 CHECK_NUMBER (tem0, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2813 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
2814 if (f->output_data.w32->top_pos < 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2815 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2816 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2817
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2818 if (EQ (tem1, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2819 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2820 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2821 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2822 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2823 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2824 && CONSP (XCONS (tem1)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2825 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2826 {
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->left_pos = - XINT (XCONS (XCONS (tem1)->cdr)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2828 window_prompting |= XNegative;
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 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2831 && CONSP (XCONS (tem1)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2832 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2833 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2834 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
2835 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2836 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
2837 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2838 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2839 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2840 CHECK_NUMBER (tem1, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2841 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
2842 if (f->output_data.w32->left_pos < 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2843 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2844 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2845
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2846 if (!NILP (tem2) && ! EQ (tem2, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2847 window_prompting |= USPosition;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2848 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2849 window_prompting |= PPosition;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2850 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2851
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2852 return window_prompting;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2855
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2856
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2857 extern LRESULT CALLBACK w32_wnd_proc ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2858
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2859 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2860 w32_init_class (hinst)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2861 HINSTANCE hinst;
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 WNDCLASS wc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2864
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2865 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
2866 wc.lpfnWndProc = (WNDPROC) w32_wnd_proc;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2867 wc.cbClsExtra = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2868 wc.cbWndExtra = WND_EXTRA_BYTES;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2869 wc.hInstance = hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2870 wc.hIcon = LoadIcon (hinst, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2871 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2872 wc.hbrBackground = NULL; // GetStockObject (WHITE_BRUSH);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2873 wc.lpszMenuName = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2874 wc.lpszClassName = EMACS_CLASS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2875
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2876 return (RegisterClass (&wc));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2877 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2878
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2879 HWND
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2880 w32_createscrollbar (f, bar)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2881 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2882 struct scroll_bar * bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2883 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2884 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2885 /* Position and size of scroll bar. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2886 XINT(bar->left), XINT(bar->top),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2887 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
2888 FRAME_W32_WINDOW (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2889 NULL,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2890 hinst,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2891 NULL));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2892 }
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 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2895 w32_createwindow (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2896 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2897 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2898 HWND hwnd;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2899 RECT rect;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2900
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2901 rect.left = rect.top = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2902 rect.right = PIXEL_WIDTH (f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2903 rect.bottom = PIXEL_HEIGHT (f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2904
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2905 AdjustWindowRect (&rect, f->output_data.w32->dwStyle,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2906 FRAME_EXTERNAL_MENU_BAR (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2907
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2908 /* Do first time app init */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2909
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2910 if (!hprevinst)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2911 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2912 w32_init_class (hinst);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2913 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2914
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2915 FRAME_W32_WINDOW (f) = hwnd
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2916 = CreateWindow (EMACS_CLASS,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2917 f->namebuf,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2918 f->output_data.w32->dwStyle | WS_CLIPCHILDREN,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2919 f->output_data.w32->left_pos,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2920 f->output_data.w32->top_pos,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2921 rect.right - rect.left,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2922 rect.bottom - rect.top,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2923 NULL,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2924 NULL,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2925 hinst,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2926 NULL);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2927
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2928 if (hwnd)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2929 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2930 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
2931 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
2932 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
2933 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
2934 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
2935
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
2936 /* Enable drag-n-drop. */
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
2937 DragAcceptFiles (hwnd, TRUE);
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
2938
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2939 /* 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
2940 ShowWindow (hwnd, SW_HIDE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2941 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2942 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2943
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2944 /* Convert between the modifier bits W32 uses and the modifier bits
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2945 Emacs uses. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2946 unsigned int
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2947 w32_get_modifiers ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2948 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2949 return (((GetKeyState (VK_SHIFT)&0x8000) ? shift_modifier : 0) |
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2950 ((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
2951 ((GetKeyState (VK_MENU)&0x8000) ?
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2952 ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier) : 0));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2953 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2954
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2955 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2956 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
2957 W32Msg * wmsg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2958 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2959 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2960 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2961 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2962 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2963 wmsg->msg.hwnd = hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2964 wmsg->msg.message = msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2965 wmsg->msg.wParam = wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2966 wmsg->msg.lParam = lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2967 wmsg->msg.time = GetMessageTime ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2968
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2969 post_msg (wmsg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2970 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2971
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
2972 /* 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
2973 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
2974 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
2975 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
2976 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
2977 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
2978 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
2979 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
2980 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
2981 on Swedish keyboards). */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2982
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2983 #define EMACS_LCONTROL 0
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2984 #define EMACS_RCONTROL 1
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2985 #define EMACS_LMENU 2
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2986 #define EMACS_RMENU 3
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2987
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2988 static int modifiers[4];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2989 static int modifiers_recorded;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2990 static int modifier_key_support_tested;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2991
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2992 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2993 test_modifier_support (unsigned int wparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2994 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2995 unsigned int l, r;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2996
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2997 if (wparam != VK_CONTROL && wparam != VK_MENU)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2998 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2999 if (wparam == VK_CONTROL)
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 l = VK_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3002 r = VK_RCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3003 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3004 else
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 l = VK_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3007 r = VK_RMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3008 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3009 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000))
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3010 modifiers_recorded = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3011 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3012 modifiers_recorded = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3013 modifier_key_support_tested = 1;
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
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3016 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3017 record_keydown (unsigned int wparam, unsigned int lparam)
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 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3020
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3021 if (!modifier_key_support_tested)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3022 test_modifier_support (wparam);
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 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
3025 return;
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 (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3028 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
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 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3031
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3032 modifiers[i] = 1;
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
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3035 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3036 record_keyup (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3037 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3038 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3039
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3040 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
3041 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3042
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3043 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3044 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3045 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3046 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3047
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3048 modifiers[i] = 0;
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
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3051 /* 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
3052 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
3053 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
3054 static void
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3055 reset_modifiers ()
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3056 {
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3057 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
3058
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3059 if (!modifiers_recorded)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3060 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
3061
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3062 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
3063 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
3064
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3065 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
3066 /* 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
3067 return;
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3068
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3069 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
3070 /* 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
3071 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
3072
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3073 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
3074 /* 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
3075 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
3076
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3077 /* 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
3078 keyboard focus. */
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3079 }
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3080
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3081 /* 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
3082 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
3083 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
3084 the left or right modifier should be set. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3085 static void
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3086 sync_modifiers ()
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3087 {
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3088 if (!modifiers_recorded)
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3089 return;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3090
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3091 if (!(GetKeyState (VK_CONTROL) & 0x8000))
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3092 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3093
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3094 if (!(GetKeyState (VK_MENU) & 0x8000))
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3095 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3096 }
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3097
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3098 static int
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3099 modifier_set (int vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3100 {
15280
f39684fddaff (modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents: 15232
diff changeset
3101 if (vkey == VK_CAPITAL)
f39684fddaff (modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents: 15232
diff changeset
3102 return (GetKeyState (vkey) & 0x1);
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3103 if (!modifiers_recorded)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3104 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3105
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3106 switch (vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3107 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3108 case VK_LCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3109 return modifiers[EMACS_LCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3110 case VK_RCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3111 return modifiers[EMACS_RCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3112 case VK_LMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3113 return modifiers[EMACS_LMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3114 case VK_RMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3115 return modifiers[EMACS_RMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3116 default:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3117 break;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3118 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3119 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3120 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3121
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3122 /* 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
3123 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
3124 and window input. */
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 static int
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3127 construct_modifiers (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3128 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3129 int mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3130
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3131 if (wparam != VK_CONTROL && wparam != VK_MENU)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3132 mods = GetLastError ();
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3133
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3134 mods = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3135 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3136 mods |= (modifier_set (VK_CAPITAL)) ? CAPSLOCK_ON : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3137 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
3138 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
3139 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
3140 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
3141
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3142 return mods;
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
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3145 static unsigned int
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3146 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
3147 {
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3148 unsigned int extended = (lparam & 0x1000000L);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3149
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3150 if (wparam < VK_CLEAR || wparam > VK_DELETE)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3151 return wparam;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3152
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3153 if (wparam == VK_RETURN)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3154 return (extended ? VK_NUMPAD_ENTER : VK_RETURN);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3155
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3156 if (wparam >= VK_PRIOR && wparam <= VK_DOWN)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3157 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
3158
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3159 if (wparam == VK_INSERT || wparam == VK_DELETE)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3160 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
3161
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3162 if (wparam == VK_CLEAR)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3163 return (!extended ? VK_NUMPAD_CLEAR : wparam);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3164
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3165 return wparam;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3166 }
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3167
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3168 /* Main message dispatch loop. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3169
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3170 static void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3171 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
3172 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3173 MSG msg;
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3174
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3175 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
3176
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3177 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
3178 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3179 if (msg.hwnd == NULL)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3180 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3181 switch (msg.message)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3182 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3183 case WM_EMACS_CREATEWINDOW:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3184 w32_createwindow ((struct frame *) msg.wParam);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3185 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
3186 abort ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3187 break;
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3188 case WM_EMACS_SETLOCALE:
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3189 SetThreadLocale (msg.wParam);
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3190 /* Reply is not expected. */
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3191 break;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3192 default:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3193 /* No need to be so draconian! */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3194 /* abort (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3195 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
3196 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3197 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3198 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3199 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3200 DispatchMessage (&msg);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3201 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3202
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3203 /* 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
3204 if (msg_buf->completed)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3205 break;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3206 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3207 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3208
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3209 deferred_msg * deferred_msg_head;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3210
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3211 static deferred_msg *
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3212 find_deferred_msg (HWND hwnd, UINT msg)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3213 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3214 deferred_msg * item;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3215
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3216 /* 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
3217 modification of single pointer is always atomic. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3218 /* enter_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3219
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3220 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
3221 if (item->w32msg.msg.hwnd == hwnd
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3222 && item->w32msg.msg.message == msg)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3223 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3224
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3225 /* leave_crit (); */
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 return item;
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
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3230 static LRESULT
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3231 send_deferred_msg (deferred_msg * msg_buf,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3232 HWND hwnd,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3233 UINT msg,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3234 WPARAM wParam,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3235 LPARAM lParam)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3236 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3237 /* Only input thread can send deferred messages. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3238 if (GetCurrentThreadId () != dwWindowsThreadId)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3239 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3240
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3241 /* 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
3242 if (find_deferred_msg (hwnd, msg) != NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3243 abort ();
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 /* 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
3246 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
3247 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
3248 input thread can call us). */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3249
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3250 /* enter_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3251
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3252 msg_buf->completed = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3253 msg_buf->next = deferred_msg_head;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3254 deferred_msg_head = msg_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3255 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
3256
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3257 /* leave_crit (); */
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 /* 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
3260 this one is completed. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3261 w32_msg_pump (msg_buf);
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 deferred_msg_head = msg_buf->next;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3264
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3265 return msg_buf->result;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3266 }
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 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3269 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
3270 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3271 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
3272
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3273 if (msg_buf == NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3274 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3275
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3276 msg_buf->result = result;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3277 msg_buf->completed = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3278
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3279 /* 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
3280 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3281 }
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
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3284 DWORD
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3285 w32_msg_worker (dw)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3286 DWORD dw;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3287 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3288 MSG msg;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3289 deferred_msg dummy_buf;
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 /* 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
3292
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3293 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3294
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3295 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
3296 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3297
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3298 memset (&dummy_buf, 0, sizeof (dummy_buf));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3299 dummy_buf.w32msg.msg.hwnd = NULL;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3300 dummy_buf.w32msg.msg.message = WM_NULL;
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 /* 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
3303 application quits. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3304 w32_msg_pump (&dummy_buf);
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 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3307 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3308
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3309 /* Main window procedure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3310
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3311 extern char *lispy_function_keys[];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3312
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3313 LRESULT CALLBACK
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3314 w32_wnd_proc (hwnd, msg, wParam, lParam)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3315 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3316 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3317 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3318 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3319 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3320 struct frame *f;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3321 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
3322 W32Msg wmsg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3323 int windows_translate;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3324
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3325 /* 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
3326 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
3327 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
3328 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
3329 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
3330
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3331 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
3332 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
3333 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
3334 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
3335 delete-frame has synchronized with this thread.
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3336
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3337 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
3338 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
3339 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
3340
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3341 switch (msg)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3342 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3343 case WM_ERASEBKGND:
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3344 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3345 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3346 {
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3347 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
3348 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
3349 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3350 return 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3351 case WM_PALETTECHANGED:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3352 /* ignore our own changes */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3353 if ((HWND)wParam != hwnd)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3354 {
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3355 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3356 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3357 /* 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
3358 frames to be redrawn if needed. */
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3359 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
3360 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3361 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3362 case WM_PAINT:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3363 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3364 PAINTSTRUCT paintStruct;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3365
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3366 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3367 BeginPaint (hwnd, &paintStruct);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3368 wmsg.rect = paintStruct.rcPaint;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3369 EndPaint (hwnd, &paintStruct);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3370 leave_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3371
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3372 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3373
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3374 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3375 }
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3376
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3377 case WM_KEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3378 case WM_SYSKEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3379 record_keyup (wParam, lParam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3380 goto dflt;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3381
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3382 case WM_KEYDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3383 case WM_SYSKEYDOWN:
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3384 /* Synchronize modifiers with current keystroke. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3385 sync_modifiers ();
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3386
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3387 record_keydown (wParam, lParam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3388
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3389 wParam = map_keypad_keys (wParam, lParam);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3390
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3391 windows_translate = 0;
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3392 switch (wParam) {
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3393 case VK_LWIN:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3394 case VK_RWIN:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3395 case VK_APPS:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3396 /* 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
3397 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
3398 windows_translate = 1;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3399 break;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3400 case VK_MENU:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3401 if (NILP (Vw32_pass_alt_to_system))
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3402 return 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3403 windows_translate = 1;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3404 break;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3405 case VK_CONTROL:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3406 case VK_CAPITAL:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3407 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
3408 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
3409 case VK_SCROLL:
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3410 windows_translate = 1;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3411 break;
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3412 default:
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3413 /* 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
3414 if (lispy_function_keys[wParam] == 0)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3415 msg = WM_CHAR;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3416 break;
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3417 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3418
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3419 if (windows_translate)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3420 {
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3421 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
3422
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3423 windows_msg.time = GetMessageTime ();
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3424 TranslateMessage (&windows_msg);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3425 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3426 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3427
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3428 /* Fall through */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3429
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3430 case WM_SYSCHAR:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3431 case WM_CHAR:
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3432 wmsg.dwModifiers = construct_modifiers (wParam, lParam);
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3433
15232
4c4924843e34 (win32_wnd_proc): Reenable quit_char detection.
Richard M. Stallman <rms@gnu.org>
parents: 15206
diff changeset
3434 #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
3435 /* 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
3436 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
3437 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
3438 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
3439 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
3440 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
3441 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3442 int c = wParam;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3443 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
3444 || wmsg.dwModifiers == RIGHT_CTRL_PRESSED))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3445 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
3446 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
3447 {
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3448 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
3449
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3450 /* 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
3451 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
3452 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
3453
f4099a0f3575 (w32_wnd_proc): Call signal_quit when C-g is received.
Richard M. Stallman <rms@gnu.org>
parents: 21896
diff changeset
3454 /* 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
3455 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
3456 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3457 }
15206
16d0e8c36378 (win32_wnd_proc): Disable setting of Vquit_flag
Geoff Voelker <voelker@cs.washington.edu>
parents: 15205
diff changeset
3458 #endif
16d0e8c36378 (win32_wnd_proc): Disable setting of Vquit_flag
Geoff Voelker <voelker@cs.washington.edu>
parents: 15205
diff changeset
3459
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
3460 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
3461
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3462 break;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3463
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3464 /* 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
3465 are used together, but only if user has two button mouse. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3466 case WM_LBUTTONDOWN:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3467 case WM_RBUTTONDOWN:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3468 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
3469 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3470
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3471 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3472 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
3473 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
3474
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3475 if (button_state & this)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3476 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3477
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3478 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3479 SetCapture (hwnd);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3480
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3481 button_state |= this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3482
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3483 if (button_state & other)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3484 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3485 if (mouse_button_timer)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3486 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3487 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3488 mouse_button_timer = 0;
15147
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 /* Generate middle mouse event instead. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3491 msg = WM_MBUTTONDOWN;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3492 button_state |= MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3493 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3494 else if (button_state & MMOUSE)
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 /* 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
3497 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
3498 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
3499 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
3500 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3501 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3502 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3503 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3504 /* Flush out saved message. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3505 post_msg (&saved_mouse_button_msg);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3506 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3507 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
3508 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
3509
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3510 /* Clear message buffer. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3511 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
3512 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3513 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3514 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3515 /* Hold onto message for now. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3516 mouse_button_timer =
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3517 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
3518 saved_mouse_button_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3519 saved_mouse_button_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3520 saved_mouse_button_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3521 saved_mouse_button_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3522 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
3523 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
3524 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3525 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3526 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3527
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3528 case WM_LBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3529 case WM_RBUTTONUP:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3530 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
3531 goto handle_plain_button;
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 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3534 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
3535 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
3536
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3537 if ((button_state & this) == 0)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3538 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3539
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3540 button_state &= ~this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3541
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3542 if (button_state & MMOUSE)
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 /* 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
3545 if ((button_state & other) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3546 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3547 msg = WM_MBUTTONUP;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3548 button_state &= ~MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3549
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3550 if (button_state) abort ();
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 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3553 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3554 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3555 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3556 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3557 /* Flush out saved message if necessary. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3558 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
3559 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3560 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
3561 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3562 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3563 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
3564 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
3565
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3566 /* 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
3567 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3568 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3569 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3570
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3571 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3572 ReleaseCapture ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3573 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3574 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3575
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3576 case WM_MBUTTONDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3577 case WM_MBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3578 handle_plain_button:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3579 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3580 BOOL up;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3581 int button;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3582
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3583 if (parse_button (msg, &button, &up))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3584 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3585 if (up) ReleaseCapture ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3586 else SetCapture (hwnd);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3587 button = (button == 0) ? LMOUSE :
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3588 ((button == 1) ? MMOUSE : RMOUSE);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3589 if (up)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3590 button_state &= ~button;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3591 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3592 button_state |= button;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3593 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3594 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3595
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3596 wmsg.dwModifiers = w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3597 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
3598 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3599
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3600 case WM_VSCROLL:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3601 case WM_MOUSEMOVE:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3602 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
3603 || (msg == WM_MOUSEMOVE && button_state == 0))
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3604 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3605 wmsg.dwModifiers = w32_get_modifiers ();
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3606 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
3607 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3608 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3609
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3610 /* 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
3611 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
3612 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
3613 expires, we just replace the first message. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3614
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3615 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
3616 mouse_move_timer =
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3617 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
3618
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3619 /* Hold onto message for now. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3620 saved_mouse_move_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3621 saved_mouse_move_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3622 saved_mouse_move_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3623 saved_mouse_move_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3624 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
3625 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
3626
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3627 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3628
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3629 case WM_MOUSEWHEEL:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3630 wmsg.dwModifiers = w32_get_modifiers ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3631 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
3632 return 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3633
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3634 case WM_DROPFILES:
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3635 wmsg.dwModifiers = w32_get_modifiers ();
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3636 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3637 return 0;
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3638
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3639 case WM_TIMER:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3640 /* Flush out saved messages if necessary. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3641 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
3642 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3643 if (saved_mouse_button_msg.msg.hwnd)
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 post_msg (&saved_mouse_button_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3646 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3647 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3648 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3649 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3650 }
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3651 else if (wParam == mouse_move_timer)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3652 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3653 if (saved_mouse_move_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3654 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3655 post_msg (&saved_mouse_move_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3656 saved_mouse_move_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3657 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3658 KillTimer (hwnd, mouse_move_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3659 mouse_move_timer = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3660 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3661 return 0;
15290
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 case WM_NCACTIVATE:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3664 /* 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
3665 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
3666 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
3667 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
3668 keyboard modifiers' state. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3669 reset_modifiers ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3670 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3671
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3672 case WM_INITMENU:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3673 /* 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
3674 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
3675 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
3676 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
3677 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
3678
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3679 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
3680 loop that can process all other messages.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3681
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3682 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
3683 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
3684 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
3685 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
3686 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
3687 being active). */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3688
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3689 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3690 if (f
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3691 && (f->output_data.w32->menubar_active
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3692 /* 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
3693 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
3694 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
3695 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
3696 had requested it to be turned off! */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3697 || f->output_data.w32->menubar_widget == NULL))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3698 return 0;
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 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3701 deferred_msg msg_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3702
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3703 /* 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
3704 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
3705 if (find_deferred_msg (hwnd, msg) != NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3706 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3708 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
3709 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3710
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3711 case WM_EXITMENULOOP:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3712 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3713
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3714 /* Indicate that menubar can be modified again. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3715 if (f)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3716 f->output_data.w32->menubar_active = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3717 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3718
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3719 case WM_MEASUREITEM:
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3720 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
3721 if (f)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3722 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3723 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
3724
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3725 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
3726 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3727 /* 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
3728 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
3729 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
3730 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
3731 LOGFONT menu_logfont;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3732 HFONT old_font;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3733 SIZE size;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3734
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3735 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
3736 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
3737 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
3738 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
3739
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3740 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
3741 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
3742 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
3743 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
3744 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
3745
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3746 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
3747 DeleteObject (menu_font);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3748 ReleaseDC (hwnd, hdc);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3749 return TRUE;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3750 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3751 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3752 return 0;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3753
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3754 case WM_DRAWITEM:
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3755 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
3756 if (f)
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 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
3759
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3760 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
3761 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3762 /* 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
3763 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
3764 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
3765 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
3766 LOGFONT menu_logfont;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3767 HFONT old_font;
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 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
3770 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
3771 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
3772 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
3773
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3774 /* 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
3775 ExtTextOut (hdc,
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3776 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
3777 pDis->rcItem.top,
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3778 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
3779 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
3780
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3781 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
3782 DeleteObject (menu_font);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3783 return TRUE;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3784 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3785 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3786 return 0;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3787
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3788 #if 0
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3789 /* 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
3790 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
3791 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
3792 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
3793 case WM_MOUSEACTIVATE:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3794 /* 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
3795 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
3796 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
3797 if (LOWORD (lParam) == HTCLIENT )
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3798 return MA_ACTIVATEANDEAT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3799 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3800 #endif
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3801
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3802 case WM_ACTIVATE:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3803 case WM_ACTIVATEAPP:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3804 case WM_WINDOWPOSCHANGED:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3805 case WM_SHOWWINDOW:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3806 /* 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
3807 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
3808 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
3809 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3810
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3811 case WM_SETFOCUS:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3812 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
3813 case WM_KILLFOCUS:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3814 case WM_MOVE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3815 case WM_SIZE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3816 case WM_COMMAND:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3817 wmsg.dwModifiers = w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3818 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3819 goto dflt;
15034
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3820
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3821 case WM_CLOSE:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3822 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
3823 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
3824 return 0;
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3825
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3826 case WM_WINDOWPOSCHANGING:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3827 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3828 WINDOWPLACEMENT wp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3829 LPWINDOWPOS lppos = (WINDOWPOS *) lParam;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3830
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3831 wp.length = sizeof (WINDOWPLACEMENT);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3832 GetWindowPlacement (hwnd, &wp);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3833
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3834 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3835 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3836 RECT rect;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3837 int wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3838 int hdiff;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3839 DWORD font_width;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3840 DWORD line_height;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3841 DWORD internal_border;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3842 DWORD scrollbar_extra;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3843 RECT wr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3844
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3845 wp.length = sizeof(wp);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3846 GetWindowRect (hwnd, &wr);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3847
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3848 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3849
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3850 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3851 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3852 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3853 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3854
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3855 leave_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3856
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3857 memset (&rect, 0, sizeof (rect));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3858 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3859 GetMenu (hwnd) != NULL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3860
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3861 /* 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
3862 multiples of the character cell dimensions. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3863 wdiff = (lppos->cx - (rect.right - rect.left)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3864 - 2 * internal_border - scrollbar_extra)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3865 % font_width;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3866 hdiff = (lppos->cy - (rect.bottom - rect.top)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3867 - 2 * internal_border)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3868 % line_height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3869
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3870 if (wdiff || hdiff)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3871 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3872 /* For right/bottom sizing we can just fix the sizes.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3873 However for top/left sizing we will need to fix the X
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3874 and Y positions as well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3875
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3876 lppos->cx -= wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3877 lppos->cy -= hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3878
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3879 if (wp.showCmd != SW_SHOWMAXIMIZED
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3880 && (lppos->flags & SWP_NOMOVE) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3881 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3882 if (lppos->x != wr.left || lppos->y != wr.top)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3883 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3884 lppos->x += wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3885 lppos->y += hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3886 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3887 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3888 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3889 lppos->flags |= SWP_NOMOVE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3890 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3891 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3892
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3893 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3894 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3895 }
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3898 goto dflt;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3899
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3900 case WM_EMACS_CREATESCROLLBAR:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3901 return (LRESULT) w32_createscrollbar ((struct frame *) wParam,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3902 (struct scroll_bar *) lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3903
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3904 case WM_EMACS_SHOWWINDOW:
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3905 return ShowWindow ((HWND) wParam, (WPARAM) lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3906
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3907 case WM_EMACS_SETFOREGROUND:
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3908 return SetForegroundWindow ((HWND) wParam);
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3909
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3910 case WM_EMACS_SETWINDOWPOS:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3911 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3912 WINDOWPOS * pos = (WINDOWPOS *) wParam;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3913 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
3914 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
3915 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3916
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3917 case WM_EMACS_DESTROYWINDOW:
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3918 DragAcceptFiles ((HWND) wParam, FALSE);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3919 return DestroyWindow ((HWND) wParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3920
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3921 case WM_EMACS_TRACKPOPUPMENU:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3922 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3923 UINT flags;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3924 POINT *pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3925 int retval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3926 pos = (POINT *)lParam;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3927 flags = TPM_CENTERALIGN;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3928 if (button_state & LMOUSE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3929 flags |= TPM_LEFTBUTTON;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3930 else if (button_state & RMOUSE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3931 flags |= TPM_RIGHTBUTTON;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3932
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3933 /* 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
3934 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
3935 ReleaseCapture ();
23160
95a213639589 (w32_wnd_proc): Always zero button_state when releasing
Geoff Voelker <voelker@cs.washington.edu>
parents: 22625
diff changeset
3936 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
3937
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3938 /* 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
3939 TrackPopupMenu below, and should be ignored. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3940 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3941 if (f)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3942 f->output_data.w32->menubar_active = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3943
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3944 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
3945 0, hwnd, NULL))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3946 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3947 MSG amsg;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3948 /* Eat any mouse messages during popupmenu */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3949 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
3950 PM_REMOVE));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3951 /* Get the menu selection, if any */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3952 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
3953 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3954 retval = LOWORD (amsg.wParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3955 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3956 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3957 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3958 retval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3959 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3960 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3961 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3962 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3963 retval = -1;
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
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3966 return retval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3967 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3968
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3969 default:
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3970 /* Check for messages registered at runtime. */
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3971 if (msg == msh_mousewheel)
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3972 {
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3973 wmsg.dwModifiers = w32_get_modifiers ();
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3974 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3975 return 0;
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3976 }
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3977
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3978 dflt:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3979 return DefWindowProc (hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3980 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3981
19707
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 /* 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
3984 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3985 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3986
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3987 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3988 my_create_window (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3989 struct frame * f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3990 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3991 MSG msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3992
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3993 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
3994 abort ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3995 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3996 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3997
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3998 /* Create and set up the w32 window for frame F. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3999
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4000 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4001 w32_window (f, window_prompting, minibuffer_only)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4002 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4003 long window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4004 int minibuffer_only;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4005 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4006 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4007
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4008 /* Use the resource name as the top-level window name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4009 for looking up resources. Make a non-Lisp copy
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4010 for the window manager, so GC relocation won't bother it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4011
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4012 Elsewhere we specify the window name for the window manager. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4013
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 char *str = (char *) XSTRING (Vx_resource_name)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4016 f->namebuf = (char *) xmalloc (strlen (str) + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4017 strcpy (f->namebuf, str);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4018 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4019
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4020 my_create_window (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4021
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4022 validate_x_resource_name ();
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 /* x_set_name normally ignores requests to set the name if the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4025 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
4026 place where that assumption isn't correct; f->name is set, but
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4027 the server hasn't been told. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4028 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4029 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4030 int explicit = f->explicit_name;
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 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4033 name = f->name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4034 f->name = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4035 x_set_name (f, name, explicit);
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 UNBLOCK_INPUT;
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 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4041 initialize_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4042
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4043 if (FRAME_W32_WINDOW (f) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4044 error ("Unable to create window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4045 }
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 /* Handle the icon stuff for this window. Perhaps later we might
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4048 want an x_set_icon_position which can be called interactively as
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4049 well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4050
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4051 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4052 x_icon (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4053 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4054 Lisp_Object parms;
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 Lisp_Object icon_x, icon_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4057
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
4058 /* 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
4059 icons in the tray. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4060 icon_x = x_get_arg (parms, Qicon_left, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4061 icon_y = x_get_arg (parms, Qicon_top, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4062 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
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 CHECK_NUMBER (icon_x, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4065 CHECK_NUMBER (icon_y, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4066 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4067 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4068 error ("Both left and top icon corners of icon must be specified");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4069
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4070 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4071
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4072 if (! EQ (icon_x, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4073 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4074
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4075 #if 0 /* TODO */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4076 /* Start up iconic or window? */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4077 x_wm_set_window_state
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4078 (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
4079 ? IconicState
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4080 : NormalState));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4081
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4082 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
4083 ? f->icon_name
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4084 : f->name))->data);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4085 #endif
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4086
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4087 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4088 }
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 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4091 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4092 "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
4093 Returns an Emacs frame object.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4094 ALIST is an alist of frame parameters.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4095 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
4096 and do not specify a specific minibuffer window to use,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4097 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4098 be shared by the new frame.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4099 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4100 This function is an internal primitive--use `make-frame' instead.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4101 (parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4102 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4103 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4104 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4105 Lisp_Object frame, tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4106 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4107 int minibuffer_only = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4108 long window_prompting = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4109 int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4110 int count = specpdl_ptr - specpdl;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4111 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4112 Lisp_Object display;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4113 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4114 Lisp_Object parent;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4115 struct kboard *kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4116
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4117 /* Use this general default value to start with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4118 until we know if this frame has a specified name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4119 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4120
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4121 display = x_get_arg (parms, Qdisplay, 0, 0, string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4122 if (EQ (display, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4123 display = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4124 dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4125 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4126 kb = dpyinfo->kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4127 #else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4128 kb = &the_only_kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4129 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4130
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4131 name = x_get_arg (parms, Qname, "name", "Name", string);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4132 if (!STRINGP (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4133 && ! EQ (name, Qunbound)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4134 && ! NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4135 error ("Invalid frame name--not a string or nil");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4136
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4137 if (STRINGP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4138 Vx_resource_name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4139
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4140 /* See if parent window is specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4141 parent = x_get_arg (parms, Qparent_id, NULL, NULL, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4142 if (EQ (parent, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4143 parent = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4144 if (! NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4145 CHECK_NUMBER (parent, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4146
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4147 /* 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
4148 /* 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
4149 it to make_frame_without_minibuffer. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4150 frame = Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4151 GCPRO4 (parms, parent, name, frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4152 tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4153 if (EQ (tem, Qnone) || NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4154 f = make_frame_without_minibuffer (Qnil, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4155 else if (EQ (tem, Qonly))
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 f = make_minibuffer_frame ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4158 minibuffer_only = 1;
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 else if (WINDOWP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4161 f = make_frame_without_minibuffer (tem, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4162 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4163 f = make_frame (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4164
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4165 XSETFRAME (frame, f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4166
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4167 /* Note that Windows does support scroll bars. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4168 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
4169 /* 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
4170 f->scroll_bar_pixel_width = GetSystemMetrics (SM_CXVSCROLL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4171
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4172 f->output_method = output_w32;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4173 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
4174 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
4175
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4176 f->icon_name
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4177 = 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
4178 if (! STRINGP (f->icon_name))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4179 f->icon_name = Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4180
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4181 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4182 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4183 FRAME_KBOARD (f) = kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4184 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4185
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4186 /* Specify the parent under which to make this window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4187
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4188 if (!NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4189 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4190 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
4191 f->output_data.w32->explicit_parent = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4192 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4193 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4194 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4195 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
4196 f->output_data.w32->explicit_parent = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4197 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4198
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4199 /* Note that the frame has no physical cursor right now. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4200 f->phys_cursor_x = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4201
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4202 /* 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
4203 be set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4204 if (EQ (name, Qunbound) || NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4205 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4206 f->name = build_string (dpyinfo->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4207 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4208 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4209 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4210 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4211 f->name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4212 f->explicit_name = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4213 /* use the frame's title when getting resources for this frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4214 specbind (Qx_resource_name, name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4215 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4216
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4217 /* Extract the window parameters from the supplied values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4218 that are needed to determine window geometry. */
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 Lisp_Object font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4221
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4222 font = x_get_arg (parms, Qfont, "font", "Font", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4223 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4224 /* First, try whatever font the caller has specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4225 if (STRINGP (font))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4226 font = x_new_font (f, XSTRING (font)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4227 /* Try out a font which we hope has bold and italic variations. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4228 if (!STRINGP (font))
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4229 font = x_new_font (f, "-*-Courier New-normal-r-*-*-13-97-*-*-c-*-*-ansi-");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4230 if (! STRINGP (font))
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4231 font = x_new_font (f, "-*-Courier-normal-r-*-*-13-97-*-*-c-*-*-ansi-");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4232 /* 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
4233 if (! STRINGP (font))
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4234 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-13-97-*-*-c-*-*-ansi-");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4235 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4236 if (! STRINGP (font))
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4237 font = build_string ("Fixedsys");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4238
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4239 x_default_parameter (f, parms, Qfont, font,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4240 "font", "Font", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4241 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4242
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4243 x_default_parameter (f, parms, Qborder_width, make_number (2),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4244 "borderwidth", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4245 /* This defaults to 2 in order to match xterm. We recognize either
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4246 internalBorderWidth or internalBorder (which is what xterm calls
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4247 it). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4248 if (NILP (Fassq (Qinternal_border_width, parms)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4249 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4250 Lisp_Object value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4251
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4252 value = x_get_arg (parms, Qinternal_border_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4253 "internalBorder", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4254 if (! EQ (value, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4255 parms = Fcons (Fcons (Qinternal_border_width, value),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4256 parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4257 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4258 /* Default internalBorderWidth to 0 on Windows to match other programs. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4259 x_default_parameter (f, parms, Qinternal_border_width, make_number (0),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4260 "internalBorderWidth", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4261 x_default_parameter (f, parms, Qvertical_scroll_bars, Qt,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4262 "verticalScrollBars", "ScrollBars", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4263
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4264 /* Also do the stuff which must be set before the window exists. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4265 x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4266 "foreground", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4267 x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4268 "background", "Background", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4269 x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4270 "pointerColor", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4271 x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4272 "cursorColor", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4273 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4274 "borderColor", "BorderColor", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4275
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4276 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4277 "menuBar", "MenuBar", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4278 x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4279 "scrollBarWidth", "ScrollBarWidth", number);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4280 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
4281 "bufferPredicate", "BufferPredicate", symbol);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4282 x_default_parameter (f, parms, Qtitle, Qnil,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4283 "title", "Title", string);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4284
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4285 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
4286 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
4287 window_prompting = x_figure_window_size (f, parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4288
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4289 if (window_prompting & XNegative)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4290 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4291 if (window_prompting & YNegative)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4292 f->output_data.w32->win_gravity = SouthEastGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4293 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4294 f->output_data.w32->win_gravity = NorthEastGravity;
13434
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 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4297 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4298 if (window_prompting & YNegative)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4299 f->output_data.w32->win_gravity = SouthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4300 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4301 f->output_data.w32->win_gravity = NorthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4302 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4303
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4304 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
4305
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4306 w32_window (f, window_prompting, minibuffer_only);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4307 x_icon (f, parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4308 init_frame_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4309
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4310 /* We need to do this after creating the window, so that the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4311 icon-creation functions can say whose icon they're describing. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4312 x_default_parameter (f, parms, Qicon_type, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4313 "bitmapIcon", "BitmapIcon", symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4314
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4315 x_default_parameter (f, parms, Qauto_raise, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4316 "autoRaise", "AutoRaiseLower", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4317 x_default_parameter (f, parms, Qauto_lower, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4318 "autoLower", "AutoRaiseLower", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4319 x_default_parameter (f, parms, Qcursor_type, Qbox,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4320 "cursorType", "CursorType", symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4321
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4322 /* Dimensions, especially f->height, must be done via change_frame_size.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4323 Change will not be effected unless different from the current
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4324 f->height. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4325 width = f->width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4326 height = f->height;
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
4327 f->height = 0;
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
4328 SET_FRAME_WIDTH (f, 0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4329 change_frame_size (f, height, width, 1, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4330
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4331 /* Tell the server what size and position, etc, we want,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4332 and how badly we want them. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4333 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4334 x_wm_set_size_hint (f, window_prompting, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4335 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4336
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4337 tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4338 f->no_split = minibuffer_only || EQ (tem, Qt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4339
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4340 UNGCPRO;
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 /* It is now ok to make the frame official
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4343 even if we get an error below.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4344 And the frame needs to be on Vframe_list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4345 or making it visible won't work. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4346 Vframe_list = Fcons (frame, Vframe_list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4347
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4348 /* Now that the frame is official, it counts as a reference to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4349 its display. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4350 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4351
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4352 /* Make the window appear on the frame and enable display,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4353 unless the caller says not to. However, with explicit parent,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4354 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
4355 if (! f->output_data.w32->explicit_parent)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4356 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4357 Lisp_Object visibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4358
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4359 visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4360 if (EQ (visibility, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4361 visibility = Qt;
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 if (EQ (visibility, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4364 x_iconify_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4365 else if (! NILP (visibility))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4366 x_make_frame_visible (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4367 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4368 /* Must have been Qnil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4369 ;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4370 }
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 return unbind_to (count, frame);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4375 /* 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
4376 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
4377 know about that structure. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4378 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4379 x_get_focus_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4380 struct frame *frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4381 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4382 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4383 Lisp_Object xfocus;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4384 if (! dpyinfo->w32_focus_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4385 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4386
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4387 XSETFRAME (xfocus, dpyinfo->w32_focus_frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4388 return xfocus;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4389 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4390
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4391 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
4392 "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
4393 (frame)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4394 Lisp_Object frame;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4395 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4396 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
4397 return Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4398 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4399
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4400
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4401 XFontStruct *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4402 w32_load_font (dpyinfo,name)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4403 struct w32_display_info *dpyinfo;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4404 char * name;
13434
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 XFontStruct * font = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4407 BOOL ok;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4408
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4409 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4410 LOGFONT lf;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4411
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4412 if (!name || !x_to_w32_font (name, &lf))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4413 return (NULL);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4414
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4415 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
4416
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4417 if (!font) return (NULL);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4418
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4419 BLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4420
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4421 font->hfont = CreateFontIndirect (&lf);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4422 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4423
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4424 if (font->hfont == NULL)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4425 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4426 ok = FALSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4427 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4428 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4429 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4430 HDC hdc;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4431 HANDLE oldobj;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4432
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4433 hdc = GetDC (dpyinfo->root_window);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4434 oldobj = SelectObject (hdc, font->hfont);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4435 ok = GetTextMetrics (hdc, &font->tm);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4436 SelectObject (hdc, oldobj);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4437 ReleaseDC (dpyinfo->root_window, hdc);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4438 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4439
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4440 UNBLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4441
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4442 if (ok) return (font);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4443
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4444 w32_unload_font (dpyinfo, font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4445 return (NULL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4446 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4447
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4448 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4449 w32_unload_font (dpyinfo, font)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4450 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4451 XFontStruct * font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4452 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4453 if (font)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4454 {
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4455 if (font->hfont) DeleteObject(font->hfont);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4456 xfree (font);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4457 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4458 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4459
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4460 /* The font conversion stuff between x and w32 */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4461
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4462 /* X font string is as follows (from faces.el)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4463 * (let ((- "[-?]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4464 * (foundry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4465 * (family "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4466 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4467 * (weight\? "\\([^-]*\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4468 * (slant "\\([ior]\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4469 * (slant\? "\\([^-]?\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4470 * (swidth "\\([^-]*\\)") ; 3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4471 * (adstyle "[^-]*") ; 4
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4472 * (pixelsize "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4473 * (pointsize "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4474 * (resx "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4475 * (resy "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4476 * (spacing "[cmp?*]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4477 * (avgwidth "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4478 * (registry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4479 * (encoding "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4480 * )
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4481 * (setq x-font-regexp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4482 * (concat "\\`\\*?[-?*]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4483 * foundry - family - weight\? - slant\? - swidth - adstyle -
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4484 * pixelsize - pointsize - resx - resy - spacing - registry -
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4485 * encoding "[-?*]\\*?\\'"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4486 * ))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4487 * (setq x-font-regexp-head
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4488 * (concat "\\`[-?*]" foundry - family - weight\? - slant\?
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4489 * "\\([-*?]\\|\\'\\)"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4490 * (setq x-font-regexp-slant (concat - slant -))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4491 * (setq x-font-regexp-weight (concat - weight -))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4492 * nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4493 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4494
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4495 #define FONT_START "[-?]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4496 #define FONT_FOUNDRY "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4497 #define FONT_FAMILY "\\([^-]+\\)" /* 1 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4498 #define FONT_WEIGHT "\\(bold\\|demibold\\|medium\\)" /* 2 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4499 #define FONT_WEIGHT_Q "\\([^-]*\\)" /* 2 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4500 #define FONT_SLANT "\\([ior]\\)" /* 3 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4501 #define FONT_SLANT_Q "\\([^-]?\\)" /* 3 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4502 #define FONT_SWIDTH "\\([^-]*\\)" /* 4 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4503 #define FONT_ADSTYLE "[^-]*"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4504 #define FONT_PIXELSIZE "[^-]*"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4505 #define FONT_POINTSIZE "\\([0-9][0-9]+\\|\\*\\)" /* 5 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4506 #define FONT_RESX "[0-9][0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4507 #define FONT_RESY "[0-9][0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4508 #define FONT_SPACING "[cmp?*]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4509 #define FONT_AVGWIDTH "[0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4510 #define FONT_REGISTRY "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4511 #define FONT_ENCODING "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4512
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4513 #define FONT_REGEXP ("\\`\\*?[-?*]" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4514 FONT_FOUNDRY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4515 FONT_FAMILY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4516 FONT_WEIGHT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4517 FONT_SLANT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4518 FONT_SWIDTH "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4519 FONT_ADSTYLE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4520 FONT_PIXELSIZE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4521 FONT_POINTSIZE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4522 "[-?*]\\|\\'")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4523
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4524 #define FONT_REGEXP_HEAD ("\\`[-?*]" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4525 FONT_FOUNDRY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4526 FONT_FAMILY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4527 FONT_WEIGHT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4528 FONT_SLANT_Q \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4529 "\\([-*?]\\|\\'\\)")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4530
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4531 #define FONT_REGEXP_SLANT "-" FONT_SLANT "-"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4532 #define FONT_REGEXP_WEIGHT "-" FONT_WEIGHT "-"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4533
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4534 LONG
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4535 x_to_w32_weight (lpw)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4536 char * lpw;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4537 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4538 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
4539
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4540 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
4541 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
4542 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
4543 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
4544 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
4545 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
4546 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
4547 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
4548 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
4549 else if (stricmp (lpw,"thin") == 0) return FW_THIN;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4550 else
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4551 return FW_DONTCARE;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4552 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4553
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4554
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4555 char *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4556 w32_to_x_weight (fnweight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4557 int fnweight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4558 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4559 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
4560 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
4561 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
4562 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
4563 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
4564 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
4565 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
4566 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
4567 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
4568 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4569 return "*";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4570 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4571
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4572 LONG
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4573 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
4574 char * lpcs;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4575 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4576 if (!lpcs) return (0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4577
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4578 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4579 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4580 else if (stricmp (lpcs,"iso8859") == 0) return ANSI_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4581 else if (stricmp (lpcs,"oem") == 0) return OEM_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4582 #ifdef UNICODE_CHARSET
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4583 else if (stricmp (lpcs,"unicode") == 0) return UNICODE_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4584 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4585 #endif
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4586 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
4587 else
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4588 return DEFAULT_CHARSET;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4589 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4590
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4591 char *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4592 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
4593 int fncharset;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4594 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4595 static char buf[16];
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4596
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4597 switch (fncharset)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4598 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4599 case ANSI_CHARSET: return "ansi";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4600 case OEM_CHARSET: return "oem";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4601 case SYMBOL_CHARSET: return "symbol";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4602 #ifdef UNICODE_CHARSET
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4603 case UNICODE_CHARSET: return "unicode";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4604 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4605 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4606 /* Encode numerical value of unknown charset. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4607 sprintf (buf, "#%u", fncharset);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4608 return buf;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4609 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4610
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4611 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4612 w32_to_x_font (lplogfont, lpxstr, len)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4613 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4614 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4615 int len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4616 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4617 char height_pixels[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4618 char height_dpi[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4619 char width_pixels[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4620
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4621 if (!lpxstr) abort ();
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4622
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4623 if (!lplogfont)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4624 return FALSE;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4625
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4626 if (lplogfont->lfHeight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4627 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4628 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight));
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4629 sprintf (height_dpi, "%u",
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4630 (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
4631 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4632 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4633 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4634 strcpy (height_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4635 strcpy (height_dpi, "*");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4636 }
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4637 if (lplogfont->lfWidth)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4638 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10);
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4639 else
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4640 strcpy (width_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4641
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4642 _snprintf (lpxstr, len - 1,
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4643 "-*-%s-%s-%c-*-*-%s-%s-*-*-%c-%s-*-%s-",
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4644 lplogfont->lfFaceName,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4645 w32_to_x_weight (lplogfont->lfWeight),
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4646 lplogfont->lfItalic?'i':'r',
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4647 height_pixels,
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4648 height_dpi,
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4649 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) ? 'p' : 'c',
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4650 width_pixels,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4651 w32_to_x_charset (lplogfont->lfCharSet)
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4652 );
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4653
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4654 lpxstr[len - 1] = 0; /* just to be sure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4655 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4656 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4657
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4658 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4659 x_to_w32_font (lpxstr, lplogfont)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4660 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4661 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4662 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4663 if (!lplogfont) return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4664
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4665 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
4666
15380
8b01836a6b06 (x_to_win32_font): Allow any quality fonts.
Richard M. Stallman <rms@gnu.org>
parents: 15377
diff changeset
4667 #if 1
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4668 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4669 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4670 lplogfont->lfQuality = DEFAULT_QUALITY;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4671 #else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4672 /* go for maximum quality */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4673 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4674 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4675 lplogfont->lfQuality = PROOF_QUALITY;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4676 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4677
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4678 if (!lpxstr)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4679 return FALSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4680
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4681 /* 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
4682 * 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
4683 * format:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4684 * "<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
4685 */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4686
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4687 if (*lpxstr == '-')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4688 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4689 int fields;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4690 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
4691 char * encoding;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4692
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4693 fields = sscanf (lpxstr,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4694 "-%*[^-]-%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
4695 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
4696
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4697 if (fields == EOF) return (FALSE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4698
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4699 if (fields > 0 && name[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4700 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4701 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
4702 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
4703 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4704 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4705 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4706 lplogfont->lfFaceName[0] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4707 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4708
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4709 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4710
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4711 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
4712
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4713 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4714
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4715 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
4716 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
4717
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4718 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4719
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4720 if (fields > 0 && pixels[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4721 lplogfont->lfHeight = atoi (pixels);
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 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4724
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4725 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
4726 lplogfont->lfHeight = (atoi (height)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4727 * 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
4728
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4729 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4730
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4731 lplogfont->lfPitchAndFamily =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4732 (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
4733
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4734 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4735
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4736 if (fields > 0 && width[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4737 lplogfont->lfWidth = atoi (width) / 10;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4738
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4739 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4740
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4741 /* Not all font specs include the registry field, so we allow for an
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4742 optional registry field before the encoding when parsing
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4743 remainder. Also we strip the trailing '-' if present. */
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4744 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4745 int len = strlen (remainder);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4746 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
4747 remainder[len-1] = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4748 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4749 encoding = remainder;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4750 if (strncmp (encoding, "*-", 2) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4751 encoding += 2;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4752 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
4753 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4754 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4755 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4756 int fields;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4757 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
4758
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4759 fields = sscanf (lpxstr,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4760 "%99[^:]:%9[^:]:%9[^:]:%19s",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4761 name, height, width, weight);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4762
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4763 if (fields == EOF) return (FALSE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4764
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4765 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4766 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4767 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
4768 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
4769 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4770 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4771 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4772 lplogfont->lfFaceName[0] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4773 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4774
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4775 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4776
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4777 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4778 lplogfont->lfHeight = atoi (height);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4779
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4780 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4781
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4782 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4783 lplogfont->lfWidth = atoi (width);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4784
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4785 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4786
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4787 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
4788 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4789
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4790 /* 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
4791 lplogfont->lfHeight = - abs (lplogfont->lfHeight);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4792
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4793 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4794 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4795
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4796 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4797 w32_font_match (lpszfont1, lpszfont2)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4798 char * lpszfont1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4799 char * lpszfont2;
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 char * s1 = lpszfont1, *e1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4802 char * s2 = lpszfont2, *e2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4803
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4804 if (s1 == NULL || s2 == NULL) return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4805
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4806 if (*s1 == '-') s1++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4807 if (*s2 == '-') s2++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4808
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4809 while (1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4810 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4811 int len1, len2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4812
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4813 e1 = strchr (s1, '-');
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4814 e2 = strchr (s2, '-');
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4815
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4816 if (e1 == NULL || e2 == NULL) return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4817
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4818 len1 = e1 - s1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4819 len2 = e2 - s2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4820
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4821 if (*s1 != '*' && *s2 != '*'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4822 && (len1 != len2 || strnicmp (s1, s2, len1) != 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4823 return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4824
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4825 s1 = e1 + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4826 s2 = e2 + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4827 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4828 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4829
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4830 typedef struct enumfont_t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4831 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4832 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4833 int numFonts;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4834 LOGFONT logfont;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4835 XFontStruct *size_ref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4836 Lisp_Object *pattern;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4837 Lisp_Object *head;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4838 Lisp_Object *tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4839 } enumfont_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4840
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4841 int CALLBACK
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4842 enum_font_cb2 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4843 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4844 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4845 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4846 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4847 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4848 if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4849 return (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4850
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4851 /* if (!lpef->size_ref || lptm->tmMaxCharWidth == FONT_WIDTH (lpef->size_ref)) */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4852 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4853 char buf[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4854
21896
ff66bfc5d801 (enum_font_cb2): Only ignore raster fonts when
Geoff Voelker <voelker@cs.washington.edu>
parents: 21884
diff changeset
4855 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
4856 {
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4857 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4858 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4859 }
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4860
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4861 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
4862
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4863 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
4864 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4865 *lpef->tail = Fcons (build_string (buf), Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4866 lpef->tail = &XCONS (*lpef->tail)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4867 lpef->numFonts++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4868 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4869 }
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 return (1);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4874 int CALLBACK
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4875 enum_font_cb1 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4876 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4877 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4878 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4879 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4880 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4881 return EnumFontFamilies (lpef->hdc,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4882 lplf->elfLogFont.lfFaceName,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4883 (FONTENUMPROC) enum_font_cb2,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4884 (LPARAM) lpef);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4885 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4886
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4887
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
4888 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
4889 "Return a list of the names of available fonts matching PATTERN.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4890 If optional arguments FACE and FRAME are specified, return only fonts\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4891 the same size as FACE on FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4892 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4893 PATTERN is a string, perhaps with wildcard characters;\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4894 the * character matches any substring, and\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4895 the ? character matches any single character.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4896 PATTERN is case-insensitive.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4897 FACE is a face name--a symbol.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4898 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4899 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
4900 set-face-font.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4901 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4902 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
4903 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
4904 \n\
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
4905 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
4906 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
4907 (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
4908 Lisp_Object pattern, face, frame, maximum;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4909 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4910 int num_fonts;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4911 char **names;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4912 XFontStruct *info;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4913 XFontStruct *size_ref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4914 Lisp_Object namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4915 Lisp_Object list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4916 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4917 enumfont_t ef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4918
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4919 CHECK_STRING (pattern, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4920 if (!NILP (face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4921 CHECK_SYMBOL (face, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4922
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4923 f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4924
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4925 /* Determine the width standard for comparison with the fonts we find. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4926
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4927 if (NILP (face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4928 size_ref = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4929 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4930 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4931 int face_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4932
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4933 /* 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
4934 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4935 error ("non-w32 frame used in `x-list-fonts'");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4936
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4937 face_id = face_name_id_number (f, face);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4938
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4939 if (face_id < 0 || face_id >= FRAME_N_PARAM_FACES (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4940 || 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
4941 size_ref = f->output_data.w32->font;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4942 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4943 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4944 size_ref = FRAME_PARAM_FACES (f) [face_id]->font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4945 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
4946 size_ref = f->output_data.w32->font;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4947 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4948 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4949
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4950 /* See if we cached the result for this particular query. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4951 list = Fassoc (pattern,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4952 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4953
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4954 /* We have info in the cache for this PATTERN. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4955 if (!NILP (list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4956 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4957 Lisp_Object tem, newlist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4958
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4959 /* We have info about this pattern. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4960 list = XCONS (list)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4961
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4962 if (size_ref == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4963 return list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4964
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4965 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4966
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4967 /* Filter the cached info and return just the fonts that match FACE. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4968 newlist = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4969 for (tem = list; CONSP (tem); tem = XCONS (tem)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4970 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4971 XFontStruct *thisinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4972
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4973 thisinfo = w32_load_font (FRAME_W32_DISPLAY_INFO (f), XSTRING (XCONS (tem)->car)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4974
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4975 if (thisinfo && same_size_fonts (thisinfo, size_ref))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4976 newlist = Fcons (XCONS (tem)->car, newlist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4977
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4978 w32_unload_font (FRAME_W32_DISPLAY_INFO (f), thisinfo);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4979 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4980
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4981 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4982
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4983 return newlist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4984 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4985
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4986 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4987
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4988 namelist = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4989 ef.pattern = &pattern;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4990 ef.tail = ef.head = &namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4991 ef.numFonts = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4992 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
4993
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4994 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4995 ef.hdc = GetDC (FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4996
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4997 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, (LPARAM)&ef);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4998
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4999 ReleaseDC (FRAME_W32_WINDOW (f), ef.hdc);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5000 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5001
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5002 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5003
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5004 if (ef.numFonts)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5005 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5006 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5007 Lisp_Object cur;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5008
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5009 /* Make a list of all the fonts we got back.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5010 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
5011 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5012 = Fcons (Fcons (pattern, namelist),
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5013 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5014
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5015 /* Make a list of the fonts that have the right width. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5016 list = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5017 cur=namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5018 for (i = 0; i < ef.numFonts; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5019 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5020 int keeper;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5021
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5022 if (!size_ref)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5023 keeper = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5024 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5025 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5026 XFontStruct *thisinfo;
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 BLOCK_INPUT;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5029 thisinfo = w32_load_font (FRAME_W32_DISPLAY_INFO (f), XSTRING (Fcar (cur))->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5030
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5031 keeper = thisinfo && same_size_fonts (thisinfo, size_ref);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5032
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5033 w32_unload_font (FRAME_W32_DISPLAY_INFO (f), thisinfo);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5034
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5035 UNBLOCK_INPUT;
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 if (keeper)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5038 list = Fcons (build_string (XSTRING (Fcar (cur))->data), list);
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 cur = Fcdr (cur);
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 list = Fnreverse (list);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5045 return list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5046 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5047
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5048 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
5049 "Return non-nil if color COLOR is supported on frame FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5050 If FRAME is omitted or nil, use the selected frame.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5051 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5052 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5053 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5054 COLORREF foo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5055 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5056
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5057 CHECK_STRING (color, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5058
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5059 if (defined_color (f, XSTRING (color)->data, &foo, 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5060 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5061 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5062 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5063 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5064
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5065 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
5066 "Return a description of the color named COLOR on frame FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5067 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
5068 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
5069 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
5070 If FRAME is omitted or nil, use the selected frame.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5071 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5072 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5073 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5074 COLORREF foo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5075 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5076
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5077 CHECK_STRING (color, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5078
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5079 if (defined_color (f, XSTRING (color)->data, &foo, 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5080 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5081 Lisp_Object rgb[3];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5082
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5083 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
5084 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
5085 rgb[2] = make_number ((GetBValue (foo) << 8) | GetBValue (foo));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5086 return Flist (3, rgb);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5087 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5088 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5089 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5090 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5091
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5092 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
5093 "Return t if the X display supports color.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5094 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5095 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
5096 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5097 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5098 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5099 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5100 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5101
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5102 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5103 return Qnil;
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 Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5106 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5107
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5108 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
5109 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5110 "Return t if the X display supports shades of gray.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5111 Note that color displays do support shades of gray.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5112 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5113 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
5114 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5115 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5116 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5117 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5118 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5119
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5120 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5121 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5122
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5123 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5124 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5125
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5126 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
5127 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5128 "Returns the width in pixels of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5129 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5130 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
5131 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5132 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5133 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5134 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5135 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5136
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5137 return make_number (dpyinfo->width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5138 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5139
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5140 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5141 Sx_display_pixel_height, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5142 "Returns the height in pixels of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5143 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5144 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
5145 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5146 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5147 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5148 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5149 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5150
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5151 return make_number (dpyinfo->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5152 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5153
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5154 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5155 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5156 "Returns the number of bitplanes of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5157 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5158 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
5159 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5160 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5161 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5162 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5163 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5164
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5165 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5166 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5167
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5168 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
5169 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5170 "Returns the number of color cells of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5171 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5172 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
5173 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5174 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5175 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5176 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5177 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5178 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5179 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5180
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5181 hdc = GetDC (dpyinfo->root_window);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5182 if (dpyinfo->has_palette)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5183 cap = GetDeviceCaps (hdc,SIZEPALETTE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5184 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5185 cap = GetDeviceCaps (hdc,NUMCOLORS);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5186
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5187 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5188
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5189 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5190 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5191
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5192 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5193 Sx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5194 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5195 "Returns the maximum request size of the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5196 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5197 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
5198 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5199 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5200 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5201 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5202 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5203
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5204 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5205 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5206
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5207 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
5208 "Returns the vendor ID string of the W32 system (Microsoft).\n\
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5209 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5210 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
5211 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5212 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5213 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5214 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5215 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5216 char *vendor = "Microsoft Corp.";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5217
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5218 if (! vendor) vendor = "";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5219 return build_string (vendor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5220 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5221
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5222 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
5223 "Returns the version numbers of the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5224 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
5225 version numbers, and the vendor-specific release\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5226 number. See also the function `x-server-vendor'.\n\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5227 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5228 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
5229 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5230 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5231 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5232 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5233 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
5234
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5235 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
5236 Fcons (make_number (w32_minor_version), Qnil));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5237 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5238
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5239 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
5240 "Returns the number of screens on the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5241 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5242 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
5243 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5244 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5245 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5246 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5247 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5248
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5249 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5250 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5251
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5252 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
5253 "Returns the height in millimeters of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5254 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5255 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
5256 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5257 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5258 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5259 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5260 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5261 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5262 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5263
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5264 hdc = GetDC (dpyinfo->root_window);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5265
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5266 cap = GetDeviceCaps (hdc, VERTSIZE);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5267
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5268 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5269
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5270 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5271 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5272
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5273 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
5274 "Returns the width in millimeters of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5275 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5276 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
5277 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5278 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5279 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5280 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5281 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5282
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5283 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5284 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5285
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5286 hdc = GetDC (dpyinfo->root_window);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5287
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5288 cap = GetDeviceCaps (hdc, HORZSIZE);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5289
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5290 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5291
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5292 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5293 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5294
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5295 DEFUN ("x-display-backing-store", Fx_display_backing_store,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5296 Sx_display_backing_store, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5297 "Returns an indication of whether display DISPLAY does backing store.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5298 The value may be `always', `when-mapped', or `not-useful'.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5299 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5300 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
5301 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5302 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5303 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5304 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5305 return intern ("not-useful");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5306 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5307
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5308 DEFUN ("x-display-visual-class", Fx_display_visual_class,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5309 Sx_display_visual_class, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5310 "Returns the visual class of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5311 The value is one of the symbols `static-gray', `gray-scale',\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5312 `static-color', `pseudo-color', `true-color', or `direct-color'.\n\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5313 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5314 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
5315 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5316 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5317 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5318 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5319 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5320
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5321 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5322 switch (dpyinfo->visual->class)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5323 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5324 case StaticGray: return (intern ("static-gray"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5325 case GrayScale: return (intern ("gray-scale"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5326 case StaticColor: return (intern ("static-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5327 case PseudoColor: return (intern ("pseudo-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5328 case TrueColor: return (intern ("true-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5329 case DirectColor: return (intern ("direct-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5330 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5331 error ("Display has an unknown visual class");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5332 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5333 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5334
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5335 error ("Display has an unknown visual class");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5336 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5337
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5338 DEFUN ("x-display-save-under", Fx_display_save_under,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5339 Sx_display_save_under, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5340 "Returns t if the display DISPLAY supports the save-under feature.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5341 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5342 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
5343 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5344 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5345 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5346 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5347 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5348
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5349 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5350 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5351
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5352 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5353 x_pixel_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5354 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5355 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5356 return PIXEL_WIDTH (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5357 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5358
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5359 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5360 x_pixel_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5361 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5362 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5363 return PIXEL_HEIGHT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5364 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5365
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5366 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5367 x_char_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5368 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5369 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5370 return FONT_WIDTH (f->output_data.w32->font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5371 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5372
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5373 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5374 x_char_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5375 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5376 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5377 return f->output_data.w32->line_height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5378 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5379
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5380 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5381 x_screen_planes (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5382 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5383 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5384 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
5385 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5386 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5387
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5388 /* Return the display structure for the display named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5389 Open a new connection if necessary. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5390
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5391 struct w32_display_info *
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5392 x_display_info_for_name (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5393 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5394 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5395 Lisp_Object names;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5396 struct w32_display_info *dpyinfo;
13434
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 CHECK_STRING (name, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5399
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5400 for (dpyinfo = &one_w32_display_info, names = w32_display_name_list;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5401 dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5402 dpyinfo = dpyinfo->next, names = XCONS (names)->cdr)
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 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5405 tem = Fstring_equal (XCONS (XCONS (names)->car)->car, name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5406 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5407 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5408 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5409
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5410 /* Use this general default value to start with. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5411 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5412
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5413 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5414
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5415 dpyinfo = w32_term_init (name, (unsigned char *)0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5416 (char *) XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5417
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5418 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5419 error ("Cannot connect to server %s", XSTRING (name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5420
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5421 w32_in_use = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5422 XSETFASTINT (Vwindow_system_version, 3);
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 return dpyinfo;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5427 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5428 1, 3, 0, "Open a connection to a server.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5429 DISPLAY is the name of the display to connect to.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5430 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
5431 If the optional third arg MUST-SUCCEED is non-nil,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5432 terminate Emacs if we can't open the connection.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5433 (display, xrm_string, must_succeed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5434 Lisp_Object display, xrm_string, must_succeed;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5435 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5436 unsigned int n_planes;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5437 unsigned char *xrm_option;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5438 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5439
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5440 CHECK_STRING (display, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5441 if (! NILP (xrm_string))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5442 CHECK_STRING (xrm_string, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5443
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5444 if (! EQ (Vwindow_system, intern ("w32")))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5445 error ("Not using Microsoft Windows");
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5446
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5447 /* 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
5448 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
5449 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5450 Lisp_Object color_file;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5451 struct gcpro gcpro1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5452
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5453 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
5454
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5455 GCPRO1 (color_file);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5456
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5457 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
5458 color_file =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5459 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
5460 Fsymbol_value (intern ("data-directory")));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5461
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5462 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
5463
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5464 UNGCPRO;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5465 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5466 if (NILP (Vw32_color_map))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5467 Vw32_color_map = Fw32_default_color_map ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5468
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5469 if (! NILP (xrm_string))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5470 xrm_option = (unsigned char *) XSTRING (xrm_string)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5471 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5472 xrm_option = (unsigned char *) 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5473
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5474 /* 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
5475 /* 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
5476 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5477 char basename[ MAX_PATH ], *str;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5478
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5479 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
5480 str = strrchr (basename, '.');
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5481 if (str) *str = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5482 Vinvocation_name = build_string (basename);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5483 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5484 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5485
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5486 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5487
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5488 /* This is what opens the connection and sets x_current_display.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5489 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
5490 dpyinfo = w32_term_init (display, xrm_option,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5491 (char *) XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5492
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5493 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5494 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5495 if (!NILP (must_succeed))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5496 fatal ("Cannot connect to server %s.\n",
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5497 XSTRING (display)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5498 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5499 error ("Cannot connect to server %s", XSTRING (display)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5500 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5501
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5502 w32_in_use = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5503
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5504 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5505 return Qnil;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5508 DEFUN ("x-close-connection", Fx_close_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5509 Sx_close_connection, 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5510 "Close the connection to DISPLAY's server.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5511 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
5512 If DISPLAY is nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5513 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5514 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5515 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5516 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
5517 struct w32_display_info *tail;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5518 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5519
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5520 if (dpyinfo->reference_count > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5521 error ("Display still has frames on it");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5522
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5523 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5524 /* Free the fonts in the font table. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5525 for (i = 0; i < dpyinfo->n_fonts; i++)
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 if (dpyinfo->font_table[i].name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5528 free (dpyinfo->font_table[i].name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5529 /* Don't free the full_name string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5530 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
5531 w32_unload_font (dpyinfo, dpyinfo->font_table[i].font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5532 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5533 x_destroy_all_bitmaps (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5534
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5535 x_delete_display (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5536 UNBLOCK_INPUT;
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 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5539 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5540
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5541 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
5542 "Return the list of display names that Emacs has connections to.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5543 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5544 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5545 Lisp_Object tail, result;
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 result = Qnil;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5548 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
5549 result = Fcons (XCONS (XCONS (tail)->car)->car, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5550
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5551 return result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5552 }
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 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5555 "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
5556 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
5557 This is a noop on W32 systems.\n\
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5558 The optional second argument DISPLAY specifies which display to act on.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5559 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
5560 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
5561 (on, display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5562 Lisp_Object display, on;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5563 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5564 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5565
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5566 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5567 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5568
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5569
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5570 /* 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
5571
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5572 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
5573 "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
5574 (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5575 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5576 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5577 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5578 CHOOSEFONT cf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5579 LOGFONT lf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5580 char buf[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5581
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5582 bzero (&cf, sizeof (cf));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5583
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5584 cf.lStructSize = sizeof (cf);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5585 cf.hwndOwner = FRAME_W32_WINDOW (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5586 cf.Flags = CF_FIXEDPITCHONLY | CF_FORCEFONTEXIST | CF_SCREENFONTS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5587 cf.lpLogFont = &lf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5588
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5589 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
5590 return Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5591
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5592 return build_string (buf);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5593 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5594
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5595 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
5596 "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
5597 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
5598 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
5599 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
5600 screen saver if defined.\n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5601 \n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5602 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
5603 (command, frame)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5604 Lisp_Object command, frame;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5605 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5606 WPARAM code;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5607 FRAME_PTR f = check_x_frame (frame);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5608
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5609 CHECK_NUMBER (command, 0);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5610
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5611 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
5612
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5613 return Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5614 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5615
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5616
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5617 syms_of_w32fns ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5618 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5619 /* 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
5620 w32_in_use = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5621
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5622 /* 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
5623 just above where these variables are declared. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5624 /*&&& init symbols here &&&*/
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5625 Qauto_raise = intern ("auto-raise");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5626 staticpro (&Qauto_raise);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5627 Qauto_lower = intern ("auto-lower");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5628 staticpro (&Qauto_lower);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5629 Qbackground_color = intern ("background-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5630 staticpro (&Qbackground_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5631 Qbar = intern ("bar");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5632 staticpro (&Qbar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5633 Qborder_color = intern ("border-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5634 staticpro (&Qborder_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5635 Qborder_width = intern ("border-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5636 staticpro (&Qborder_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5637 Qbox = intern ("box");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5638 staticpro (&Qbox);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5639 Qcursor_color = intern ("cursor-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5640 staticpro (&Qcursor_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5641 Qcursor_type = intern ("cursor-type");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5642 staticpro (&Qcursor_type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5643 Qforeground_color = intern ("foreground-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5644 staticpro (&Qforeground_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5645 Qgeometry = intern ("geometry");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5646 staticpro (&Qgeometry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5647 Qicon_left = intern ("icon-left");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5648 staticpro (&Qicon_left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5649 Qicon_top = intern ("icon-top");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5650 staticpro (&Qicon_top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5651 Qicon_type = intern ("icon-type");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5652 staticpro (&Qicon_type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5653 Qicon_name = intern ("icon-name");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5654 staticpro (&Qicon_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5655 Qinternal_border_width = intern ("internal-border-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5656 staticpro (&Qinternal_border_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5657 Qleft = intern ("left");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5658 staticpro (&Qleft);
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
5659 Qright = intern ("right");
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
5660 staticpro (&Qright);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5661 Qmouse_color = intern ("mouse-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5662 staticpro (&Qmouse_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5663 Qnone = intern ("none");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5664 staticpro (&Qnone);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5665 Qparent_id = intern ("parent-id");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5666 staticpro (&Qparent_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5667 Qscroll_bar_width = intern ("scroll-bar-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5668 staticpro (&Qscroll_bar_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5669 Qsuppress_icon = intern ("suppress-icon");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5670 staticpro (&Qsuppress_icon);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5671 Qtop = intern ("top");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5672 staticpro (&Qtop);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5673 Qundefined_color = intern ("undefined-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5674 staticpro (&Qundefined_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5675 Qvertical_scroll_bars = intern ("vertical-scroll-bars");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5676 staticpro (&Qvertical_scroll_bars);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5677 Qvisibility = intern ("visibility");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5678 staticpro (&Qvisibility);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5679 Qwindow_id = intern ("window-id");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5680 staticpro (&Qwindow_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5681 Qx_frame_parameter = intern ("x-frame-parameter");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5682 staticpro (&Qx_frame_parameter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5683 Qx_resource_name = intern ("x-resource-name");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5684 staticpro (&Qx_resource_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5685 Quser_position = intern ("user-position");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5686 staticpro (&Quser_position);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5687 Quser_size = intern ("user-size");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5688 staticpro (&Quser_size);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5689 Qdisplay = intern ("display");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5690 staticpro (&Qdisplay);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5691 /* This is the end of symbol initialization. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5692
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
5693 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
5694 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
5695
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5696 Fput (Qundefined_color, Qerror_conditions,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5697 Fcons (Qundefined_color, Fcons (Qerror, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5698 Fput (Qundefined_color, Qerror_message,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5699 build_string ("Undefined color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5700
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5701 DEFVAR_LISP ("w32-color-map", &Vw32_color_map,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5702 "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
5703 Vw32_color_map = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5704
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5705 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
5706 "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
5707 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
5708 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
5709 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
5710
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5711 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
5712 "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
5713 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
5714 Vw32_alt_is_meta = Qt;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5715
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5716 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
5717 &Vw32_pass_optional_keys_to_system,
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5718 "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
5719 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
5720 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
5721
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5722 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
5723 "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
5724 Vw32_enable_italics = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5725
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5726 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
5727 "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
5728 Vw32_enable_palette = Qt;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5729
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5730 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
5731 &Vw32_mouse_button_tolerance,
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5732 "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
5733 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
5734 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
5735 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
5736 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
5737 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
5738
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5739 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
5740 &Vw32_mouse_move_interval,
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
5741 "Minimum interval between mouse move events.\n\
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
5742 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
5743 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
5744 reported as lisp events.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5745 XSETINT (Vw32_mouse_move_interval, 50);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
5746
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5747 init_x_parm_symbols ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5748
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5749 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
5750 "List of directories to search for bitmap files for w32.");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5751 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5752
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5753 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5754 "The shape of the pointer when over text.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5755 Changing the value does not affect existing frames\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5756 unless you set the mouse color.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5757 Vx_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5758
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5759 DEFVAR_LISP ("x-resource-name", &Vx_resource_name,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5760 "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
5761 `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
5762 when requesting resource values.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5763 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
5764 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
5765 switches, if present.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5766 Vx_resource_name = Qnil;
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 Vx_nontext_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5769
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5770 Vx_mode_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5771
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5772 DEFVAR_INT ("x-sensitive-text-pointer-shape",
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5773 &Vx_sensitive_text_pointer_shape,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5774 "The shape of the pointer when over mouse-sensitive text.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5775 This variable takes effect when you create a new frame\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5776 or when you set the mouse color.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5777 Vx_sensitive_text_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5778
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5779 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5780 "A string indicating the foreground color of the cursor box.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5781 Vx_cursor_fore_pixel = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5782
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5783 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5784 "Non-nil if no window manager is in use.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5785 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
5786 unless you set it to something else.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5787 /* 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
5788 and maybe the user would like to set it to t. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5789 Vx_no_window_manager = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5790
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5791 defsubr (&Sx_get_resource);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5792 defsubr (&Sx_list_fonts);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5793 defsubr (&Sx_display_color_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5794 defsubr (&Sx_display_grayscale_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5795 defsubr (&Sx_color_defined_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5796 defsubr (&Sx_color_values);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5797 defsubr (&Sx_server_max_request_size);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5798 defsubr (&Sx_server_vendor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5799 defsubr (&Sx_server_version);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5800 defsubr (&Sx_display_pixel_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5801 defsubr (&Sx_display_pixel_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5802 defsubr (&Sx_display_mm_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5803 defsubr (&Sx_display_mm_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5804 defsubr (&Sx_display_screens);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5805 defsubr (&Sx_display_planes);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5806 defsubr (&Sx_display_color_cells);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5807 defsubr (&Sx_display_visual_class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5808 defsubr (&Sx_display_backing_store);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5809 defsubr (&Sx_display_save_under);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5810 defsubr (&Sx_parse_geometry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5811 defsubr (&Sx_create_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5812 defsubr (&Sx_open_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5813 defsubr (&Sx_close_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5814 defsubr (&Sx_display_list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5815 defsubr (&Sx_synchronize);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5816
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5817 /* W32 specific functions */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5818
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5819 defsubr (&Sw32_focus_frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5820 defsubr (&Sw32_select_font);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5821 defsubr (&Sw32_define_rgb_color);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5822 defsubr (&Sw32_default_color_map);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5823 defsubr (&Sw32_load_color_file);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5824 defsubr (&Sw32_send_sys_command);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5825 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5826
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5827 #undef abort
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 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5830 w32_abort()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5831 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5832 int button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5833 button = MessageBox (NULL,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5834 "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
5835 "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
5836 "Emacs Abort Dialog",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5837 MB_ICONEXCLAMATION | MB_TASKMODAL
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5838 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5839 switch (button)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5840 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5841 case IDRETRY:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5842 DebugBreak ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5843 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5844 case IDIGNORE:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5845 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5846 case IDABORT:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5847 default:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5848 abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5849 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5850 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5851 }
15148
220145cf7546 (continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents: 15147
diff changeset
5852