13434
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1 /* Functions for the Win32 window system.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4 This file is part of GNU Emacs.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
5
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
6 GNU Emacs is free software; you can redistribute it and/or modify
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
7 it under the terms of the GNU General Public License as published by
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
8 the Free Software Foundation; either version 2, or (at your option)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
9 any later version.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
10
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
11 GNU Emacs is distributed in the hope that it will be useful,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
14 GNU General Public License for more details.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
15
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
17 along with GNU Emacs; see the file COPYING. If not, write to
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
19
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
20 /* Added by Kevin Gallo */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
21
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
22 #include <signal.h>
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
23 #include <config.h>
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
24 #include <stdio.h>
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
25
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
26 #include "lisp.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
27 #include "w32term.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
28 #include "frame.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
29 #include "window.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
30 #include "buffer.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
31 #include "dispextern.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
32 #include "keyboard.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
33 #include "blockinput.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
34 #include "paths.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
35 #include "ntheap.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
36 #include "termhooks.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
37
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
38 #include <commdlg.h>
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
39
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
40 extern void abort ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
41 extern void free_frame_menubar ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
42 extern struct scroll_bar *x_window_to_scroll_bar ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
43
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
44 /* The colormap for converting color names to RGB values */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
45 Lisp_Object Vwin32_color_map;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
46
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
47 /* The name we're using in resource queries. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
48 Lisp_Object Vx_resource_name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
49
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
50 /* Non nil if no window manager is in use. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
51 Lisp_Object Vx_no_window_manager;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
52
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
53 /* The background and shape of the mouse pointer, and shape when not
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
54 over text or in the modeline. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
55 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
56 /* The shape when over mouse-sensitive text. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
57 Lisp_Object Vx_sensitive_text_pointer_shape;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
58
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
59 /* Color of chars displayed in cursor box. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
60 Lisp_Object Vx_cursor_fore_pixel;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
61
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
62 /* Search path for bitmap files. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
63 Lisp_Object Vx_bitmap_file_path;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
64
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
65 /* Evaluate this expression to rebuild the section of syms_of_w32fns
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
66 that initializes and staticpros the symbols declared below. Note
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
67 that Emacs 18 has a bug that keeps C-x C-e from being able to
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
68 evaluate this expression.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
69
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
70 (progn
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
71 ;; Accumulate a list of the symbols we want to initialize from the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
72 ;; declarations at the top of the file.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
73 (goto-char (point-min))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
74 (search-forward "/\*&&& symbols declared here &&&*\/\n")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
75 (let (symbol-list)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
76 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
77 (setq symbol-list
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
78 (cons (buffer-substring (match-beginning 1) (match-end 1))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
79 symbol-list))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
80 (forward-line 1))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
81 (setq symbol-list (nreverse symbol-list))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
82 ;; Delete the section of syms_of_... where we initialize the symbols.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
83 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
84 (let ((start (point)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
85 (while (looking-at "^ Q")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
86 (forward-line 2))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
87 (kill-region start (point)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
88 ;; Write a new symbol initialization section.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
89 (while symbol-list
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
90 (insert (format " %s = intern (\"" (car symbol-list)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
91 (let ((start (point)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
92 (insert (substring (car symbol-list) 1))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
93 (subst-char-in-region start (point) ?_ ?-))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
94 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
95 (setq symbol-list (cdr symbol-list)))))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
96
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
97 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
98
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
99 /*&&& symbols declared here &&&*/
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
100 Lisp_Object Qauto_raise;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
101 Lisp_Object Qauto_lower;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
102 Lisp_Object Qbackground_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
103 Lisp_Object Qbar;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
104 Lisp_Object Qborder_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
105 Lisp_Object Qborder_width;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
106 Lisp_Object Qbox;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
107 Lisp_Object Qcursor_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
108 Lisp_Object Qcursor_type;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
109 Lisp_Object Qfont;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
110 Lisp_Object Qforeground_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
111 Lisp_Object Qgeometry;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
112 Lisp_Object Qicon_left;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
113 Lisp_Object Qicon_top;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
114 Lisp_Object Qicon_type;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
115 Lisp_Object Qicon_name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
116 Lisp_Object Qinternal_border_width;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
117 Lisp_Object Qleft;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
118 Lisp_Object Qmouse_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
119 Lisp_Object Qnone;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
120 Lisp_Object Qparent_id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
121 Lisp_Object Qscroll_bar_width;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
122 Lisp_Object Qsuppress_icon;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
123 Lisp_Object Qtop;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
124 Lisp_Object Qundefined_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
125 Lisp_Object Qvertical_scroll_bars;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
126 Lisp_Object Qvisibility;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
127 Lisp_Object Qwindow_id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
128 Lisp_Object Qx_frame_parameter;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
129 Lisp_Object Qx_resource_name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
130 Lisp_Object Quser_position;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
131 Lisp_Object Quser_size;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
132 Lisp_Object Qdisplay;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
133
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
134 /* The below are defined in frame.c. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
135 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
136 extern Lisp_Object Qunsplittable, Qmenu_bar_lines;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
137
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
138 extern Lisp_Object Vwindow_system_version;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
139
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
140 extern Lisp_Object last_mouse_scroll_bar;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
141 extern int last_mouse_scroll_bar_pos;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
142 Time last_mouse_movement_time;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
143
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
144
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
145 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
146 and checking validity for Win32. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
147
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
148 FRAME_PTR
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
149 check_x_frame (frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
150 Lisp_Object frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
151 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
152 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
153
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
154 if (NILP (frame))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
155 f = selected_frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
156 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
157 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
158 CHECK_LIVE_FRAME (frame, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
159 f = XFRAME (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
160 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
161 if (! FRAME_WIN32_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
162 error ("non-win32 frame used");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
163 return f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
164 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
165
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
166 /* Let the user specify an display with a frame.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
167 nil stands for the selected frame--or, if that is not a win32 frame,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
168 the first display on the list. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
169
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
170 static struct win32_display_info *
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
171 check_x_display_info (frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
172 Lisp_Object frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
173 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
174 if (NILP (frame))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
175 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
176 if (FRAME_WIN32_P (selected_frame))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
177 return FRAME_WIN32_DISPLAY_INFO (selected_frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
178 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
179 return &one_win32_display_info;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
180 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
181 else if (STRINGP (frame))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
182 return x_display_info_for_name (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
183 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
184 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
185 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
186
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
187 CHECK_LIVE_FRAME (frame, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
188 f = XFRAME (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
189 if (! FRAME_WIN32_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
190 error ("non-win32 frame used");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
191 return FRAME_WIN32_DISPLAY_INFO (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
192 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
193 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
194
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
195 /* Return the Emacs frame-object corresponding to an win32 window.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
196 It could be the frame's main window or an icon window. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
197
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
198 /* This function can be called during GC, so use GC_xxx type test macros. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
199
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
200 struct frame *
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
201 x_window_to_frame (dpyinfo, wdesc)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
202 struct win32_display_info *dpyinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
203 HWND wdesc;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
204 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
205 Lisp_Object tail, frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
206 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
207
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
208 for (tail = Vframe_list; GC_CONSP (tail); tail = XCONS (tail)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
209 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
210 frame = XCONS (tail)->car;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
211 if (!GC_FRAMEP (frame))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
212 continue;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
213 f = XFRAME (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
214 if (f->output_data.nothing == 1
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
215 || FRAME_WIN32_DISPLAY_INFO (f) != dpyinfo)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
216 continue;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
217 if (FRAME_WIN32_WINDOW (f) == wdesc)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
218 return f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
219 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
220 return 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
221 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
222
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
223
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
224
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
225 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
226 id, which is just an int that this section returns. Bitmaps are
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
227 reference counted so they can be shared among frames.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
228
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
229 Bitmap indices are guaranteed to be > 0, so a negative number can
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
230 be used to indicate no bitmap.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
231
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
232 If you use x_create_bitmap_from_data, then you must keep track of
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
233 the bitmaps yourself. That is, creating a bitmap from the same
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
234 data more than once will not be caught. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
235
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
236
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
237 /* Functions to access the contents of a bitmap, given an id. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
238
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
239 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
240 x_bitmap_height (f, id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
241 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
242 int id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
243 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
244 return FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
245 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
246
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
247 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
248 x_bitmap_width (f, id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
249 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
250 int id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
251 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
252 return FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].width;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
253 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
254
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
255 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
256 x_bitmap_pixmap (f, id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
257 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
258 int id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
259 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
260 return (int) FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
261 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
262
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
263
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
264 /* Allocate a new bitmap record. Returns index of new record. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
265
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
266 static int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
267 x_allocate_bitmap_record (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
268 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
269 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
270 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
271 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
272
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
273 if (dpyinfo->bitmaps == NULL)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
274 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
275 dpyinfo->bitmaps_size = 10;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
276 dpyinfo->bitmaps
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
277 = (struct win32_bitmap_record *) xmalloc (dpyinfo->bitmaps_size * sizeof (struct win32_bitmap_record));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
278 dpyinfo->bitmaps_last = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
279 return 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
280 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
281
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
282 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
283 return ++dpyinfo->bitmaps_last;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
284
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
285 for (i = 0; i < dpyinfo->bitmaps_size; ++i)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
286 if (dpyinfo->bitmaps[i].refcount == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
287 return i + 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
288
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
289 dpyinfo->bitmaps_size *= 2;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
290 dpyinfo->bitmaps
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
291 = (struct win32_bitmap_record *) xrealloc (dpyinfo->bitmaps,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
292 dpyinfo->bitmaps_size * sizeof (struct win32_bitmap_record));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
293 return ++dpyinfo->bitmaps_last;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
294 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
295
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
296 /* Add one reference to the reference count of the bitmap with id ID. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
297
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
298 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
299 x_reference_bitmap (f, id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
300 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
301 int id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
302 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
303 ++FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
304 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
305
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
306 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
307
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
308 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
309 x_create_bitmap_from_data (f, bits, width, height)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
310 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
311 char *bits;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
312 unsigned int width, height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
313 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
314 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
315 Pixmap bitmap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
316 int id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
317
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
318 bitmap = CreateBitmap (width, height,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
319 FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_planes,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
320 FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_cbits,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
321 bits);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
322
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
323 if (! bitmap)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
324 return -1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
325
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
326 id = x_allocate_bitmap_record (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
327 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
328 dpyinfo->bitmaps[id - 1].file = NULL;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
329 dpyinfo->bitmaps[id - 1].hinst = NULL;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
330 dpyinfo->bitmaps[id - 1].refcount = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
331 dpyinfo->bitmaps[id - 1].depth = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
332 dpyinfo->bitmaps[id - 1].height = height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
333 dpyinfo->bitmaps[id - 1].width = width;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
334
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
335 return id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
336 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
337
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
338 /* Create bitmap from file FILE for frame F. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
339
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
340 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
341 x_create_bitmap_from_file (f, file)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
342 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
343 Lisp_Object file;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
344 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
345 return -1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
346 #if 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
347 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
348 unsigned int width, height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
349 Pixmap bitmap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
350 int xhot, yhot, result, id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
351 Lisp_Object found;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
352 int fd;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
353 char *filename;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
354 HINSTANCE hinst;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
355
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
356 /* Look for an existing bitmap with the same name. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
357 for (id = 0; id < dpyinfo->bitmaps_last; ++id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
358 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
359 if (dpyinfo->bitmaps[id].refcount
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
360 && dpyinfo->bitmaps[id].file
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
361 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
362 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
363 ++dpyinfo->bitmaps[id].refcount;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
364 return id + 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
365 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
366 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
367
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
368 /* Search bitmap-file-path for the file, if appropriate. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
369 fd = openp (Vx_bitmap_file_path, file, "", &found, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
370 if (fd < 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
371 return -1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
372 close (fd);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
373
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
374 filename = (char *) XSTRING (found)->data;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
375
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
376 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
377
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
378 if (hinst == NULL)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
379 return -1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
380
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
381
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
382 result = XReadBitmapFile (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
383 filename, &width, &height, &bitmap, &xhot, &yhot);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
384 if (result != BitmapSuccess)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
385 return -1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
386
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
387 id = x_allocate_bitmap_record (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
388 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
389 dpyinfo->bitmaps[id - 1].refcount = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
390 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
391 dpyinfo->bitmaps[id - 1].depth = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
392 dpyinfo->bitmaps[id - 1].height = height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
393 dpyinfo->bitmaps[id - 1].width = width;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
394 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
395
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
396 return id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
397 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
398 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
399
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
400 /* Remove reference to bitmap with id number ID. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
401
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
402 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
403 x_destroy_bitmap (f, id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
404 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
405 int id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
406 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
407 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
408
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
409 if (id > 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
410 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
411 --dpyinfo->bitmaps[id - 1].refcount;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
412 if (dpyinfo->bitmaps[id - 1].refcount == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
413 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
414 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
415 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
416 if (dpyinfo->bitmaps[id - 1].file)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
417 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
418 free (dpyinfo->bitmaps[id - 1].file);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
419 dpyinfo->bitmaps[id - 1].file = NULL;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
420 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
421 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
422 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
423 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
424 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
425
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
426 /* Free all the bitmaps for the display specified by DPYINFO. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
427
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
428 static void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
429 x_destroy_all_bitmaps (dpyinfo)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
430 struct win32_display_info *dpyinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
431 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
432 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
433 for (i = 0; i < dpyinfo->bitmaps_last; i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
434 if (dpyinfo->bitmaps[i].refcount > 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
435 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
436 DeleteObject (dpyinfo->bitmaps[i].pixmap);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
437 if (dpyinfo->bitmaps[i].file)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
438 free (dpyinfo->bitmaps[i].file);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
439 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
440 dpyinfo->bitmaps_last = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
441 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
442
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
443 /* Connect the frame-parameter names for Win32 frames
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
444 to the ways of passing the parameter values to the window system.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
445
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
446 The name of a parameter, as a Lisp symbol,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
447 has an `x-frame-parameter' property which is an integer in Lisp
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
448 but can be interpreted as an `enum x_frame_parm' in C. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
449
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
450 enum x_frame_parm
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
451 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
452 X_PARM_FOREGROUND_COLOR,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
453 X_PARM_BACKGROUND_COLOR,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
454 X_PARM_MOUSE_COLOR,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
455 X_PARM_CURSOR_COLOR,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
456 X_PARM_BORDER_COLOR,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
457 X_PARM_ICON_TYPE,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
458 X_PARM_FONT,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
459 X_PARM_BORDER_WIDTH,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
460 X_PARM_INTERNAL_BORDER_WIDTH,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
461 X_PARM_NAME,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
462 X_PARM_AUTORAISE,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
463 X_PARM_AUTOLOWER,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
464 X_PARM_VERT_SCROLL_BAR,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
465 X_PARM_VISIBILITY,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
466 X_PARM_MENU_BAR_LINES
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
467 };
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
468
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
469
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
470 struct x_frame_parm_table
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
471 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
472 char *name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
473 void (*setter)( /* struct frame *frame, Lisp_Object val, oldval */ );
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
474 };
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
475
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
476 void x_set_foreground_color ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
477 void x_set_background_color ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
478 void x_set_mouse_color ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
479 void x_set_cursor_color ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
480 void x_set_border_color ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
481 void x_set_cursor_type ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
482 void x_set_icon_type ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
483 void x_set_icon_name ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
484 void x_set_font ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
485 void x_set_border_width ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
486 void x_set_internal_border_width ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
487 void x_explicitly_set_name ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
488 void x_set_autoraise ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
489 void x_set_autolower ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
490 void x_set_vertical_scroll_bars ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
491 void x_set_visibility ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
492 void x_set_menu_bar_lines ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
493 void x_set_scroll_bar_width ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
494 void x_set_unsplittable ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
495
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
496 static struct x_frame_parm_table x_frame_parms[] =
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
497 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
498 "foreground-color", x_set_foreground_color,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
499 "background-color", x_set_background_color,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
500 "mouse-color", x_set_mouse_color,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
501 "cursor-color", x_set_cursor_color,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
502 "border-color", x_set_border_color,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
503 "cursor-type", x_set_cursor_type,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
504 "icon-type", x_set_icon_type,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
505 "icon-name", x_set_icon_name,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
506 "font", x_set_font,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
507 "border-width", x_set_border_width,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
508 "internal-border-width", x_set_internal_border_width,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
509 "name", x_explicitly_set_name,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
510 "auto-raise", x_set_autoraise,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
511 "auto-lower", x_set_autolower,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
512 "vertical-scroll-bars", x_set_vertical_scroll_bars,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
513 "visibility", x_set_visibility,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
514 "menu-bar-lines", x_set_menu_bar_lines,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
515 "scroll-bar-width", x_set_scroll_bar_width,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
516 "unsplittable", x_set_unsplittable,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
517 };
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
518
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
519 /* Attach the `x-frame-parameter' properties to
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
520 the Lisp symbol names of parameters relevant to Win32. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
521
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
522 init_x_parm_symbols ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
523 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
524 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
525
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
526 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
527 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
528 make_number (i));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
529 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
530
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
531 /* Change the parameters of FRAME as specified by ALIST.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
532 If a parameter is not specially recognized, do nothing;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
533 otherwise call the `x_set_...' function for that parameter. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
534
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
535 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
536 x_set_frame_parameters (f, alist)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
537 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
538 Lisp_Object alist;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
539 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
540 Lisp_Object tail;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
541
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
542 /* If both of these parameters are present, it's more efficient to
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
543 set them both at once. So we wait until we've looked at the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
544 entire list before we set them. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
545 Lisp_Object width, height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
546
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
547 /* Same here. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
548 Lisp_Object left, top;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
549
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
550 /* Same with these. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
551 Lisp_Object icon_left, icon_top;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
552
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
553 /* Record in these vectors all the parms specified. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
554 Lisp_Object *parms;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
555 Lisp_Object *values;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
556 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
557 int left_no_change = 0, top_no_change = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
558 int icon_left_no_change = 0, icon_top_no_change = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
559
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
560 i = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
561 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
562 i++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
563
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
564 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
565 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
566
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
567 /* Extract parm names and values into those vectors. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
568
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
569 i = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
570 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
571 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
572 Lisp_Object elt, prop, val;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
573
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
574 elt = Fcar (tail);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
575 parms[i] = Fcar (elt);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
576 values[i] = Fcdr (elt);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
577 i++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
578 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
579
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
580 width = height = top = left = Qunbound;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
581 icon_left = icon_top = Qunbound;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
582
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
583 /* Now process them in reverse of specified order. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
584 for (i--; i >= 0; i--)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
585 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
586 Lisp_Object prop, val;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
587
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
588 prop = parms[i];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
589 val = values[i];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
590
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
591 if (EQ (prop, Qwidth))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
592 width = val;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
593 else if (EQ (prop, Qheight))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
594 height = val;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
595 else if (EQ (prop, Qtop))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
596 top = val;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
597 else if (EQ (prop, Qleft))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
598 left = val;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
599 else if (EQ (prop, Qicon_top))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
600 icon_top = val;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
601 else if (EQ (prop, Qicon_left))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
602 icon_left = val;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
603 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
604 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
605 register Lisp_Object param_index, old_value;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
606
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
607 param_index = Fget (prop, Qx_frame_parameter);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
608 old_value = get_frame_param (f, prop);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
609 store_frame_param (f, prop, val);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
610 if (NATNUMP (param_index)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
611 && (XFASTINT (param_index)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
612 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
613 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
614 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
615 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
616
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
617 /* Don't die if just one of these was set. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
618 if (EQ (left, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
619 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
620 left_no_change = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
621 if (f->output_data.win32->left_pos < 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
622 left = Fcons (Qplus, Fcons (make_number (f->output_data.win32->left_pos), Qnil));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
623 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
624 XSETINT (left, f->output_data.win32->left_pos);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
625 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
626 if (EQ (top, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
627 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
628 top_no_change = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
629 if (f->output_data.win32->top_pos < 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
630 top = Fcons (Qplus, Fcons (make_number (f->output_data.win32->top_pos), Qnil));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
631 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
632 XSETINT (top, f->output_data.win32->top_pos);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
633 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
634
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
635 /* If one of the icon positions was not set, preserve or default it. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
636 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
637 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
638 icon_left_no_change = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
639 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
640 if (NILP (icon_left))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
641 XSETINT (icon_left, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
642 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
643 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
644 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
645 icon_top_no_change = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
646 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
647 if (NILP (icon_top))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
648 XSETINT (icon_top, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
649 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
650
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
651 /* Don't die if just one of these was set. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
652 if (EQ (width, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
653 XSETINT (width, FRAME_WIDTH (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
654 if (EQ (height, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
655 XSETINT (height, FRAME_HEIGHT (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
656
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
657 /* Don't set these parameters unless they've been explicitly
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
658 specified. The window might be mapped or resized while we're in
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
659 this function, and we don't want to override that unless the lisp
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
660 code has asked for it.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
661
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
662 Don't set these parameters unless they actually differ from the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
663 window's current parameters; the window may not actually exist
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
664 yet. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
665 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
666 Lisp_Object frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
667
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
668 check_frame_size (f, &height, &width);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
669
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
670 XSETFRAME (frame, f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
671
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
672 if ((NUMBERP (width) && XINT (width) != FRAME_WIDTH (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
673 || (NUMBERP (height) && XINT (height) != FRAME_HEIGHT (f)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
674 Fset_frame_size (frame, width, height);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
675
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
676 if ((!NILP (left) || !NILP (top))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
677 && ! (left_no_change && top_no_change)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
678 && ! (NUMBERP (left) && XINT (left) == f->output_data.win32->left_pos
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
679 && NUMBERP (top) && XINT (top) == f->output_data.win32->top_pos))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
680 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
681 int leftpos = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
682 int toppos = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
683
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
684 /* Record the signs. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
685 f->output_data.win32->size_hint_flags &= ~ (XNegative | YNegative);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
686 if (EQ (left, Qminus))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
687 f->output_data.win32->size_hint_flags |= XNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
688 else if (INTEGERP (left))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
689 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
690 leftpos = XINT (left);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
691 if (leftpos < 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
692 f->output_data.win32->size_hint_flags |= XNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
693 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
694 else if (CONSP (left) && EQ (XCONS (left)->car, Qminus)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
695 && CONSP (XCONS (left)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
696 && INTEGERP (XCONS (XCONS (left)->cdr)->car))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
697 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
698 leftpos = - XINT (XCONS (XCONS (left)->cdr)->car);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
699 f->output_data.win32->size_hint_flags |= XNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
700 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
701 else if (CONSP (left) && EQ (XCONS (left)->car, Qplus)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
702 && CONSP (XCONS (left)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
703 && INTEGERP (XCONS (XCONS (left)->cdr)->car))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
704 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
705 leftpos = XINT (XCONS (XCONS (left)->cdr)->car);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
706 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
707
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
708 if (EQ (top, Qminus))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
709 f->output_data.win32->size_hint_flags |= YNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
710 else if (INTEGERP (top))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
711 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
712 toppos = XINT (top);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
713 if (toppos < 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
714 f->output_data.win32->size_hint_flags |= YNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
715 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
716 else if (CONSP (top) && EQ (XCONS (top)->car, Qminus)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
717 && CONSP (XCONS (top)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
718 && INTEGERP (XCONS (XCONS (top)->cdr)->car))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
719 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
720 toppos = - XINT (XCONS (XCONS (top)->cdr)->car);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
721 f->output_data.win32->size_hint_flags |= YNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
722 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
723 else if (CONSP (top) && EQ (XCONS (top)->car, Qplus)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
724 && CONSP (XCONS (top)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
725 && INTEGERP (XCONS (XCONS (top)->cdr)->car))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
726 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
727 toppos = XINT (XCONS (XCONS (top)->cdr)->car);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
728 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
729
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
730
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
731 /* Store the numeric value of the position. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
732 f->output_data.win32->top_pos = toppos;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
733 f->output_data.win32->left_pos = leftpos;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
734
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
735 f->output_data.win32->win_gravity = NorthWestGravity;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
736
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
737 /* Actually set that position, and convert to absolute. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
738 x_set_offset (f, leftpos, toppos, -1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
739 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
740
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
741 if ((!NILP (icon_left) || !NILP (icon_top))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
742 && ! (icon_left_no_change && icon_top_no_change))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
743 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
744 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
745 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
746
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
747 /* Store the screen positions of frame F into XPTR and YPTR.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
748 These are the positions of the containing window manager window,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
749 not Emacs's own window. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
750
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
751 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
752 x_real_positions (f, xptr, yptr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
753 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
754 int *xptr, *yptr;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
755 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
756 POINT pt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
757
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
758 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
759 RECT rect;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
760
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
761 GetClientRect(FRAME_WIN32_WINDOW(f), &rect);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
762 AdjustWindowRect(&rect, f->output_data.win32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
763
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
764 pt.x = rect.left;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
765 pt.y = rect.top;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
766 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
767
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
768 ClientToScreen (FRAME_WIN32_WINDOW(f), &pt);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
769
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
770 *xptr = pt.x;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
771 *yptr = pt.y;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
772 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
773
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
774 /* Insert a description of internally-recorded parameters of frame X
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
775 into the parameter alist *ALISTPTR that is to be given to the user.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
776 Only parameters that are specific to Win32
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
777 and whose values are not correctly recorded in the frame's
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
778 param_alist need to be considered here. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
779
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
780 x_report_frame_params (f, alistptr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
781 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
782 Lisp_Object *alistptr;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
783 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
784 char buf[16];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
785 Lisp_Object tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
786
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
787 /* Represent negative positions (off the top or left screen edge)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
788 in a way that Fmodify_frame_parameters will understand correctly. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
789 XSETINT (tem, f->output_data.win32->left_pos);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
790 if (f->output_data.win32->left_pos >= 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
791 store_in_alist (alistptr, Qleft, tem);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
792 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
793 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
794
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
795 XSETINT (tem, f->output_data.win32->top_pos);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
796 if (f->output_data.win32->top_pos >= 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
797 store_in_alist (alistptr, Qtop, tem);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
798 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
799 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
800
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
801 store_in_alist (alistptr, Qborder_width,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
802 make_number (f->output_data.win32->border_width));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
803 store_in_alist (alistptr, Qinternal_border_width,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
804 make_number (f->output_data.win32->internal_border_width));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
805 sprintf (buf, "%ld", (long) FRAME_WIN32_WINDOW (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
806 store_in_alist (alistptr, Qwindow_id,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
807 build_string (buf));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
808 store_in_alist (alistptr, Qicon_name, f->icon_name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
809 FRAME_SAMPLE_VISIBILITY (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
810 store_in_alist (alistptr, Qvisibility,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
811 (FRAME_VISIBLE_P (f) ? Qt
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
812 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
813 store_in_alist (alistptr, Qdisplay,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
814 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->car);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
815 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
816
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
817
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
818 #if 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
819 DEFUN ("win32-rgb", Fwin32_rgb, Swin32_rgb, 3, 3, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
820 "Convert RGB numbers to a windows color reference.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
821 (red, green, blue)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
822 Lisp_Object red, green, blue;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
823 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
824 Lisp_Object rgb;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
825
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
826 CHECK_NUMBER (red, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
827 CHECK_NUMBER (green, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
828 CHECK_NUMBER (blue, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
829
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
830 XSET (rgb, Lisp_Int, RGB(XUINT(red), XUINT(green), XUINT(blue)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
831
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
832 return (rgb);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
833 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
834
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
835
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
836 #else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
837 /* The default colors for the win32 color map */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
838 typedef struct colormap_t
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
839 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
840 char *name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
841 COLORREF colorref;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
842 } colormap_t;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
843
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
844 colormap_t win32_color_map[] =
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
845 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
846 {"snow" , RGB (255,250,250)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
847 {"ghost white" , RGB (248,248,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
848 {"GhostWhite" , RGB (248,248,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
849 {"white smoke" , RGB (245,245,245)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
850 {"WhiteSmoke" , RGB (245,245,245)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
851 {"gainsboro" , RGB (220,220,220)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
852 {"floral white" , RGB (255,250,240)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
853 {"FloralWhite" , RGB (255,250,240)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
854 {"old lace" , RGB (253,245,230)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
855 {"OldLace" , RGB (253,245,230)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
856 {"linen" , RGB (250,240,230)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
857 {"antique white" , RGB (250,235,215)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
858 {"AntiqueWhite" , RGB (250,235,215)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
859 {"papaya whip" , RGB (255,239,213)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
860 {"PapayaWhip" , RGB (255,239,213)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
861 {"blanched almond" , RGB (255,235,205)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
862 {"BlanchedAlmond" , RGB (255,235,205)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
863 {"bisque" , RGB (255,228,196)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
864 {"peach puff" , RGB (255,218,185)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
865 {"PeachPuff" , RGB (255,218,185)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
866 {"navajo white" , RGB (255,222,173)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
867 {"NavajoWhite" , RGB (255,222,173)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
868 {"moccasin" , RGB (255,228,181)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
869 {"cornsilk" , RGB (255,248,220)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
870 {"ivory" , RGB (255,255,240)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
871 {"lemon chiffon" , RGB (255,250,205)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
872 {"LemonChiffon" , RGB (255,250,205)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
873 {"seashell" , RGB (255,245,238)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
874 {"honeydew" , RGB (240,255,240)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
875 {"mint cream" , RGB (245,255,250)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
876 {"MintCream" , RGB (245,255,250)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
877 {"azure" , RGB (240,255,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
878 {"alice blue" , RGB (240,248,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
879 {"AliceBlue" , RGB (240,248,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
880 {"lavender" , RGB (230,230,250)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
881 {"lavender blush" , RGB (255,240,245)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
882 {"LavenderBlush" , RGB (255,240,245)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
883 {"misty rose" , RGB (255,228,225)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
884 {"MistyRose" , RGB (255,228,225)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
885 {"white" , RGB (255,255,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
886 {"black" , RGB ( 0, 0, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
887 {"dark slate gray" , RGB ( 47, 79, 79)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
888 {"DarkSlateGray" , RGB ( 47, 79, 79)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
889 {"dark slate grey" , RGB ( 47, 79, 79)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
890 {"DarkSlateGrey" , RGB ( 47, 79, 79)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
891 {"dim gray" , RGB (105,105,105)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
892 {"DimGray" , RGB (105,105,105)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
893 {"dim grey" , RGB (105,105,105)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
894 {"DimGrey" , RGB (105,105,105)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
895 {"slate gray" , RGB (112,128,144)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
896 {"SlateGray" , RGB (112,128,144)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
897 {"slate grey" , RGB (112,128,144)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
898 {"SlateGrey" , RGB (112,128,144)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
899 {"light slate gray" , RGB (119,136,153)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
900 {"LightSlateGray" , RGB (119,136,153)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
901 {"light slate grey" , RGB (119,136,153)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
902 {"LightSlateGrey" , RGB (119,136,153)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
903 {"gray" , RGB (190,190,190)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
904 {"grey" , RGB (190,190,190)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
905 {"light grey" , RGB (211,211,211)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
906 {"LightGrey" , RGB (211,211,211)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
907 {"light gray" , RGB (211,211,211)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
908 {"LightGray" , RGB (211,211,211)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
909 {"midnight blue" , RGB ( 25, 25,112)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
910 {"MidnightBlue" , RGB ( 25, 25,112)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
911 {"navy" , RGB ( 0, 0,128)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
912 {"navy blue" , RGB ( 0, 0,128)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
913 {"NavyBlue" , RGB ( 0, 0,128)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
914 {"cornflower blue" , RGB (100,149,237)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
915 {"CornflowerBlue" , RGB (100,149,237)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
916 {"dark slate blue" , RGB ( 72, 61,139)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
917 {"DarkSlateBlue" , RGB ( 72, 61,139)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
918 {"slate blue" , RGB (106, 90,205)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
919 {"SlateBlue" , RGB (106, 90,205)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
920 {"medium slate blue" , RGB (123,104,238)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
921 {"MediumSlateBlue" , RGB (123,104,238)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
922 {"light slate blue" , RGB (132,112,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
923 {"LightSlateBlue" , RGB (132,112,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
924 {"medium blue" , RGB ( 0, 0,205)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
925 {"MediumBlue" , RGB ( 0, 0,205)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
926 {"royal blue" , RGB ( 65,105,225)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
927 {"RoyalBlue" , RGB ( 65,105,225)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
928 {"blue" , RGB ( 0, 0,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
929 {"dodger blue" , RGB ( 30,144,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
930 {"DodgerBlue" , RGB ( 30,144,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
931 {"deep sky blue" , RGB ( 0,191,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
932 {"DeepSkyBlue" , RGB ( 0,191,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
933 {"sky blue" , RGB (135,206,235)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
934 {"SkyBlue" , RGB (135,206,235)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
935 {"light sky blue" , RGB (135,206,250)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
936 {"LightSkyBlue" , RGB (135,206,250)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
937 {"steel blue" , RGB ( 70,130,180)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
938 {"SteelBlue" , RGB ( 70,130,180)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
939 {"light steel blue" , RGB (176,196,222)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
940 {"LightSteelBlue" , RGB (176,196,222)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
941 {"light blue" , RGB (173,216,230)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
942 {"LightBlue" , RGB (173,216,230)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
943 {"powder blue" , RGB (176,224,230)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
944 {"PowderBlue" , RGB (176,224,230)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
945 {"pale turquoise" , RGB (175,238,238)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
946 {"PaleTurquoise" , RGB (175,238,238)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
947 {"dark turquoise" , RGB ( 0,206,209)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
948 {"DarkTurquoise" , RGB ( 0,206,209)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
949 {"medium turquoise" , RGB ( 72,209,204)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
950 {"MediumTurquoise" , RGB ( 72,209,204)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
951 {"turquoise" , RGB ( 64,224,208)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
952 {"cyan" , RGB ( 0,255,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
953 {"light cyan" , RGB (224,255,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
954 {"LightCyan" , RGB (224,255,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
955 {"cadet blue" , RGB ( 95,158,160)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
956 {"CadetBlue" , RGB ( 95,158,160)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
957 {"medium aquamarine" , RGB (102,205,170)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
958 {"MediumAquamarine" , RGB (102,205,170)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
959 {"aquamarine" , RGB (127,255,212)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
960 {"dark green" , RGB ( 0,100, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
961 {"DarkGreen" , RGB ( 0,100, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
962 {"dark olive green" , RGB ( 85,107, 47)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
963 {"DarkOliveGreen" , RGB ( 85,107, 47)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
964 {"dark sea green" , RGB (143,188,143)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
965 {"DarkSeaGreen" , RGB (143,188,143)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
966 {"sea green" , RGB ( 46,139, 87)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
967 {"SeaGreen" , RGB ( 46,139, 87)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
968 {"medium sea green" , RGB ( 60,179,113)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
969 {"MediumSeaGreen" , RGB ( 60,179,113)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
970 {"light sea green" , RGB ( 32,178,170)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
971 {"LightSeaGreen" , RGB ( 32,178,170)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
972 {"pale green" , RGB (152,251,152)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
973 {"PaleGreen" , RGB (152,251,152)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
974 {"spring green" , RGB ( 0,255,127)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
975 {"SpringGreen" , RGB ( 0,255,127)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
976 {"lawn green" , RGB (124,252, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
977 {"LawnGreen" , RGB (124,252, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
978 {"green" , RGB ( 0,255, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
979 {"chartreuse" , RGB (127,255, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
980 {"medium spring green" , RGB ( 0,250,154)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
981 {"MediumSpringGreen" , RGB ( 0,250,154)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
982 {"green yellow" , RGB (173,255, 47)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
983 {"GreenYellow" , RGB (173,255, 47)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
984 {"lime green" , RGB ( 50,205, 50)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
985 {"LimeGreen" , RGB ( 50,205, 50)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
986 {"yellow green" , RGB (154,205, 50)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
987 {"YellowGreen" , RGB (154,205, 50)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
988 {"forest green" , RGB ( 34,139, 34)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
989 {"ForestGreen" , RGB ( 34,139, 34)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
990 {"olive drab" , RGB (107,142, 35)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
991 {"OliveDrab" , RGB (107,142, 35)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
992 {"dark khaki" , RGB (189,183,107)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
993 {"DarkKhaki" , RGB (189,183,107)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
994 {"khaki" , RGB (240,230,140)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
995 {"pale goldenrod" , RGB (238,232,170)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
996 {"PaleGoldenrod" , RGB (238,232,170)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
997 {"light goldenrod yellow" , RGB (250,250,210)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
998 {"LightGoldenrodYellow" , RGB (250,250,210)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
999 {"light yellow" , RGB (255,255,224)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1000 {"LightYellow" , RGB (255,255,224)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1001 {"yellow" , RGB (255,255, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1002 {"gold" , RGB (255,215, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1003 {"light goldenrod" , RGB (238,221,130)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1004 {"LightGoldenrod" , RGB (238,221,130)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1005 {"goldenrod" , RGB (218,165, 32)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1006 {"dark goldenrod" , RGB (184,134, 11)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1007 {"DarkGoldenrod" , RGB (184,134, 11)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1008 {"rosy brown" , RGB (188,143,143)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1009 {"RosyBrown" , RGB (188,143,143)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1010 {"indian red" , RGB (205, 92, 92)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1011 {"IndianRed" , RGB (205, 92, 92)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1012 {"saddle brown" , RGB (139, 69, 19)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1013 {"SaddleBrown" , RGB (139, 69, 19)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1014 {"sienna" , RGB (160, 82, 45)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1015 {"peru" , RGB (205,133, 63)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1016 {"burlywood" , RGB (222,184,135)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1017 {"beige" , RGB (245,245,220)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1018 {"wheat" , RGB (245,222,179)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1019 {"sandy brown" , RGB (244,164, 96)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1020 {"SandyBrown" , RGB (244,164, 96)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1021 {"tan" , RGB (210,180,140)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1022 {"chocolate" , RGB (210,105, 30)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1023 {"firebrick" , RGB (178,34, 34)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1024 {"brown" , RGB (165,42, 42)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1025 {"dark salmon" , RGB (233,150,122)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1026 {"DarkSalmon" , RGB (233,150,122)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1027 {"salmon" , RGB (250,128,114)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1028 {"light salmon" , RGB (255,160,122)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1029 {"LightSalmon" , RGB (255,160,122)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1030 {"orange" , RGB (255,165, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1031 {"dark orange" , RGB (255,140, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1032 {"DarkOrange" , RGB (255,140, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1033 {"coral" , RGB (255,127, 80)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1034 {"light coral" , RGB (240,128,128)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1035 {"LightCoral" , RGB (240,128,128)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1036 {"tomato" , RGB (255, 99, 71)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1037 {"orange red" , RGB (255, 69, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1038 {"OrangeRed" , RGB (255, 69, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1039 {"red" , RGB (255, 0, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1040 {"hot pink" , RGB (255,105,180)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1041 {"HotPink" , RGB (255,105,180)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1042 {"deep pink" , RGB (255, 20,147)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1043 {"DeepPink" , RGB (255, 20,147)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1044 {"pink" , RGB (255,192,203)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1045 {"light pink" , RGB (255,182,193)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1046 {"LightPink" , RGB (255,182,193)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1047 {"pale violet red" , RGB (219,112,147)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1048 {"PaleVioletRed" , RGB (219,112,147)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1049 {"maroon" , RGB (176, 48, 96)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1050 {"medium violet red" , RGB (199, 21,133)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1051 {"MediumVioletRed" , RGB (199, 21,133)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1052 {"violet red" , RGB (208, 32,144)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1053 {"VioletRed" , RGB (208, 32,144)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1054 {"magenta" , RGB (255, 0,255)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1055 {"violet" , RGB (238,130,238)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1056 {"plum" , RGB (221,160,221)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1057 {"orchid" , RGB (218,112,214)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1058 {"medium orchid" , RGB (186, 85,211)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1059 {"MediumOrchid" , RGB (186, 85,211)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1060 {"dark orchid" , RGB (153, 50,204)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1061 {"DarkOrchid" , RGB (153, 50,204)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1062 {"dark violet" , RGB (148, 0,211)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1063 {"DarkViolet" , RGB (148, 0,211)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1064 {"blue violet" , RGB (138, 43,226)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1065 {"BlueViolet" , RGB (138, 43,226)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1066 {"purple" , RGB (160, 32,240)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1067 {"medium purple" , RGB (147,112,219)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1068 {"MediumPurple" , RGB (147,112,219)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1069 {"thistle" , RGB (216,191,216)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1070 {"gray0" , RGB ( 0, 0, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1071 {"grey0" , RGB ( 0, 0, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1072 {"dark grey" , RGB (169,169,169)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1073 {"DarkGrey" , RGB (169,169,169)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1074 {"dark gray" , RGB (169,169,169)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1075 {"DarkGray" , RGB (169,169,169)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1076 {"dark blue" , RGB ( 0, 0,139)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1077 {"DarkBlue" , RGB ( 0, 0,139)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1078 {"dark cyan" , RGB ( 0,139,139)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1079 {"DarkCyan" , RGB ( 0,139,139)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1080 {"dark magenta" , RGB (139, 0,139)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1081 {"DarkMagenta" , RGB (139, 0,139)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1082 {"dark red" , RGB (139, 0, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1083 {"DarkRed" , RGB (139, 0, 0)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1084 {"light green" , RGB (144,238,144)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1085 {"LightGreen" , RGB (144,238,144)},
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1086 };
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1087
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1088 DEFUN ("win32-default-color-map", Fwin32_default_color_map, Swin32_default_color_map,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1089 0, 0, 0, "Return the default color map.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1090 ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1091 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1092 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1093 colormap_t *pc = win32_color_map;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1094 Lisp_Object cmap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1095
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1096 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1097
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1098 cmap = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1099
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1100 for (i = 0; i < sizeof (win32_color_map) / sizeof (win32_color_map[0]);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1101 pc++, i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1102 cmap = Fcons (Fcons (build_string (pc->name),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1103 make_number (pc->colorref)),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1104 cmap);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1105
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1106 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1107
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1108 return (cmap);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1109 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1110 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1111
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1112 Lisp_Object
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1113 win32_to_x_color (rgb)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1114 Lisp_Object rgb;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1115 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1116 Lisp_Object color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1117
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1118 CHECK_NUMBER (rgb, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1119
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1120 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1121
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1122 color = Frassq (rgb, Vwin32_color_map);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1123
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1124 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1125
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1126 if (!NILP (color))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1127 return (Fcar (color));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1128 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1129 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1130 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1131
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1132 COLORREF
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1133 x_to_win32_color (colorname)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1134 char * colorname;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1135 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1136 register Lisp_Object tail, ret = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1137
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1138 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1139
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1140 for (tail = Vwin32_color_map; !NILP (tail); tail = Fcdr (tail))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1141 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1142 register Lisp_Object elt, tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1143
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1144 elt = Fcar (tail);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1145 if (!CONSP (elt)) continue;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1146
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1147 tem = Fcar (elt);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1148
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1149 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1150 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1151 ret = XUINT(Fcdr (elt));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1152 break;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1153 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1154
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1155 QUIT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1156 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1157
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1158 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1159
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1160 return ret;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1161 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1162
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1163 /* Decide if color named COLOR is valid for the display associated with
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1164 the selected frame; if so, return the rgb values in COLOR_DEF.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1165 If ALLOC is nonzero, allocate a new colormap cell. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1166
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1167 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1168 defined_color (f, color, color_def, alloc)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1169 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1170 char *color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1171 COLORREF *color_def;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1172 int alloc;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1173 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1174 register Lisp_Object tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1175
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1176 tem = x_to_win32_color (color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1177
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1178 if (!NILP (tem))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1179 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1180 *color_def = XUINT (tem);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1181 return 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1182 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1183 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1184 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1185 return 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1186 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1187 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1188
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1189 /* Given a string ARG naming a color, compute a pixel value from it
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1190 suitable for screen F.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1191 If F is not a color screen, return DEF (default) regardless of what
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1192 ARG says. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1193
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1194 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1195 x_decode_color (f, arg, def)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1196 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1197 Lisp_Object arg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1198 int def;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1199 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1200 COLORREF cdef;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1201
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1202 CHECK_STRING (arg, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1203
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1204 if (strcmp (XSTRING (arg)->data, "black") == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1205 return BLACK_PIX_DEFAULT (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1206 else if (strcmp (XSTRING (arg)->data, "white") == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1207 return WHITE_PIX_DEFAULT (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1208
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1209 if ((FRAME_WIN32_DISPLAY_INFO (f)->n_planes * FRAME_WIN32_DISPLAY_INFO (f)->n_cbits) == 1)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1210 return def;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1211
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1212 /* defined_color is responsible for coping with failures
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1213 by looking for a near-miss. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1214 if (defined_color (f, XSTRING (arg)->data, &cdef, 1))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1215 return cdef;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1216
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1217 /* defined_color failed; return an ultimate default. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1218 return def;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1219 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1220
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1221 /* Functions called only from `x_set_frame_param'
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1222 to set individual parameters.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1223
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1224 If FRAME_WIN32_WINDOW (f) is 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1225 the frame is being created and its window does not exist yet.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1226 In that case, just record the parameter's new value
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1227 in the standard place; do not attempt to change the window. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1228
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1229 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1230 x_set_foreground_color (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1231 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1232 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1233 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1234 f->output_data.win32->foreground_pixel
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1235 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1236 if (FRAME_WIN32_WINDOW (f) != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1237 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1238 recompute_basic_faces (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1239 if (FRAME_VISIBLE_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1240 redraw_frame (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1241 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1242 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1243
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1244 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1245 x_set_background_color (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1246 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1247 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1248 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1249 Pixmap temp;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1250 int mask;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1251
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1252 f->output_data.win32->background_pixel
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1253 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1254
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1255 if (FRAME_WIN32_WINDOW (f) != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1256 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1257 SetWindowLong (FRAME_WIN32_WINDOW (f), WND_BACKGROUND_INDEX, f->output_data.win32->background_pixel);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1258
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1259 recompute_basic_faces (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1260
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1261 if (FRAME_VISIBLE_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1262 redraw_frame (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1263 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1264 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1265
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1266 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1267 x_set_mouse_color (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1268 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1269 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1270 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1271 #if 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1272 Cursor cursor, nontext_cursor, mode_cursor, cross_cursor;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1273 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1274 int mask_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1275
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1276 if (!EQ (Qnil, arg))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1277 f->output_data.win32->mouse_pixel
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1278 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1279 mask_color = f->output_data.win32->background_pixel;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1280 /* No invisible pointers. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1281 if (mask_color == f->output_data.win32->mouse_pixel
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1282 && mask_color == f->output_data.win32->background_pixel)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1283 f->output_data.win32->mouse_pixel = f->output_data.win32->foreground_pixel;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1284
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1285 #if 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1286 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1287
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1288 /* It's not okay to crash if the user selects a screwy cursor. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1289 x_catch_errors (FRAME_WIN32_DISPLAY (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1290
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1291 if (!EQ (Qnil, Vx_pointer_shape))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1292 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1293 CHECK_NUMBER (Vx_pointer_shape, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1294 cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XINT (Vx_pointer_shape));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1295 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1296 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1297 cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_xterm);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1298 x_check_errors (FRAME_WIN32_DISPLAY (f), "bad text pointer cursor: %s");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1299
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1300 if (!EQ (Qnil, Vx_nontext_pointer_shape))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1301 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1302 CHECK_NUMBER (Vx_nontext_pointer_shape, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1303 nontext_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1304 XINT (Vx_nontext_pointer_shape));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1305 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1306 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1307 nontext_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_left_ptr);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1308 x_check_errors (FRAME_WIN32_DISPLAY (f), "bad nontext pointer cursor: %s");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1309
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1310 if (!EQ (Qnil, Vx_mode_pointer_shape))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1311 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1312 CHECK_NUMBER (Vx_mode_pointer_shape, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1313 mode_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1314 XINT (Vx_mode_pointer_shape));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1315 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1316 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1317 mode_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_xterm);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1318 x_check_errors (FRAME_WIN32_DISPLAY (f), "bad modeline pointer cursor: %s");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1319
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1320 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1321 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1322 CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1323 cross_cursor
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1324 = XCreateFontCursor (FRAME_WIN32_DISPLAY (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1325 XINT (Vx_sensitive_text_pointer_shape));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1326 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1327 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1328 cross_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_crosshair);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1329
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1330 /* Check and report errors with the above calls. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1331 x_check_errors (FRAME_WIN32_DISPLAY (f), "can't set cursor shape: %s");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1332 x_uncatch_errors (FRAME_WIN32_DISPLAY (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1333
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1334 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1335 XColor fore_color, back_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1336
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1337 fore_color.pixel = f->output_data.win32->mouse_pixel;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1338 back_color.pixel = mask_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1339 XQueryColor (FRAME_WIN32_DISPLAY (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1340 DefaultColormap (FRAME_WIN32_DISPLAY (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1341 DefaultScreen (FRAME_WIN32_DISPLAY (f))),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1342 &fore_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1343 XQueryColor (FRAME_WIN32_DISPLAY (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1344 DefaultColormap (FRAME_WIN32_DISPLAY (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1345 DefaultScreen (FRAME_WIN32_DISPLAY (f))),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1346 &back_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1347 XRecolorCursor (FRAME_WIN32_DISPLAY (f), cursor,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1348 &fore_color, &back_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1349 XRecolorCursor (FRAME_WIN32_DISPLAY (f), nontext_cursor,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1350 &fore_color, &back_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1351 XRecolorCursor (FRAME_WIN32_DISPLAY (f), mode_cursor,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1352 &fore_color, &back_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1353 XRecolorCursor (FRAME_WIN32_DISPLAY (f), cross_cursor,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1354 &fore_color, &back_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1355 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1356
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1357 if (FRAME_WIN32_WINDOW (f) != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1358 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1359 XDefineCursor (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f), cursor);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1360 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1361
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1362 if (cursor != f->output_data.win32->text_cursor && f->output_data.win32->text_cursor != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1363 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->text_cursor);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1364 f->output_data.win32->text_cursor = cursor;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1365
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1366 if (nontext_cursor != f->output_data.win32->nontext_cursor
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1367 && f->output_data.win32->nontext_cursor != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1368 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->nontext_cursor);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1369 f->output_data.win32->nontext_cursor = nontext_cursor;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1370
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1371 if (mode_cursor != f->output_data.win32->modeline_cursor
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1372 && f->output_data.win32->modeline_cursor != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1373 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->modeline_cursor);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1374 f->output_data.win32->modeline_cursor = mode_cursor;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1375 if (cross_cursor != f->output_data.win32->cross_cursor
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1376 && f->output_data.win32->cross_cursor != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1377 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->cross_cursor);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1378 f->output_data.win32->cross_cursor = cross_cursor;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1379
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1380 XFlush (FRAME_WIN32_DISPLAY (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1381 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1382 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1383 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1384
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1385 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1386 x_set_cursor_color (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1387 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1388 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1389 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1390 unsigned long fore_pixel;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1391
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1392 if (!EQ (Vx_cursor_fore_pixel, Qnil))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1393 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1394 WHITE_PIX_DEFAULT (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1395 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1396 fore_pixel = f->output_data.win32->background_pixel;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1397 f->output_data.win32->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1398
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1399 /* Make sure that the cursor color differs from the background color. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1400 if (f->output_data.win32->cursor_pixel == f->output_data.win32->background_pixel)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1401 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1402 f->output_data.win32->cursor_pixel = f->output_data.win32->mouse_pixel;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1403 if (f->output_data.win32->cursor_pixel == fore_pixel)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1404 fore_pixel = f->output_data.win32->background_pixel;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1405 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1406 f->output_data.win32->cursor_foreground_pixel = fore_pixel;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1407
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1408 if (FRAME_WIN32_WINDOW (f) != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1409 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1410 if (FRAME_VISIBLE_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1411 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1412 x_display_cursor (f, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1413 x_display_cursor (f, 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1414 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1415 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1416 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1417
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1418 /* Set the border-color of frame F to value described by ARG.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1419 ARG can be a string naming a color.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1420 The border-color is used for the border that is drawn by the server.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1421 Note that this does not fully take effect if done before
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1422 F has a window; it must be redone when the window is created. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1423
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1424 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1425 x_set_border_color (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1426 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1427 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1428 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1429 unsigned char *str;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1430 int pix;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1431
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1432 CHECK_STRING (arg, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1433 str = XSTRING (arg)->data;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1434
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1435 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1436
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1437 x_set_border_pixel (f, pix);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1438 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1439
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1440 /* Set the border-color of frame F to pixel value PIX.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1441 Note that this does not fully take effect if done before
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1442 F has an window. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1443
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1444 x_set_border_pixel (f, pix)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1445 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1446 int pix;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1447 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1448 f->output_data.win32->border_pixel = pix;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1449
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1450 if (FRAME_WIN32_WINDOW (f) != 0 && f->output_data.win32->border_width > 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1451 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1452 if (FRAME_VISIBLE_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1453 redraw_frame (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1454 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1455 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1456
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1457 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1458 x_set_cursor_type (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1459 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1460 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1461 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1462 if (EQ (arg, Qbar))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1463 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1464 FRAME_DESIRED_CURSOR (f) = bar_cursor;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1465 f->output_data.win32->cursor_width = 2;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1466 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1467 else if (CONSP (arg) && EQ (XCONS (arg)->car, Qbar)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1468 && INTEGERP (XCONS (arg)->cdr))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1469 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1470 FRAME_DESIRED_CURSOR (f) = bar_cursor;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1471 f->output_data.win32->cursor_width = XINT (XCONS (arg)->cdr);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1472 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1473 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1474 /* Treat anything unknown as "box cursor".
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1475 It was bad to signal an error; people have trouble fixing
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1476 .Xdefaults with Emacs, when it has something bad in it. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1477 FRAME_DESIRED_CURSOR (f) = filled_box_cursor;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1478
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1479 /* Make sure the cursor gets redrawn. This is overkill, but how
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1480 often do people change cursor types? */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1481 update_mode_lines++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1482 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1483
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1484 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1485 x_set_icon_type (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1486 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1487 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1488 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1489 #if 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1490 Lisp_Object tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1491 int result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1492
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1493 if (STRINGP (arg))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1494 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1495 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1496 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1497 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1498 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1499 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1500
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1501 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1502 if (NILP (arg))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1503 result = x_text_icon (f,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1504 (char *) XSTRING ((!NILP (f->icon_name)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1505 ? f->icon_name
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1506 : f->name))->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1507 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1508 result = x_bitmap_icon (f, arg);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1509
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1510 if (result)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1511 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1512 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1513 error ("No icon window available");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1514 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1515
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1516 /* If the window was unmapped (and its icon was mapped),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1517 the new icon is not mapped, so map the window in its stead. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1518 if (FRAME_VISIBLE_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1519 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1520 #ifdef USE_X_TOOLKIT
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1521 XtPopup (f->output_data.win32->widget, XtGrabNone);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1522 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1523 XMapWindow (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1524 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1525
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1526 XFlush (FRAME_WIN32_DISPLAY (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1527 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1528 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1529 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1530
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1531 /* Return non-nil if frame F wants a bitmap icon. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1532
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1533 Lisp_Object
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1534 x_icon_type (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1535 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1536 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1537 Lisp_Object tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1538
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1539 tem = assq_no_quit (Qicon_type, f->param_alist);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1540 if (CONSP (tem))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1541 return XCONS (tem)->cdr;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1542 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1543 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1544 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1545
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1546 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1547 x_set_icon_name (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1548 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1549 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1550 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1551 Lisp_Object tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1552 int result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1553
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1554 if (STRINGP (arg))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1555 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1556 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1557 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1558 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1559 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1560 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1561
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1562 f->icon_name = arg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1563
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1564 #if 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1565 if (f->output_data.win32->icon_bitmap != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1566 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1567
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1568 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1569
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1570 result = x_text_icon (f,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1571 (char *) XSTRING ((!NILP (f->icon_name)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1572 ? f->icon_name
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1573 : f->name))->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1574
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1575 if (result)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1576 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1577 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1578 error ("No icon window available");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1579 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1580
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1581 /* If the window was unmapped (and its icon was mapped),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1582 the new icon is not mapped, so map the window in its stead. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1583 if (FRAME_VISIBLE_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1584 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1585 #ifdef USE_X_TOOLKIT
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1586 XtPopup (f->output_data.win32->widget, XtGrabNone);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1587 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1588 XMapWindow (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1589 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1590
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1591 XFlush (FRAME_WIN32_DISPLAY (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1592 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1593 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1594 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1595
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1596 extern Lisp_Object x_new_font ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1597
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1598 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1599 x_set_font (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1600 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1601 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1602 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1603 Lisp_Object result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1604
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1605 CHECK_STRING (arg, 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1606
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1607 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1608 result = x_new_font (f, XSTRING (arg)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1609 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1610
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1611 if (EQ (result, Qnil))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1612 error ("Font \"%s\" is not defined", XSTRING (arg)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1613 else if (EQ (result, Qt))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1614 error ("the characters of the given font have varying widths");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1615 else if (STRINGP (result))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1616 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1617 recompute_basic_faces (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1618 store_frame_param (f, Qfont, result);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1619 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1620 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1621 abort ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1622 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1623
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1624 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1625 x_set_border_width (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1626 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1627 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1628 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1629 CHECK_NUMBER (arg, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1630
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1631 if (XINT (arg) == f->output_data.win32->border_width)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1632 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1633
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1634 if (FRAME_WIN32_WINDOW (f) != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1635 error ("Cannot change the border width of a window");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1636
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1637 f->output_data.win32->border_width = XINT (arg);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1638 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1639
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1640 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1641 x_set_internal_border_width (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1642 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1643 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1644 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1645 int mask;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1646 int old = f->output_data.win32->internal_border_width;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1647
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1648 CHECK_NUMBER (arg, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1649 f->output_data.win32->internal_border_width = XINT (arg);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1650 if (f->output_data.win32->internal_border_width < 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1651 f->output_data.win32->internal_border_width = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1652
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1653 if (f->output_data.win32->internal_border_width == old)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1654 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1655
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1656 if (FRAME_WIN32_WINDOW (f) != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1657 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1658 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1659 x_set_window_size (f, 0, f->width, f->height);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1660 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1661 SET_FRAME_GARBAGED (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1662 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1663 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1664
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1665 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1666 x_set_visibility (f, value, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1667 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1668 Lisp_Object value, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1669 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1670 Lisp_Object frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1671 XSETFRAME (frame, f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1672
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1673 if (NILP (value))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1674 Fmake_frame_invisible (frame, Qt);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1675 else if (EQ (value, Qicon))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1676 Ficonify_frame (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1677 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1678 Fmake_frame_visible (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1679 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1680
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1681 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1682 x_set_menu_bar_lines (f, value, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1683 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1684 Lisp_Object value, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1685 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1686 int nlines;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1687 int olines = FRAME_MENU_BAR_LINES (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1688
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1689 /* Right now, menu bars don't work properly in minibuf-only frames;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1690 most of the commands try to apply themselves to the minibuffer
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1691 frame itslef, and get an error because you can't switch buffers
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1692 in or split the minibuffer window. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1693 if (FRAME_MINIBUF_ONLY_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1694 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1695
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1696 if (INTEGERP (value))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1697 nlines = XINT (value);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1698 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1699 nlines = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1700
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1701 FRAME_MENU_BAR_LINES (f) = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1702 if (nlines)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1703 FRAME_EXTERNAL_MENU_BAR (f) = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1704 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1705 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1706 if (FRAME_EXTERNAL_MENU_BAR (f) == 1)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1707 free_frame_menubar (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1708 FRAME_EXTERNAL_MENU_BAR (f) = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1709 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1710 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1711
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1712 /* Change the name of frame F to NAME. If NAME is nil, set F's name to
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1713 win32_id_name.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1714
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1715 If EXPLICIT is non-zero, that indicates that lisp code is setting the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1716 name; if NAME is a string, set F's name to NAME and set
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1717 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1718
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1719 If EXPLICIT is zero, that indicates that Emacs redisplay code is
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1720 suggesting a new name, which lisp code should override; if
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1721 F->explicit_name is set, ignore the new name; otherwise, set it. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1722
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1723 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1724 x_set_name (f, name, explicit)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1725 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1726 Lisp_Object name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1727 int explicit;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1728 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1729 /* Make sure that requests from lisp code override requests from
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1730 Emacs redisplay code. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1731 if (explicit)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1732 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1733 /* If we're switching from explicit to implicit, we had better
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1734 update the mode lines and thereby update the title. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1735 if (f->explicit_name && NILP (name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1736 update_mode_lines = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1737
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1738 f->explicit_name = ! NILP (name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1739 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1740 else if (f->explicit_name)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1741 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1742
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1743 /* If NAME is nil, set the name to the win32_id_name. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1744 if (NILP (name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1745 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1746 /* Check for no change needed in this very common case
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1747 before we do any consing. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1748 if (!strcmp (FRAME_WIN32_DISPLAY_INFO (f)->win32_id_name,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1749 XSTRING (f->name)->data))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1750 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1751 name = build_string (FRAME_WIN32_DISPLAY_INFO (f)->win32_id_name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1752 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1753 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1754 CHECK_STRING (name, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1755
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1756 /* Don't change the name if it's already NAME. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1757 if (! NILP (Fstring_equal (name, f->name)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1758 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1759
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1760 if (FRAME_WIN32_WINDOW (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1761 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1762 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1763 SetWindowText(FRAME_WIN32_WINDOW (f), XSTRING (name)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1764 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1765 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1766
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1767 f->name = name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1768 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1769
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1770 /* This function should be called when the user's lisp code has
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1771 specified a name for the frame; the name will override any set by the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1772 redisplay code. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1773 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1774 x_explicitly_set_name (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1775 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1776 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1777 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1778 x_set_name (f, arg, 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1779 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1780
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1781 /* This function should be called by Emacs redisplay code to set the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1782 name; names set this way will never override names set by the user's
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1783 lisp code. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1784 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1785 x_implicitly_set_name (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1786 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1787 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1788 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1789 x_set_name (f, arg, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1790 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1791
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1792 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1793 x_set_autoraise (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1794 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1795 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1796 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1797 f->auto_raise = !EQ (Qnil, arg);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1798 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1799
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1800 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1801 x_set_autolower (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1802 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1803 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1804 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1805 f->auto_lower = !EQ (Qnil, arg);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1806 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1807
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1808 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1809 x_set_unsplittable (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1810 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1811 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1812 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1813 f->no_split = !NILP (arg);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1814 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1815
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1816 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1817 x_set_vertical_scroll_bars (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1818 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1819 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1820 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1821 if (NILP (arg) != ! FRAME_HAS_VERTICAL_SCROLL_BARS (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1822 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1823 FRAME_HAS_VERTICAL_SCROLL_BARS (f) = ! NILP (arg);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1824
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1825 /* We set this parameter before creating the window for the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1826 frame, so we can get the geometry right from the start.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1827 However, if the window hasn't been created yet, we shouldn't
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1828 call x_set_window_size. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1829 if (FRAME_WIN32_WINDOW (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1830 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1831 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1832 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1833
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1834 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1835 x_set_scroll_bar_width (f, arg, oldval)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1836 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1837 Lisp_Object arg, oldval;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1838 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1839 if (NILP (arg))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1840 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1841 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1842 FRAME_SCROLL_BAR_COLS (f) = 2;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1843 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1844 else if (INTEGERP (arg) && XINT (arg) > 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1845 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1846 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1847 int wid = FONT_WIDTH (f->output_data.win32->font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1848 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1849 FRAME_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1850 if (FRAME_WIN32_WINDOW (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1851 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1852 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1853 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1854
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1855 /* Subroutines of creating an frame. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1856
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1857 /* Make sure that Vx_resource_name is set to a reasonable value.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1858 Fix it up, or set it to `emacs' if it is too hopeless. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1859
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1860 static void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1861 validate_x_resource_name ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1862 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1863 int len;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1864 /* Number of valid characters in the resource name. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1865 int good_count = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1866 /* Number of invalid characters in the resource name. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1867 int bad_count = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1868 Lisp_Object new;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1869 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1870
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1871 if (STRINGP (Vx_resource_name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1872 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1873 unsigned char *p = XSTRING (Vx_resource_name)->data;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1874 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1875
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1876 len = XSTRING (Vx_resource_name)->size;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1877
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1878 /* Only letters, digits, - and _ are valid in resource names.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1879 Count the valid characters and count the invalid ones. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1880 for (i = 0; i < len; i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1881 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1882 int c = p[i];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1883 if (! ((c >= 'a' && c <= 'z')
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1884 || (c >= 'A' && c <= 'Z')
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1885 || (c >= '0' && c <= '9')
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1886 || c == '-' || c == '_'))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1887 bad_count++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1888 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1889 good_count++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1890 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1891 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1892 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1893 /* Not a string => completely invalid. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1894 bad_count = 5, good_count = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1895
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1896 /* If name is valid already, return. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1897 if (bad_count == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1898 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1899
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1900 /* If name is entirely invalid, or nearly so, use `emacs'. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1901 if (good_count == 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1902 || (good_count == 1 && bad_count > 0))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1903 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1904 Vx_resource_name = build_string ("emacs");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1905 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1906 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1907
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1908 /* Name is partly valid. Copy it and replace the invalid characters
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1909 with underscores. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1910
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1911 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1912
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1913 for (i = 0; i < len; i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1914 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1915 int c = XSTRING (new)->data[i];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1916 if (! ((c >= 'a' && c <= 'z')
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1917 || (c >= 'A' && c <= 'Z')
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1918 || (c >= '0' && c <= '9')
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1919 || c == '-' || c == '_'))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1920 XSTRING (new)->data[i] = '_';
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1921 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1922 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1923
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1924
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1925 extern char *x_get_string_resource ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1926
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1927 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1928 "Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1929 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1930 class, where INSTANCE is the name under which Emacs was invoked, or\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1931 the name specified by the `-name' or `-rn' command-line arguments.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1932 \n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1933 The optional arguments COMPONENT and SUBCLASS add to the key and the\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1934 class, respectively. You must specify both of them or neither.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1935 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1936 and the class is `Emacs.CLASS.SUBCLASS'.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1937 (attribute, class, component, subclass)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1938 Lisp_Object attribute, class, component, subclass;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1939 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1940 register char *value;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1941 char *name_key;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1942 char *class_key;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1943
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1944 CHECK_STRING (attribute, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1945 CHECK_STRING (class, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1946
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1947 if (!NILP (component))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1948 CHECK_STRING (component, 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1949 if (!NILP (subclass))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1950 CHECK_STRING (subclass, 2);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1951 if (NILP (component) != NILP (subclass))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1952 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1953
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1954 validate_x_resource_name ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1955
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1956 /* Allocate space for the components, the dots which separate them,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1957 and the final '\0'. Make them big enough for the worst case. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1958 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1959 + (STRINGP (component)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1960 ? XSTRING (component)->size : 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1961 + XSTRING (attribute)->size
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1962 + 3);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1963
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1964 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1965 + XSTRING (class)->size
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1966 + (STRINGP (subclass)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1967 ? XSTRING (subclass)->size : 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1968 + 3);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1969
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1970 /* Start with emacs.FRAMENAME for the name (the specific one)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1971 and with `Emacs' for the class key (the general one). */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1972 strcpy (name_key, XSTRING (Vx_resource_name)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1973 strcpy (class_key, EMACS_CLASS);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1974
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1975 strcat (class_key, ".");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1976 strcat (class_key, XSTRING (class)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1977
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1978 if (!NILP (component))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1979 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1980 strcat (class_key, ".");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1981 strcat (class_key, XSTRING (subclass)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1982
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1983 strcat (name_key, ".");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1984 strcat (name_key, XSTRING (component)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1985 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1986
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1987 strcat (name_key, ".");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1988 strcat (name_key, XSTRING (attribute)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1989
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1990 value = x_get_string_resource (Qnil,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1991 name_key, class_key);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1992
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1993 if (value != (char *) 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1994 return build_string (value);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1995 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1996 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1997 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1998
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1999 /* Used when C code wants a resource value. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2000
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2001 char *
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2002 x_get_resource_string (attribute, class)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2003 char *attribute, *class;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2004 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2005 register char *value;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2006 char *name_key;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2007 char *class_key;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2008
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2009 /* Allocate space for the components, the dots which separate them,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2010 and the final '\0'. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2011 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2012 + strlen (attribute) + 2);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2013 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2014 + strlen (class) + 2);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2015
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2016 sprintf (name_key, "%s.%s",
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2017 XSTRING (Vinvocation_name)->data,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2018 attribute);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2019 sprintf (class_key, "%s.%s", EMACS_CLASS, class);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2020
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2021 return x_get_string_resource (selected_frame,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2022 name_key, class_key);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2023 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2024
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2025 /* Types we might convert a resource string into. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2026 enum resource_types
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2027 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2028 number, boolean, string, symbol
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2029 };
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2030
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2031 /* Return the value of parameter PARAM.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2032
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2033 First search ALIST, then Vdefault_frame_alist, then the X defaults
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2034 database, using ATTRIBUTE as the attribute name and CLASS as its class.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2035
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2036 Convert the resource to the type specified by desired_type.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2037
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2038 If no default is specified, return Qunbound. If you call
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2039 x_get_arg, make sure you deal with Qunbound in a reasonable way,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2040 and don't let it get stored in any Lisp-visible variables! */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2041
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2042 static Lisp_Object
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2043 x_get_arg (alist, param, attribute, class, type)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2044 Lisp_Object alist, param;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2045 char *attribute;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2046 char *class;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2047 enum resource_types type;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2048 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2049 register Lisp_Object tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2050
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2051 tem = Fassq (param, alist);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2052 if (EQ (tem, Qnil))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2053 tem = Fassq (param, Vdefault_frame_alist);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2054 if (EQ (tem, Qnil))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2055 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2056
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2057 if (attribute)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2058 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2059 tem = Fx_get_resource (build_string (attribute),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2060 build_string (class),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2061 Qnil, Qnil);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2062
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2063 if (NILP (tem))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2064 return Qunbound;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2065
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2066 switch (type)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2067 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2068 case number:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2069 return make_number (atoi (XSTRING (tem)->data));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2070
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2071 case boolean:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2072 tem = Fdowncase (tem);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2073 if (!strcmp (XSTRING (tem)->data, "on")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2074 || !strcmp (XSTRING (tem)->data, "true"))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2075 return Qt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2076 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2077 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2078
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2079 case string:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2080 return tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2081
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2082 case symbol:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2083 /* As a special case, we map the values `true' and `on'
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2084 to Qt, and `false' and `off' to Qnil. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2085 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2086 Lisp_Object lower;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2087 lower = Fdowncase (tem);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2088 if (!strcmp (XSTRING (lower)->data, "on")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2089 || !strcmp (XSTRING (lower)->data, "true"))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2090 return Qt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2091 else if (!strcmp (XSTRING (lower)->data, "off")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2092 || !strcmp (XSTRING (lower)->data, "false"))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2093 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2094 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2095 return Fintern (tem, Qnil);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2096 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2097
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2098 default:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2099 abort ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2100 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2101 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2102 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2103 return Qunbound;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2104 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2105 return Fcdr (tem);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2106 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2107
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2108 /* Record in frame F the specified or default value according to ALIST
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2109 of the parameter named PARAM (a Lisp symbol).
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2110 If no value is specified for PARAM, look for an X default for XPROP
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2111 on the frame named NAME.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2112 If that is not found either, use the value DEFLT. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2113
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2114 static Lisp_Object
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2115 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2116 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2117 Lisp_Object alist;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2118 Lisp_Object prop;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2119 Lisp_Object deflt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2120 char *xprop;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2121 char *xclass;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2122 enum resource_types type;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2123 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2124 Lisp_Object tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2125
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2126 tem = x_get_arg (alist, prop, xprop, xclass, type);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2127 if (EQ (tem, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2128 tem = deflt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2129 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2130 return tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2131 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2132
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2133 DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2134 "Parse an X-style geometry string STRING.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2135 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2136 The properties returned may include `top', `left', `height', and `width'.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2137 The value of `left' or `top' may be an integer,\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2138 or a list (+ N) meaning N pixels relative to top/left corner,\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2139 or a list (- N) meaning -N pixels relative to bottom/right corner.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2140 (string)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2141 Lisp_Object string;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2142 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2143 int geometry, x, y;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2144 unsigned int width, height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2145 Lisp_Object result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2146
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2147 CHECK_STRING (string, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2148
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2149 geometry = XParseGeometry ((char *) XSTRING (string)->data,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2150 &x, &y, &width, &height);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2151
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2152 result = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2153 if (geometry & XValue)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2154 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2155 Lisp_Object element;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2156
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2157 if (x >= 0 && (geometry & XNegative))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2158 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2159 else if (x < 0 && ! (geometry & XNegative))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2160 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2161 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2162 element = Fcons (Qleft, make_number (x));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2163 result = Fcons (element, result);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2164 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2165
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2166 if (geometry & YValue)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2167 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2168 Lisp_Object element;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2169
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2170 if (y >= 0 && (geometry & YNegative))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2171 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2172 else if (y < 0 && ! (geometry & YNegative))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2173 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2174 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2175 element = Fcons (Qtop, make_number (y));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2176 result = Fcons (element, result);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2177 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2178
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2179 if (geometry & WidthValue)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2180 result = Fcons (Fcons (Qwidth, make_number (width)), result);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2181 if (geometry & HeightValue)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2182 result = Fcons (Fcons (Qheight, make_number (height)), result);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2183
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2184 return result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2185 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2186
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2187 /* Calculate the desired size and position of this window,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2188 and return the flags saying which aspects were specified.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2189
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2190 This function does not make the coordinates positive. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2191
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2192 #define DEFAULT_ROWS 40
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2193 #define DEFAULT_COLS 80
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2194
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2195 static int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2196 x_figure_window_size (f, parms)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2197 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2198 Lisp_Object parms;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2199 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2200 register Lisp_Object tem0, tem1, tem2;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2201 int height, width, left, top;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2202 register int geometry;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2203 long window_prompting = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2204
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2205 /* Default values if we fall through.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2206 Actually, if that happens we should get
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2207 window manager prompting. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2208 f->width = DEFAULT_COLS;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2209 f->height = DEFAULT_ROWS;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2210 /* Window managers expect that if program-specified
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2211 positions are not (0,0), they're intentional, not defaults. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2212 f->output_data.win32->top_pos = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2213 f->output_data.win32->left_pos = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2214
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2215 tem0 = x_get_arg (parms, Qheight, 0, 0, number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2216 tem1 = x_get_arg (parms, Qwidth, 0, 0, number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2217 tem2 = x_get_arg (parms, Quser_size, 0, 0, number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2218 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2219 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2220 if (!EQ (tem0, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2221 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2222 CHECK_NUMBER (tem0, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2223 f->height = XINT (tem0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2224 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2225 if (!EQ (tem1, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2226 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2227 CHECK_NUMBER (tem1, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2228 f->width = XINT (tem1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2229 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2230 if (!NILP (tem2) && !EQ (tem2, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2231 window_prompting |= USSize;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2232 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2233 window_prompting |= PSize;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2234 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2235
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2236 f->output_data.win32->vertical_scroll_bar_extra
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2237 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2238 ? 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2239 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2240 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2241 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.win32->font)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2242 f->output_data.win32->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2243 f->output_data.win32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2244
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2245 tem0 = x_get_arg (parms, Qtop, 0, 0, number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2246 tem1 = x_get_arg (parms, Qleft, 0, 0, number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2247 tem2 = x_get_arg (parms, Quser_position, 0, 0, number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2248 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2249 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2250 if (EQ (tem0, Qminus))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2251 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2252 f->output_data.win32->top_pos = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2253 window_prompting |= YNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2254 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2255 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qminus)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2256 && CONSP (XCONS (tem0)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2257 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2258 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2259 f->output_data.win32->top_pos = - XINT (XCONS (XCONS (tem0)->cdr)->car);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2260 window_prompting |= YNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2261 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2262 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qplus)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2263 && CONSP (XCONS (tem0)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2264 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2265 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2266 f->output_data.win32->top_pos = XINT (XCONS (XCONS (tem0)->cdr)->car);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2267 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2268 else if (EQ (tem0, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2269 f->output_data.win32->top_pos = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2270 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2271 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2272 CHECK_NUMBER (tem0, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2273 f->output_data.win32->top_pos = XINT (tem0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2274 if (f->output_data.win32->top_pos < 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2275 window_prompting |= YNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2276 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2277
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2278 if (EQ (tem1, Qminus))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2279 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2280 f->output_data.win32->left_pos = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2281 window_prompting |= XNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2282 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2283 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qminus)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2284 && CONSP (XCONS (tem1)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2285 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2286 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2287 f->output_data.win32->left_pos = - XINT (XCONS (XCONS (tem1)->cdr)->car);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2288 window_prompting |= XNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2289 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2290 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qplus)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2291 && CONSP (XCONS (tem1)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2292 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2293 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2294 f->output_data.win32->left_pos = XINT (XCONS (XCONS (tem1)->cdr)->car);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2295 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2296 else if (EQ (tem1, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2297 f->output_data.win32->left_pos = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2298 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2299 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2300 CHECK_NUMBER (tem1, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2301 f->output_data.win32->left_pos = XINT (tem1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2302 if (f->output_data.win32->left_pos < 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2303 window_prompting |= XNegative;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2304 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2305
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2306 if (!NILP (tem2) && ! EQ (tem2, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2307 window_prompting |= USPosition;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2308 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2309 window_prompting |= PPosition;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2310 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2311
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2312 return window_prompting;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2313 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2314
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2315
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2316
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2317 extern LRESULT CALLBACK win32_wnd_proc ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2318
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2319 BOOL
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2320 win32_init_class (hinst)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2321 HINSTANCE hinst;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2322 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2323 WNDCLASS wc;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2324
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2325 wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2326 wc.lpfnWndProc = (WNDPROC) win32_wnd_proc;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2327 wc.cbClsExtra = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2328 wc.cbWndExtra = WND_EXTRA_BYTES;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2329 wc.hInstance = hinst;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2330 wc.hIcon = LoadIcon (hinst, EMACS_CLASS);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2331 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2332 wc.hbrBackground = NULL; // GetStockObject (WHITE_BRUSH);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2333 wc.lpszMenuName = NULL;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2334 wc.lpszClassName = EMACS_CLASS;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2335
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2336 return (RegisterClass (&wc));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2337 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2338
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2339 HWND
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2340 win32_createscrollbar (f, bar)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2341 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2342 struct scroll_bar * bar;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2343 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2344 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2345 /* Position and size of scroll bar. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2346 XINT(bar->left), XINT(bar->top),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2347 XINT(bar->width), XINT(bar->height),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2348 FRAME_WIN32_WINDOW (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2349 NULL,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2350 hinst,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2351 NULL));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2352 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2353
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2354 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2355 win32_createwindow (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2356 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2357 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2358 HWND hwnd;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2359
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2360 /* Do first time app init */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2361
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2362 if (!hprevinst)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2363 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2364 win32_init_class (hinst);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2365 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2366
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2367 FRAME_WIN32_WINDOW (f) = hwnd = CreateWindow (EMACS_CLASS,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2368 f->namebuf,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2369 f->output_data.win32->dwStyle | WS_CLIPCHILDREN,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2370 f->output_data.win32->left_pos,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2371 f->output_data.win32->top_pos,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2372 PIXEL_WIDTH (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2373 PIXEL_HEIGHT (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2374 NULL,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2375 NULL,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2376 hinst,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2377 NULL);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2378
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2379 if (hwnd)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2380 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2381 SetWindowLong (hwnd, WND_X_UNITS_INDEX, FONT_WIDTH (f->output_data.win32->font));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2382 SetWindowLong (hwnd, WND_Y_UNITS_INDEX, f->output_data.win32->line_height);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2383 SetWindowLong (hwnd, WND_BACKGROUND_INDEX, f->output_data.win32->background_pixel);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2384 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2385 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2386
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2387 DWORD
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2388 win_msg_worker (dw)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2389 DWORD dw;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2390 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2391 MSG msg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2392
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2393 /* Ensure our message queue is created */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2394
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2395 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2396
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2397 PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2398
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2399 while (GetMessage (&msg, NULL, 0, 0))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2400 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2401 if (msg.hwnd == NULL)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2402 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2403 switch (msg.message)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2404 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2405 case WM_EMACS_CREATEWINDOW:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2406 win32_createwindow ((struct frame *) msg.wParam);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2407 PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2408 break;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2409 case WM_EMACS_CREATESCROLLBAR:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2410 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2411 HWND hwnd = win32_createscrollbar ((struct frame *) msg.wParam,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2412 (struct scroll_bar *) msg.lParam);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2413 PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, (WPARAM)hwnd, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2414 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2415 break;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2416 case WM_EMACS_KILL:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2417 return (0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2418 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2419 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2420 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2421 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2422 DispatchMessage (&msg);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2423 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2424 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2425
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2426 return (0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2427 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2428
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2429 HDC
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2430 map_mode (hdc)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2431 HDC hdc;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2432 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2433 if (hdc)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2434 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2435 #if 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2436 /* Make mapping mode be in 1/20 of point */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2437
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2438 SetMapMode (hdc, MM_ANISOTROPIC);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2439 SetWindowExtEx (hdc, 1440, 1440, NULL);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2440 SetViewportExtEx (hdc,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2441 GetDeviceCaps (hdc, LOGPIXELSX),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2442 GetDeviceCaps (hdc, LOGPIXELSY),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2443 NULL);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2444 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2445 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2446 return (hdc);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2447 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2448
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2449 /* Convert between the modifier bits Win32 uses and the modifier bits
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2450 Emacs uses. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2451 unsigned int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2452 win32_get_modifiers ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2453 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2454 return (((GetKeyState (VK_SHIFT)&0x8000) ? shift_modifier : 0) |
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2455 ((GetKeyState (VK_CONTROL)&0x8000) ? ctrl_modifier : 0) |
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2456 ((GetKeyState (VK_MENU)&0x8000) ? meta_modifier : 0));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2457 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2458
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2459 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2460 my_post_msg (wmsg, hwnd, msg, wParam, lParam)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2461 Win32Msg * wmsg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2462 HWND hwnd;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2463 UINT msg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2464 WPARAM wParam;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2465 LPARAM lParam;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2466 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2467 wmsg->msg.hwnd = hwnd;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2468 wmsg->msg.message = msg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2469 wmsg->msg.wParam = wParam;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2470 wmsg->msg.lParam = lParam;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2471 wmsg->msg.time = GetMessageTime ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2472
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2473 post_msg (wmsg);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2474 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2475
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2476 /* Main window procedure */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2477
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2478 extern char *lispy_function_keys[];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2479
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2480 LRESULT CALLBACK
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2481 win32_wnd_proc (hwnd, msg, wParam, lParam)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2482 HWND hwnd;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2483 UINT msg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2484 WPARAM wParam;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2485 LPARAM lParam;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2486 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2487 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2488 LRESULT ret = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2489 struct win32_display_info *dpyinfo = &one_win32_display_info;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2490 Win32Msg wmsg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2491
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2492 switch (msg)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2493 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2494 case WM_ERASEBKGND:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2495 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2496 HBRUSH hb;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2497 HANDLE oldobj;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2498 RECT rect;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2499
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2500 GetClientRect (hwnd, &rect);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2501
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2502 hb = CreateSolidBrush (GetWindowLong (hwnd, WND_BACKGROUND_INDEX));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2503
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2504 oldobj = SelectObject ((HDC)wParam, hb);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2505
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2506 FillRect((HDC)wParam, &rect, hb);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2507
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2508 SelectObject((HDC)wParam, oldobj);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2509
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2510 DeleteObject (hb);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2511
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2512 return (0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2513 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2514 case WM_PAINT:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2515 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2516 PAINTSTRUCT paintStruct;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2517
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2518 BeginPaint (hwnd, &paintStruct);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2519 wmsg.rect = paintStruct.rcPaint;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2520 EndPaint (hwnd, &paintStruct);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2521
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2522 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2523
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2524 return (0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2525 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2526
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2527 case WM_CREATE:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2528 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2529 HDC hdc = my_get_dc (hwnd);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2530
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2531 /* Make mapping mode be in 1/20 of point */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2532
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2533 map_mode (hdc);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2534
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2535 ReleaseDC (hwnd, hdc);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2536 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2537
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2538 return (0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2539 case WM_KEYDOWN:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2540 case WM_SYSKEYDOWN:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2541 #if 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2542 if (! ((wParam >= VK_BACK && wParam <= VK_TAB)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2543 || (wParam >= VK_CLEAR && wParam <= VK_RETURN)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2544 || (wParam == VK_ESCAPE)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2545 || (wParam >= VK_PRIOR && wParam <= VK_HELP)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2546 || (wParam >= VK_LWIN && wParam <= VK_APPS)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2547 || (wParam >= VK_NUMPAD0 && wParam <= VK_F24)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2548 || (wParam >= VK_NUMLOCK && wParam <= VK_SCROLL)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2549 || (wParam >= VK_ATTN && wParam <= VK_OEM_CLEAR)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2550 || !TranslateMessage (&msg1)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2551 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2552 goto dflt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2553 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2554 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2555
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2556 /* Check for special characters since translate message
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2557 seems to always indicate true. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2558
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2559 if (wParam == VK_MENU
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2560 || wParam == VK_SHIFT
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2561 || wParam == VK_CONTROL
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2562 || wParam == VK_CAPITAL)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2563 break;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2564
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2565 /* Anything we do not have a name for needs to be translated or
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2566 returned as ascii keystroke. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2567
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2568 if (lispy_function_keys[wParam] == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2569 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2570 MSG msg1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2571
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2572 msg1.hwnd = hwnd;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2573 msg1.message = msg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2574 msg1.wParam = wParam;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2575 msg1.lParam = lParam;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2576
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2577 if (TranslateMessage (&msg1))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2578 break;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2579 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2580 msg = WM_CHAR;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2581 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2582
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2583 /* Fall through */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2584
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2585 case WM_SYSCHAR:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2586 case WM_CHAR:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2587 wmsg.dwModifiers = win32_get_modifiers ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2588
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2589 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2590 break;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2591 case WM_LBUTTONDOWN:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2592 case WM_LBUTTONUP:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2593 case WM_MBUTTONDOWN:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2594 case WM_MBUTTONUP:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2595 case WM_RBUTTONDOWN:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2596 case WM_RBUTTONUP:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2597 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2598 BOOL up;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2599
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2600 if (parse_button (msg, NULL, &up))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2601 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2602 if (up) ReleaseCapture ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2603 else SetCapture (hwnd);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2604 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2605 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2606
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2607 wmsg.dwModifiers = win32_get_modifiers ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2608
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2609 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2610 goto dflt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2611 case WM_MOUSEMOVE:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2612 case WM_MOVE:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2613 case WM_SIZE:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2614 case WM_SETFOCUS:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2615 case WM_KILLFOCUS:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2616 case WM_CLOSE:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2617 case WM_VSCROLL:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2618 case WM_SYSCOMMAND:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2619 case WM_COMMAND:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2620 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2621 goto dflt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2622 case WM_WINDOWPOSCHANGING:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2623 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2624 WINDOWPLACEMENT wp;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2625 LPWINDOWPOS lppos = (WINDOWPOS *) lParam;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2626
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2627 GetWindowPlacement (hwnd, &wp);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2628
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2629 if (wp.showCmd != SW_SHOWMINIMIZED && ! (lppos->flags & SWP_NOSIZE))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2630 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2631 RECT rect;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2632 int wdiff;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2633 int hdiff;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2634 DWORD dwXUnits;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2635 DWORD dwYUnits;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2636 RECT wr;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2637
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2638 GetWindowRect (hwnd, &wr);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2639
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2640 enter_crit ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2641
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2642 dwXUnits = GetWindowLong (hwnd, WND_X_UNITS_INDEX);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2643 dwYUnits = GetWindowLong (hwnd, WND_Y_UNITS_INDEX);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2644
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2645 leave_crit ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2646
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2647 memset (&rect, 0, sizeof (rect));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2648 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2649 GetMenu (hwnd) != NULL);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2650
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2651 /* All windows have an extra pixel so subtract 1 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2652
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2653 wdiff = (lppos->cx - (rect.right - rect.left) - 0) % dwXUnits;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2654 hdiff = (lppos->cy - (rect.bottom - rect.top) - 0) % dwYUnits;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2655
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2656 if (wdiff || hdiff)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2657 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2658 /* For right/bottom sizing we can just fix the sizes.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2659 However for top/left sizing we will need to fix the X
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2660 and Y positions as well. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2661
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2662 lppos->cx -= wdiff;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2663 lppos->cy -= hdiff;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2664
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2665 if (wp.showCmd != SW_SHOWMAXIMIZED
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2666 && ! (lppos->flags & SWP_NOMOVE))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2667 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2668 if (lppos->x != wr.left || lppos->y != wr.top)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2669 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2670 lppos->x += wdiff;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2671 lppos->y += hdiff;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2672 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2673 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2674 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2675 lppos->flags |= SWP_NOMOVE;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2676 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2677 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2678
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2679 ret = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2680 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2681 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2682 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2683
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2684 if (ret == 0) return (0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2685
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2686 goto dflt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2687 case WM_EMACS_DESTROYWINDOW:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2688 DestroyWindow ((HWND) wParam);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2689 break;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2690 default:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2691 dflt:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2692 return DefWindowProc (hwnd, msg, wParam, lParam);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2693 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2694
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2695 return (1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2696 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2697
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2698 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2699 my_create_window (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2700 struct frame * f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2701 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2702 MSG msg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2703
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2704 PostThreadMessage (dwWinThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2705 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2706 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2707
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2708 /* Create and set up the win32 window for frame F. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2709
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2710 static void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2711 win32_window (f, window_prompting, minibuffer_only)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2712 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2713 long window_prompting;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2714 int minibuffer_only;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2715 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2716 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2717
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2718 /* Use the resource name as the top-level window name
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2719 for looking up resources. Make a non-Lisp copy
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2720 for the window manager, so GC relocation won't bother it.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2721
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2722 Elsewhere we specify the window name for the window manager. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2723
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2724 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2725 char *str = (char *) XSTRING (Vx_resource_name)->data;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2726 f->namebuf = (char *) xmalloc (strlen (str) + 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2727 strcpy (f->namebuf, str);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2728 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2729
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2730 my_create_window (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2731
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2732 validate_x_resource_name ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2733
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2734 /* x_set_name normally ignores requests to set the name if the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2735 requested name is the same as the current name. This is the one
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2736 place where that assumption isn't correct; f->name is set, but
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2737 the server hasn't been told. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2738 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2739 Lisp_Object name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2740 int explicit = f->explicit_name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2741
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2742 f->explicit_name = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2743 name = f->name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2744 f->name = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2745 x_set_name (f, name, explicit);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2746 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2747
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2748 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2749
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2750 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2751 initialize_frame_menubar (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2752
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2753 if (FRAME_WIN32_WINDOW (f) == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2754 error ("Unable to create window");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2755 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2756
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2757 /* Handle the icon stuff for this window. Perhaps later we might
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2758 want an x_set_icon_position which can be called interactively as
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2759 well. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2760
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2761 static void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2762 x_icon (f, parms)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2763 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2764 Lisp_Object parms;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2765 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2766 Lisp_Object icon_x, icon_y;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2767
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2768 /* Set the position of the icon. Note that win95 groups all
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2769 icons in the tray. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2770 icon_x = x_get_arg (parms, Qicon_left, 0, 0, number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2771 icon_y = x_get_arg (parms, Qicon_top, 0, 0, number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2772 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2773 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2774 CHECK_NUMBER (icon_x, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2775 CHECK_NUMBER (icon_y, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2776 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2777 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2778 error ("Both left and top icon corners of icon must be specified");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2779
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2780 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2781
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2782 if (! EQ (icon_x, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2783 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2784
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2785 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2786 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2787
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2788 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2789 1, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2790 "Make a new window, which is called a \"frame\" in Emacs terms.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2791 Returns an Emacs frame object.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2792 ALIST is an alist of frame parameters.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2793 If the parameters specify that the frame should not have a minibuffer,\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2794 and do not specify a specific minibuffer window to use,\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2795 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2796 be shared by the new frame.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2797 \n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2798 This function is an internal primitive--use `make-frame' instead.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2799 (parms)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2800 Lisp_Object parms;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2801 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2802 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2803 Lisp_Object frame, tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2804 Lisp_Object name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2805 int minibuffer_only = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2806 long window_prompting = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2807 int width, height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2808 int count = specpdl_ptr - specpdl;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2809 struct gcpro gcpro1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2810 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2811 struct win32_display_info *dpyinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2812 Lisp_Object parent;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2813 struct kboard *kb;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2814
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2815 /* Use this general default value to start with
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2816 until we know if this frame has a specified name. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2817 Vx_resource_name = Vinvocation_name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2818
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2819 display = x_get_arg (parms, Qdisplay, 0, 0, string);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2820 if (EQ (display, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2821 display = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2822 dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2823 #ifdef MULTI_KBOARD
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2824 kb = dpyinfo->kboard;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2825 #else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2826 kb = &the_only_kboard;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2827 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2828
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2829 name = x_get_arg (parms, Qname, "title", "Title", string);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2830 if (!STRINGP (name)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2831 && ! EQ (name, Qunbound)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2832 && ! NILP (name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2833 error ("Invalid frame name--not a string or nil");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2834
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2835 if (STRINGP (name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2836 Vx_resource_name = name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2837
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2838 /* See if parent window is specified. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2839 parent = x_get_arg (parms, Qparent_id, NULL, NULL, number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2840 if (EQ (parent, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2841 parent = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2842 if (! NILP (parent))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2843 CHECK_NUMBER (parent, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2844
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2845 tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2846 if (EQ (tem, Qnone) || NILP (tem))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2847 f = make_frame_without_minibuffer (Qnil, kb, display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2848 else if (EQ (tem, Qonly))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2849 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2850 f = make_minibuffer_frame ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2851 minibuffer_only = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2852 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2853 else if (WINDOWP (tem))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2854 f = make_frame_without_minibuffer (tem, kb, display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2855 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2856 f = make_frame (1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2857
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2858 /* Note that Windows does support scroll bars. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2859 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2860
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2861 XSETFRAME (frame, f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2862 GCPRO1 (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2863
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2864 f->output_method = output_win32;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2865 f->output_data.win32 = (struct win32_output *) xmalloc (sizeof (struct win32_output));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2866 bzero (f->output_data.win32, sizeof (struct win32_output));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2867
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2868 /* FRAME_WIN32_DISPLAY_INFO (f) = dpyinfo; */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2869 #ifdef MULTI_KBOARD
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2870 FRAME_KBOARD (f) = kb;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2871 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2872
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2873 /* Specify the parent under which to make this window. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2874
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2875 if (!NILP (parent))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2876 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2877 f->output_data.win32->parent_desc = (Window) parent;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2878 f->output_data.win32->explicit_parent = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2879 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2880 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2881 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2882 f->output_data.win32->parent_desc = FRAME_WIN32_DISPLAY_INFO (f)->root_window;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2883 f->output_data.win32->explicit_parent = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2884 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2885
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2886 /* Note that the frame has no physical cursor right now. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2887 f->phys_cursor_x = -1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2888
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2889 /* Set the name; the functions to which we pass f expect the name to
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2890 be set. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2891 if (EQ (name, Qunbound) || NILP (name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2892 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2893 f->name = build_string (dpyinfo->win32_id_name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2894 f->explicit_name = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2895 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2896 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2897 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2898 f->name = name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2899 f->explicit_name = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2900 /* use the frame's title when getting resources for this frame. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2901 specbind (Qx_resource_name, name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2902 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2903
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2904 /* Extract the window parameters from the supplied values
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2905 that are needed to determine window geometry. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2906 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2907 Lisp_Object font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2908
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2909 font = x_get_arg (parms, Qfont, "font", "Font", string);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2910 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2911 /* First, try whatever font the caller has specified. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2912 if (STRINGP (font))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2913 font = x_new_font (f, XSTRING (font)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2914 #if 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2915 /* Try out a font which we hope has bold and italic variations. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2916 if (!STRINGP (font))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2917 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2918 if (! STRINGP (font))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2919 font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2920 if (! STRINGP (font))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2921 /* This was formerly the first thing tried, but it finds too many fonts
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2922 and takes too long. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2923 font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2924 /* If those didn't work, look for something which will at least work. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2925 if (! STRINGP (font))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2926 font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2927 if (! STRINGP (font))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2928 font = x_new_font (f, "-*-system-medium-r-normal-*-*-200-*-*-c-120-*-*");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2929 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2930 if (! STRINGP (font))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2931 font = x_new_font (f, "-*-terminal-medium-r-normal-*-*-180-*-*-c-120-*-*");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2932 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2933 if (! STRINGP (font))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2934 font = build_string ("-*-system");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2935
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2936 x_default_parameter (f, parms, Qfont, font,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2937 "font", "Font", string);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2938 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2939
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2940 x_default_parameter (f, parms, Qborder_width, make_number (2),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2941 "borderwidth", "BorderWidth", number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2942 /* This defaults to 2 in order to match xterm. We recognize either
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2943 internalBorderWidth or internalBorder (which is what xterm calls
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2944 it). */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2945 if (NILP (Fassq (Qinternal_border_width, parms)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2946 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2947 Lisp_Object value;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2948
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2949 value = x_get_arg (parms, Qinternal_border_width,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2950 "internalBorder", "BorderWidth", number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2951 if (! EQ (value, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2952 parms = Fcons (Fcons (Qinternal_border_width, value),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2953 parms);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2954 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2955 x_default_parameter (f, parms, Qinternal_border_width, make_number (0),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2956 "internalBorderWidth", "BorderWidth", number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2957 x_default_parameter (f, parms, Qvertical_scroll_bars, Qt,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2958 "verticalScrollBars", "ScrollBars", boolean);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2959
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2960 /* Also do the stuff which must be set before the window exists. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2961 x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2962 "foreground", "Foreground", string);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2963 x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2964 "background", "Background", string);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2965 x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2966 "pointerColor", "Foreground", string);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2967 x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2968 "cursorColor", "Foreground", string);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2969 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2970 "borderColor", "BorderColor", string);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2971
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2972 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2973 "menuBar", "MenuBar", number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2974 x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2975 "scrollBarWidth", "ScrollBarWidth", number);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2976
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2977 f->output_data.win32->dwStyle = WS_OVERLAPPEDWINDOW;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2978 f->output_data.win32->parent_desc = FRAME_WIN32_DISPLAY_INFO (f)->root_window;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2979 window_prompting = x_figure_window_size (f, parms);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2980
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2981 if (window_prompting & XNegative)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2982 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2983 if (window_prompting & YNegative)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2984 f->output_data.win32->win_gravity = SouthEastGravity;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2985 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2986 f->output_data.win32->win_gravity = NorthEastGravity;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2987 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2988 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2989 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2990 if (window_prompting & YNegative)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2991 f->output_data.win32->win_gravity = SouthWestGravity;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2992 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2993 f->output_data.win32->win_gravity = NorthWestGravity;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2994 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2995
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2996 f->output_data.win32->size_hint_flags = window_prompting;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2997
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2998 win32_window (f, window_prompting, minibuffer_only);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2999 x_icon (f, parms);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3000 init_frame_faces (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3001
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3002 /* We need to do this after creating the window, so that the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3003 icon-creation functions can say whose icon they're describing. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3004 x_default_parameter (f, parms, Qicon_type, Qnil,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3005 "bitmapIcon", "BitmapIcon", symbol);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3006
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3007 x_default_parameter (f, parms, Qauto_raise, Qnil,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3008 "autoRaise", "AutoRaiseLower", boolean);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3009 x_default_parameter (f, parms, Qauto_lower, Qnil,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3010 "autoLower", "AutoRaiseLower", boolean);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3011 x_default_parameter (f, parms, Qcursor_type, Qbox,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3012 "cursorType", "CursorType", symbol);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3013
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3014 /* Dimensions, especially f->height, must be done via change_frame_size.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3015 Change will not be effected unless different from the current
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3016 f->height. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3017 width = f->width;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3018 height = f->height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3019 f->height = f->width = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3020 change_frame_size (f, height, width, 1, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3021
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3022 /* Tell the server what size and position, etc, we want,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3023 and how badly we want them. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3024 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3025 x_wm_set_size_hint (f, window_prompting, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3026 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3027
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3028 tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3029 f->no_split = minibuffer_only || EQ (tem, Qt);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3030
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3031 UNGCPRO;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3032
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3033 /* It is now ok to make the frame official
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3034 even if we get an error below.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3035 And the frame needs to be on Vframe_list
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3036 or making it visible won't work. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3037 Vframe_list = Fcons (frame, Vframe_list);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3038
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3039 /* Now that the frame is official, it counts as a reference to
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3040 its display. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3041 FRAME_WIN32_DISPLAY_INFO (f)->reference_count++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3042
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3043 /* Make the window appear on the frame and enable display,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3044 unless the caller says not to. However, with explicit parent,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3045 Emacs cannot control visibility, so don't try. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3046 if (! f->output_data.win32->explicit_parent)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3047 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3048 Lisp_Object visibility;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3049
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3050 visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3051 if (EQ (visibility, Qunbound))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3052 visibility = Qt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3053
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3054 if (EQ (visibility, Qicon))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3055 x_iconify_frame (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3056 else if (! NILP (visibility))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3057 x_make_frame_visible (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3058 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3059 /* Must have been Qnil. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3060 ;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3061 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3062
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3063 return unbind_to (count, frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3064 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3065
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3066 /* FRAME is used only to get a handle on the X display. We don't pass the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3067 display info directly because we're called from frame.c, which doesn't
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3068 know about that structure. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3069 Lisp_Object
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3070 x_get_focus_frame (frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3071 struct frame *frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3072 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3073 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3074 Lisp_Object xfocus;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3075 if (! dpyinfo->win32_focus_frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3076 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3077
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3078 XSETFRAME (xfocus, dpyinfo->win32_focus_frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3079 return xfocus;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3080 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3081
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3082 DEFUN ("focus-frame", Ffocus_frame, Sfocus_frame, 1, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3083 "Set the focus on FRAME.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3084 (frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3085 Lisp_Object frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3086 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3087 CHECK_LIVE_FRAME (frame, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3088
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3089 if (FRAME_WIN32_P (XFRAME (frame)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3090 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3091 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3092 x_focus_on_frame (XFRAME (frame));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3093 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3094 return frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3095 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3096
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3097 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3098 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3099
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3100 DEFUN ("unfocus-frame", Funfocus_frame, Sunfocus_frame, 0, 0, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3101 "If a frame has been focused, release it.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3102 ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3103 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3104 if (FRAME_WIN32_P (selected_frame))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3105 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3106 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (selected_frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3107
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3108 if (dpyinfo->win32_focus_frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3109 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3110 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3111 x_unfocus_frame (dpyinfo->win32_focus_frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3112 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3113 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3114 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3115
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3116 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3117 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3118
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3119 XFontStruct
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3120 *win32_load_font (dpyinfo,name)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3121 struct win32_display_info *dpyinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3122 char * name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3123 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3124 XFontStruct * font = NULL;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3125 BOOL ok;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3126
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3127 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3128 LOGFONT lf;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3129
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3130 if (!name || !x_to_win32_font(name, &lf))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3131 return (NULL);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3132
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3133 font = (XFontStruct *) xmalloc (sizeof (XFontStruct));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3134
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3135 if (!font) return (NULL);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3136
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3137 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3138
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3139 font->hfont = CreateFontIndirect(&lf);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3140 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3141
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3142 if (font->hfont == NULL)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3143 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3144 ok = FALSE;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3145 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3146 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3147 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3148 HDC hdc;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3149 HANDLE oldobj;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3150
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3151 hdc = my_get_dc (dpyinfo->root_window);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3152
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3153 oldobj = SelectObject (hdc, font->hfont);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3154
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3155 ok = GetTextMetrics (hdc, &font->tm);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3156
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3157 SelectObject (hdc, oldobj);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3158
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3159 ReleaseDC (dpyinfo->root_window, hdc);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3160 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3161
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3162 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3163
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3164 if (ok) return (font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3165
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3166 win32_unload_font(dpyinfo, font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3167 return (NULL);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3168 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3169
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3170 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3171 win32_unload_font (dpyinfo, font)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3172 struct win32_display_info *dpyinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3173 XFontStruct * font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3174 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3175 if (font)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3176 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3177 if (font->hfont) DeleteObject(font->hfont);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3178 xfree (font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3179 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3180 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3181
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3182 /* The font conversion stuff between x and win32 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3183
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3184 /* X font string is as follows (from faces.el)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3185 * (let ((- "[-?]")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3186 * (foundry "[^-]+")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3187 * (family "[^-]+")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3188 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3189 * (weight\? "\\([^-]*\\)") ; 1
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3190 * (slant "\\([ior]\\)") ; 2
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3191 * (slant\? "\\([^-]?\\)") ; 2
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3192 * (swidth "\\([^-]*\\)") ; 3
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3193 * (adstyle "[^-]*") ; 4
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3194 * (pixelsize "[0-9]+")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3195 * (pointsize "[0-9][0-9]+")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3196 * (resx "[0-9][0-9]+")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3197 * (resy "[0-9][0-9]+")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3198 * (spacing "[cmp?*]")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3199 * (avgwidth "[0-9]+")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3200 * (registry "[^-]+")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3201 * (encoding "[^-]+")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3202 * )
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3203 * (setq x-font-regexp
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3204 * (concat "\\`\\*?[-?*]"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3205 * foundry - family - weight\? - slant\? - swidth - adstyle -
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3206 * pixelsize - pointsize - resx - resy - spacing - registry -
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3207 * encoding "[-?*]\\*?\\'"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3208 * ))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3209 * (setq x-font-regexp-head
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3210 * (concat "\\`[-?*]" foundry - family - weight\? - slant\?
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3211 * "\\([-*?]\\|\\'\\)"))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3212 * (setq x-font-regexp-slant (concat - slant -))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3213 * (setq x-font-regexp-weight (concat - weight -))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3214 * nil)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3215 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3216
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3217 #define FONT_START "[-?]"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3218 #define FONT_FOUNDRY "[^-]+"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3219 #define FONT_FAMILY "\\([^-]+\\)" /* 1 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3220 #define FONT_WEIGHT "\\(bold\\|demibold\\|medium\\)" /* 2 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3221 #define FONT_WEIGHT_Q "\\([^-]*\\)" /* 2 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3222 #define FONT_SLANT "\\([ior]\\)" /* 3 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3223 #define FONT_SLANT_Q "\\([^-]?\\)" /* 3 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3224 #define FONT_SWIDTH "\\([^-]*\\)" /* 4 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3225 #define FONT_ADSTYLE "[^-]*"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3226 #define FONT_PIXELSIZE "[^-]*"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3227 #define FONT_POINTSIZE "\\([0-9][0-9]+\\|\\*\\)" /* 5 */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3228 #define FONT_RESX "[0-9][0-9]+"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3229 #define FONT_RESY "[0-9][0-9]+"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3230 #define FONT_SPACING "[cmp?*]"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3231 #define FONT_AVGWIDTH "[0-9]+"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3232 #define FONT_REGISTRY "[^-]+"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3233 #define FONT_ENCODING "[^-]+"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3234
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3235 #define FONT_REGEXP ("\\`\\*?[-?*]" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3236 FONT_FOUNDRY "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3237 FONT_FAMILY "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3238 FONT_WEIGHT_Q "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3239 FONT_SLANT_Q "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3240 FONT_SWIDTH "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3241 FONT_ADSTYLE "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3242 FONT_PIXELSIZE "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3243 FONT_POINTSIZE "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3244 "[-?*]\\|\\'")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3245
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3246 #define FONT_REGEXP_HEAD ("\\`[-?*]" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3247 FONT_FOUNDRY "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3248 FONT_FAMILY "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3249 FONT_WEIGHT_Q "-" \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3250 FONT_SLANT_Q \
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3251 "\\([-*?]\\|\\'\\)")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3252
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3253 #define FONT_REGEXP_SLANT "-" FONT_SLANT "-"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3254 #define FONT_REGEXP_WEIGHT "-" FONT_WEIGHT "-"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3255
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3256 LONG
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3257 x_to_win32_weight (lpw)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3258 char * lpw;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3259 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3260 if (!lpw) return (FW_DONTCARE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3261
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3262 if (stricmp (lpw, "bold") == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3263 return (FW_BOLD);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3264 else if (stricmp (lpw, "demibold") == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3265 return (FW_SEMIBOLD);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3266 else if (stricmp (lpw, "medium") == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3267 return (FW_MEDIUM);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3268 else if (stricmp (lpw, "normal") == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3269 return (FW_NORMAL);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3270 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3271 return (FW_DONTCARE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3272 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3273
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3274 char *
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3275 win32_to_x_weight (fnweight)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3276 int fnweight;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3277 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3278 if (fnweight >= FW_BOLD)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3279 return ("bold");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3280 else if (fnweight >= FW_SEMIBOLD)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3281 return ("demibold");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3282 else if (fnweight >= FW_MEDIUM)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3283 return ("medium");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3284 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3285 return ("normal");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3286 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3287
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3288 BOOL
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3289 win32_to_x_font (lplogfont, lpxstr, len)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3290 LOGFONT * lplogfont;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3291 char * lpxstr;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3292 int len;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3293 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3294 if (!lpxstr) return (FALSE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3295
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3296 if (lplogfont)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3297 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3298 int height = (lplogfont->lfHeight * 1440)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3299 / one_win32_display_info.height_in;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3300 int width = (lplogfont->lfWidth * 1440)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3301 / one_win32_display_info.width_in;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3302
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3303 height = abs (height);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3304 _snprintf (lpxstr, len - 1,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3305 "-*-%s-%s-%c-%s-%s-*-%d-*-*-%c-%d-*-*-",
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3306 lplogfont->lfFaceName,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3307 win32_to_x_weight (lplogfont->lfWeight),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3308 lplogfont->lfItalic ? 'i' : 'r',
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3309 "*", "*",
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3310 height,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3311 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) ? 'p' : 'c',
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3312 width);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3313 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3314 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3315 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3316 strncpy (lpxstr, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-", len - 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3317 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3318
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3319 lpxstr[len - 1] = 0; /* just to be sure */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3320 return (TRUE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3321 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3322
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3323 BOOL
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3324 x_to_win32_font (lpxstr, lplogfont)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3325 char * lpxstr;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3326 LOGFONT * lplogfont;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3327 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3328 if (!lplogfont) return (FALSE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3329
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3330 memset (lplogfont, 0, sizeof (*lplogfont));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3331
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3332 lplogfont->lfCharSet = OEM_CHARSET;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3333 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3334 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3335 lplogfont->lfQuality = DEFAULT_QUALITY;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3336
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3337 if (lpxstr && *lpxstr == '-') lpxstr++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3338
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3339 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3340 int fields;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3341 char name[50], weight[20], slant, pitch, height[10], width[10];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3342
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3343 fields = (lpxstr
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3344 ? sscanf (lpxstr,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3345 "%*[^-]-%[^-]-%[^-]-%c-%*[^-]-%*[^-]-%*[^-]-%[^-]-%*[^-]-%*[^-]-%c-%[^-]",
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3346 name, weight, &slant, height, &pitch, width)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3347 : 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3348
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3349 if (fields == EOF) return (FALSE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3350
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3351 if (fields > 0 && name[0] != '*')
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3352 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3353 strncpy (lplogfont->lfFaceName, name, LF_FACESIZE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3354 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3355 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3356 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3357 lplogfont->lfFaceName[0] = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3358 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3359
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3360 fields--;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3361
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3362 lplogfont->lfWeight = x_to_win32_weight((fields > 0 ? weight : ""));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3363
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3364 fields--;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3365
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3366 lplogfont->lfItalic = (fields > 0 && slant == 'i');
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3367
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3368 fields--;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3369
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3370 if (fields > 0 && height[0] != '*')
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3371 lplogfont->lfHeight = (atoi (height) * one_win32_display_info.height_in) / 1440;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3372
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3373 fields--;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3374
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3375 lplogfont->lfPitchAndFamily = (fields > 0 && pitch == 'p') ? VARIABLE_PITCH : FIXED_PITCH;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3376
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3377 fields--;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3378
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3379 if (fields > 0 && width[0] != '*')
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3380 lplogfont->lfWidth = (atoi (width) * one_win32_display_info.width_in) / 1440;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3381 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3382
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3383 return (TRUE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3384 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3385
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3386 BOOL
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3387 win32_font_match (lpszfont1, lpszfont2)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3388 char * lpszfont1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3389 char * lpszfont2;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3390 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3391 char * s1 = lpszfont1, *e1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3392 char * s2 = lpszfont2, *e2;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3393
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3394 if (s1 == NULL || s2 == NULL) return (FALSE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3395
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3396 if (*s1 == '-') s1++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3397 if (*s2 == '-') s2++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3398
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3399 while (1)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3400 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3401 int len1, len2;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3402
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3403 e1 = strchr (s1, '-');
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3404 e2 = strchr (s2, '-');
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3405
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3406 if (e1 == NULL || e2 == NULL) return (TRUE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3407
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3408 len1 = e1 - s1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3409 len2 = e2 - s2;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3410
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3411 if (*s1 != '*' && *s2 != '*'
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3412 && (len1 != len2 || strnicmp (s1, s2, len1) != 0))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3413 return (FALSE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3414
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3415 s1 = e1 + 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3416 s2 = e2 + 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3417 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3418 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3419
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3420 typedef struct enumfont_t
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3421 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3422 HDC hdc;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3423 int numFonts;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3424 XFontStruct *size_ref;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3425 Lisp_Object *pattern;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3426 Lisp_Object *head;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3427 Lisp_Object *tail;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3428 } enumfont_t;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3429
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3430 int CALLBACK
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3431 enum_font_cb2 (lplf, lptm, FontType, lpef)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3432 ENUMLOGFONT * lplf;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3433 NEWTEXTMETRIC * lptm;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3434 int FontType;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3435 enumfont_t * lpef;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3436 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3437 if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3438 || (lplf->elfLogFont.lfCharSet != ANSI_CHARSET && lplf->elfLogFont.lfCharSet != OEM_CHARSET))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3439 return (1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3440
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3441 /* if (!lpef->size_ref || lptm->tmMaxCharWidth == FONT_WIDTH (lpef->size_ref)) */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3442 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3443 char buf[100];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3444
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3445 if (!win32_to_x_font (lplf, buf, 100)) return (0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3446
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3447 if (NILP (*(lpef->pattern)) || win32_font_match (buf, XSTRING (*(lpef->pattern))->data))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3448 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3449 *lpef->tail = Fcons (build_string (buf), Qnil);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3450 lpef->tail = &XCONS (*lpef->tail)->cdr;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3451 lpef->numFonts++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3452 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3453 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3454
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3455 return (1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3456 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3457
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3458 int CALLBACK
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3459 enum_font_cb1 (lplf, lptm, FontType, lpef)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3460 ENUMLOGFONT * lplf;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3461 NEWTEXTMETRIC * lptm;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3462 int FontType;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3463 enumfont_t * lpef;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3464 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3465 return EnumFontFamilies (lpef->hdc,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3466 lplf->elfLogFont.lfFaceName,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3467 (FONTENUMPROC) enum_font_cb2,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3468 (LPARAM) lpef);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3469 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3470
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3471
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3472 DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 3, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3473 "Return a list of the names of available fonts matching PATTERN.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3474 If optional arguments FACE and FRAME are specified, return only fonts\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3475 the same size as FACE on FRAME.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3476 \n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3477 PATTERN is a string, perhaps with wildcard characters;\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3478 the * character matches any substring, and\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3479 the ? character matches any single character.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3480 PATTERN is case-insensitive.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3481 FACE is a face name--a symbol.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3482 \n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3483 The return value is a list of strings, suitable as arguments to\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3484 set-face-font.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3485 \n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3486 Fonts Emacs can't use (i.e. proportional fonts) may or may not be excluded\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3487 even if they match PATTERN and FACE.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3488 (pattern, face, frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3489 Lisp_Object pattern, face, frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3490 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3491 int num_fonts;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3492 char **names;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3493 XFontStruct *info;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3494 XFontStruct *size_ref;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3495 Lisp_Object namelist;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3496 Lisp_Object list;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3497 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3498 enumfont_t ef;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3499
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3500 CHECK_STRING (pattern, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3501 if (!NILP (face))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3502 CHECK_SYMBOL (face, 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3503
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3504 f = check_x_frame (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3505
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3506 /* Determine the width standard for comparison with the fonts we find. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3507
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3508 if (NILP (face))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3509 size_ref = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3510 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3511 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3512 int face_id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3513
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3514 /* Don't die if we get called with a terminal frame. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3515 if (! FRAME_WIN32_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3516 error ("non-win32 frame used in `x-list-fonts'");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3517
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3518 face_id = face_name_id_number (f, face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3519
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3520 if (face_id < 0 || face_id >= FRAME_N_PARAM_FACES (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3521 || FRAME_PARAM_FACES (f) [face_id] == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3522 size_ref = f->output_data.win32->font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3523 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3524 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3525 size_ref = FRAME_PARAM_FACES (f) [face_id]->font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3526 if (size_ref == (XFontStruct *) (~0))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3527 size_ref = f->output_data.win32->font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3528 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3529 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3530
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3531 /* See if we cached the result for this particular query. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3532 list = Fassoc (pattern,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3533 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->cdr);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3534
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3535 /* We have info in the cache for this PATTERN. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3536 if (!NILP (list))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3537 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3538 Lisp_Object tem, newlist;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3539
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3540 /* We have info about this pattern. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3541 list = XCONS (list)->cdr;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3542
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3543 if (size_ref == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3544 return list;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3545
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3546 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3547
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3548 /* Filter the cached info and return just the fonts that match FACE. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3549 newlist = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3550 for (tem = list; CONSP (tem); tem = XCONS (tem)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3551 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3552 XFontStruct *thisinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3553
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3554 thisinfo = win32_load_font (FRAME_WIN32_DISPLAY_INFO (f), XSTRING (XCONS (tem)->car)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3555
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3556 if (thisinfo && same_size_fonts (thisinfo, size_ref))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3557 newlist = Fcons (XCONS (tem)->car, newlist);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3558
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3559 win32_unload_font (FRAME_WIN32_DISPLAY_INFO (f), thisinfo);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3560 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3561
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3562 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3563
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3564 return newlist;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3565 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3566
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3567 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3568
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3569 namelist = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3570 ef.pattern = &pattern;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3571 ef.tail = ef.head = &namelist;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3572 ef.numFonts = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3573
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3574 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3575 ef.hdc = my_get_dc (FRAME_WIN32_WINDOW (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3576
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3577 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, (LPARAM)&ef);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3578
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3579 ReleaseDC (FRAME_WIN32_WINDOW (f), ef.hdc);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3580 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3581
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3582 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3583
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3584 if (ef.numFonts)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3585 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3586 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3587 Lisp_Object cur;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3588
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3589 /* Make a list of all the fonts we got back.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3590 Store that in the font cache for the display. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3591 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->cdr
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3592 = Fcons (Fcons (pattern, namelist),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3593 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->cdr);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3594
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3595 /* Make a list of the fonts that have the right width. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3596 list = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3597 cur=namelist;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3598 for (i = 0; i < ef.numFonts; i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3599 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3600 int keeper;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3601
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3602 if (!size_ref)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3603 keeper = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3604 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3605 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3606 XFontStruct *thisinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3607
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3608 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3609 thisinfo = win32_load_font (FRAME_WIN32_DISPLAY_INFO (f), XSTRING (Fcar (cur))->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3610
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3611 keeper = thisinfo && same_size_fonts (thisinfo, size_ref);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3612
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3613 win32_unload_font (FRAME_WIN32_DISPLAY_INFO (f), thisinfo);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3614
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3615 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3616 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3617 if (keeper)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3618 list = Fcons (build_string (XSTRING (Fcar (cur))->data), list);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3619
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3620 cur = Fcdr (cur);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3621 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3622 list = Fnreverse (list);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3623 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3624
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3625 return list;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3626 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3627
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3628 DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3629 "Return non-nil if color COLOR is supported on frame FRAME.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3630 If FRAME is omitted or nil, use the selected frame.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3631 (color, frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3632 Lisp_Object color, frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3633 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3634 COLORREF foo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3635 FRAME_PTR f = check_x_frame (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3636
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3637 CHECK_STRING (color, 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3638
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3639 if (defined_color (f, XSTRING (color)->data, &foo, 0))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3640 return Qt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3641 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3642 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3643 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3644
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3645 DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3646 "Return a description of the color named COLOR on frame FRAME.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3647 The value is a list of integer RGB values--(RED GREEN BLUE).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3648 These values appear to range from 0 to 65280 or 65535, depending\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3649 on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3650 If FRAME is omitted or nil, use the selected frame.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3651 (color, frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3652 Lisp_Object color, frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3653 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3654 COLORREF foo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3655 FRAME_PTR f = check_x_frame (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3656
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3657 CHECK_STRING (color, 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3658
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3659 if (defined_color (f, XSTRING (color)->data, &foo, 0))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3660 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3661 Lisp_Object rgb[3];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3662
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3663 rgb[0] = make_number (GetRValue (foo));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3664 rgb[1] = make_number (GetGValue (foo));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3665 rgb[2] = make_number (GetBValue (foo));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3666 return Flist (3, rgb);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3667 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3668 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3669 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3670 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3671
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3672 DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3673 "Return t if the X display supports color.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3674 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3675 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3676 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3677 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3678 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3679 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3680 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3681
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3682 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3683 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3684
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3685 return Qt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3686 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3687
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3688 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3689 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3690 "Return t if the X display supports shades of gray.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3691 Note that color displays do support shades of gray.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3692 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3693 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3694 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3695 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3696 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3697 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3698 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3699
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3700 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3701 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3702
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3703 return Qt;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3704 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3705
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3706 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3707 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3708 "Returns the width in pixels of the X display DISPLAY.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3709 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3710 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3711 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3712 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3713 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3714 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3715 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3716
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3717 return make_number (dpyinfo->width);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3718 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3719
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3720 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3721 Sx_display_pixel_height, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3722 "Returns the height in pixels of the X display DISPLAY.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3723 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3724 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3725 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3726 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3727 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3728 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3729 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3730
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3731 return make_number (dpyinfo->height);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3732 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3733
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3734 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3735 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3736 "Returns the number of bitplanes of the display DISPLAY.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3737 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3738 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3739 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3740 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3741 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3742 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3743 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3744
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3745 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3746 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3747
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3748 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3749 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3750 "Returns the number of color cells of the display DISPLAY.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3751 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3752 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3753 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3754 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3755 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3756 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3757 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3758 HDC hdc;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3759 int cap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3760
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3761 hdc = my_get_dc (dpyinfo->root_window);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3762
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3763 cap = GetDeviceCaps (hdc,NUMCOLORS);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3764
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3765 ReleaseDC (dpyinfo->root_window, hdc);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3766
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3767 return make_number (cap);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3768 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3769
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3770 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3771 Sx_server_max_request_size,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3772 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3773 "Returns the maximum request size of the server of display DISPLAY.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3774 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3775 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3776 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3777 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3778 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3779 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3780 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3781
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3782 return make_number (1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3783 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3784
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3785 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3786 "Returns the vendor ID string of the Win32 system (Microsoft).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3787 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3788 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3789 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3790 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3791 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3792 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3793 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3794 char *vendor = "Microsoft Corp.";
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3795
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3796 if (! vendor) vendor = "";
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3797 return build_string (vendor);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3798 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3799
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3800 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3801 "Returns the version numbers of the server of display DISPLAY.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3802 The value is a list of three integers: the major and minor\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3803 version numbers, and the vendor-specific release\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3804 number. See also the function `x-server-vendor'.\n\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3805 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3806 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3807 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3808 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3809 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3810 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3811 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3812
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3813 return Fcons (make_number (nt_major_version),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3814 Fcons (make_number (nt_minor_version), Qnil));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3815 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3816
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3817 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3818 "Returns the number of screens on the server of display DISPLAY.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3819 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3820 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3821 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3822 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3823 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3824 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3825 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3826
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3827 return make_number (1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3828 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3829
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3830 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3831 "Returns the height in millimeters of the X display DISPLAY.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3832 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3833 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3834 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3835 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3836 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3837 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3838 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3839 HDC hdc;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3840 int cap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3841
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3842 hdc = my_get_dc (dpyinfo->root_window);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3843
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3844 cap = GetDeviceCaps (hdc, VERTSIZE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3845
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3846 ReleaseDC (dpyinfo->root_window, hdc);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3847
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3848 return make_number (cap);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3849 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3850
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3851 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3852 "Returns the width in millimeters of the X display DISPLAY.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3853 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3854 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3855 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3856 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3857 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3858 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3859 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3860
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3861 HDC hdc;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3862 int cap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3863
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3864 hdc = my_get_dc (dpyinfo->root_window);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3865
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3866 cap = GetDeviceCaps (hdc, HORZSIZE);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3867
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3868 ReleaseDC (dpyinfo->root_window, hdc);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3869
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3870 return make_number (cap);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3871 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3872
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3873 DEFUN ("x-display-backing-store", Fx_display_backing_store,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3874 Sx_display_backing_store, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3875 "Returns an indication of whether display DISPLAY does backing store.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3876 The value may be `always', `when-mapped', or `not-useful'.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3877 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3878 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3879 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3880 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3881 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3882 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3883 return intern ("not-useful");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3884 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3885
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3886 DEFUN ("x-display-visual-class", Fx_display_visual_class,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3887 Sx_display_visual_class, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3888 "Returns the visual class of the display DISPLAY.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3889 The value is one of the symbols `static-gray', `gray-scale',\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3890 `static-color', `pseudo-color', `true-color', or `direct-color'.\n\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3891 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3892 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3893 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3894 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3895 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3896 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3897 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3898
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3899 #if 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3900 switch (dpyinfo->visual->class)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3901 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3902 case StaticGray: return (intern ("static-gray"));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3903 case GrayScale: return (intern ("gray-scale"));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3904 case StaticColor: return (intern ("static-color"));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3905 case PseudoColor: return (intern ("pseudo-color"));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3906 case TrueColor: return (intern ("true-color"));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3907 case DirectColor: return (intern ("direct-color"));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3908 default:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3909 error ("Display has an unknown visual class");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3910 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3911 #endif
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3912
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3913 error ("Display has an unknown visual class");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3914 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3915
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3916 DEFUN ("x-display-save-under", Fx_display_save_under,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3917 Sx_display_save_under, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3918 "Returns t if the display DISPLAY supports the save-under feature.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3919 The optional argument DISPLAY specifies which display to ask about.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3920 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3921 If omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3922 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3923 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3924 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3925 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3926
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3927 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3928 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3929
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3930 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3931 x_pixel_width (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3932 register struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3933 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3934 return PIXEL_WIDTH (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3935 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3936
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3937 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3938 x_pixel_height (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3939 register struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3940 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3941 return PIXEL_HEIGHT (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3942 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3943
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3944 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3945 x_char_width (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3946 register struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3947 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3948 return FONT_WIDTH (f->output_data.win32->font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3949 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3950
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3951 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3952 x_char_height (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3953 register struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3954 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3955 return f->output_data.win32->line_height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3956 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3957
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3958 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3959 x_screen_planes (frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3960 Lisp_Object frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3961 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3962 return (FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_planes *
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3963 FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_cbits);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3964 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3965
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3966 /* Return the display structure for the display named NAME.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3967 Open a new connection if necessary. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3968
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3969 struct win32_display_info *
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3970 x_display_info_for_name (name)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3971 Lisp_Object name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3972 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3973 Lisp_Object names;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3974 struct win32_display_info *dpyinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3975
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3976 CHECK_STRING (name, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3977
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3978 for (dpyinfo = &one_win32_display_info, names = win32_display_name_list;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3979 dpyinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3980 dpyinfo = dpyinfo->next, names = XCONS (names)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3981 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3982 Lisp_Object tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3983 tem = Fstring_equal (XCONS (XCONS (names)->car)->car, name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3984 if (!NILP (tem))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3985 return dpyinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3986 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3987
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3988 /* Use this general default value to start with. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3989 Vx_resource_name = Vinvocation_name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3990
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3991 validate_x_resource_name ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3992
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3993 dpyinfo = win32_term_init (name, (unsigned char *)0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3994 (char *) XSTRING (Vx_resource_name)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3995
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3996 if (dpyinfo == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3997 error ("Cannot connect to server %s", XSTRING (name)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3998
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3999 XSETFASTINT (Vwindow_system_version, 3);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4000
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4001 return dpyinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4002 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4003
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4004 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4005 1, 3, 0, "Open a connection to a server.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4006 DISPLAY is the name of the display to connect to.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4007 Optional second arg XRM-STRING is a string of resources in xrdb format.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4008 If the optional third arg MUST-SUCCEED is non-nil,\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4009 terminate Emacs if we can't open the connection.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4010 (display, xrm_string, must_succeed)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4011 Lisp_Object display, xrm_string, must_succeed;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4012 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4013 unsigned int n_planes;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4014 unsigned char *xrm_option;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4015 struct win32_display_info *dpyinfo;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4016
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4017 CHECK_STRING (display, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4018 if (! NILP (xrm_string))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4019 CHECK_STRING (xrm_string, 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4020
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4021 Vwin32_color_map = Fwin32_default_color_map ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4022
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4023 if (! NILP (xrm_string))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4024 xrm_option = (unsigned char *) XSTRING (xrm_string)->data;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4025 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4026 xrm_option = (unsigned char *) 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4027
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4028 /* Use this general default value to start with. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4029 Vx_resource_name = Vinvocation_name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4030
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4031 validate_x_resource_name ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4032
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4033 /* This is what opens the connection and sets x_current_display.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4034 This also initializes many symbols, such as those used for input. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4035 dpyinfo = win32_term_init (display, xrm_option,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4036 (char *) XSTRING (Vx_resource_name)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4037
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4038 if (dpyinfo == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4039 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4040 if (!NILP (must_succeed))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4041 fatal ("Cannot connect to server %s.\n",
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4042 XSTRING (display)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4043 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4044 error ("Cannot connect to server %s", XSTRING (display)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4045 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4046
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4047 XSETFASTINT (Vwindow_system_version, 3);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4048 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4049 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4050
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4051 DEFUN ("x-close-connection", Fx_close_connection,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4052 Sx_close_connection, 1, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4053 "Close the connection to DISPLAY's server.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4054 For DISPLAY, specify either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4055 If DISPLAY is nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4056 (display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4057 Lisp_Object display;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4058 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4059 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4060 struct win32_display_info *tail;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4061 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4062
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4063 if (dpyinfo->reference_count > 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4064 error ("Display still has frames on it");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4065
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4066 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4067 /* Free the fonts in the font table. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4068 for (i = 0; i < dpyinfo->n_fonts; i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4069 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4070 if (dpyinfo->font_table[i].name)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4071 free (dpyinfo->font_table[i].name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4072 /* Don't free the full_name string;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4073 it is always shared with something else. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4074 win32_unload_font (dpyinfo, dpyinfo->font_table[i].font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4075 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4076 x_destroy_all_bitmaps (dpyinfo);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4077
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4078 x_delete_display (dpyinfo);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4079 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4080
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4081 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4082 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4083
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4084 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4085 "Return the list of display names that Emacs has connections to.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4086 ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4087 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4088 Lisp_Object tail, result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4089
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4090 result = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4091 for (tail = win32_display_name_list; ! NILP (tail); tail = XCONS (tail)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4092 result = Fcons (XCONS (XCONS (tail)->car)->car, result);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4093
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4094 return result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4095 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4096
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4097 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4098 "If ON is non-nil, report errors as soon as the erring request is made.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4099 If ON is nil, allow buffering of requests.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4100 This is a noop on Win32 systems.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4101 The optional second argument DISPLAY specifies which display to act on.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4102 DISPLAY should be either a frame or a display name (a string).\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4103 If DISPLAY is omitted or nil, that stands for the selected frame's display.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4104 (on, display)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4105 Lisp_Object display, on;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4106 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4107 struct win32_display_info *dpyinfo = check_x_display_info (display);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4108
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4109 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4110 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4111
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4112
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4113 /* These are the win32 specialized functions */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4114
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4115 DEFUN ("win32-select-font", Fwin32_select_font, Swin32_select_font, 0, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4116 "This will display the Win32 font dialog and return an X font string corresponding to the selection.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4117 (frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4118 Lisp_Object frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4119 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4120 FRAME_PTR f = check_x_frame (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4121 CHOOSEFONT cf;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4122 LOGFONT lf;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4123 char buf[100];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4124
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4125 bzero (&cf, sizeof (cf));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4126
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4127 cf.lStructSize = sizeof (cf);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4128 cf.hwndOwner = FRAME_WIN32_WINDOW (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4129 cf.Flags = CF_FIXEDPITCHONLY | CF_FORCEFONTEXIST | CF_SCREENFONTS;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4130 cf.lpLogFont = &lf;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4131
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4132 if (!ChooseFont (&cf) || !win32_to_x_font (&lf, buf, 100))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4133 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4134
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4135 return build_string (buf);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4136 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4137
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4138
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4139 syms_of_win32fns ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4140 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4141 /* The section below is built by the lisp expression at the top of the file,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4142 just above where these variables are declared. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4143 /*&&& init symbols here &&&*/
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4144 Qauto_raise = intern ("auto-raise");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4145 staticpro (&Qauto_raise);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4146 Qauto_lower = intern ("auto-lower");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4147 staticpro (&Qauto_lower);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4148 Qbackground_color = intern ("background-color");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4149 staticpro (&Qbackground_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4150 Qbar = intern ("bar");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4151 staticpro (&Qbar);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4152 Qborder_color = intern ("border-color");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4153 staticpro (&Qborder_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4154 Qborder_width = intern ("border-width");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4155 staticpro (&Qborder_width);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4156 Qbox = intern ("box");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4157 staticpro (&Qbox);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4158 Qcursor_color = intern ("cursor-color");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4159 staticpro (&Qcursor_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4160 Qcursor_type = intern ("cursor-type");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4161 staticpro (&Qcursor_type);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4162 Qfont = intern ("font");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4163 staticpro (&Qfont);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4164 Qforeground_color = intern ("foreground-color");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4165 staticpro (&Qforeground_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4166 Qgeometry = intern ("geometry");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4167 staticpro (&Qgeometry);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4168 Qicon_left = intern ("icon-left");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4169 staticpro (&Qicon_left);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4170 Qicon_top = intern ("icon-top");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4171 staticpro (&Qicon_top);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4172 Qicon_type = intern ("icon-type");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4173 staticpro (&Qicon_type);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4174 Qicon_name = intern ("icon-name");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4175 staticpro (&Qicon_name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4176 Qinternal_border_width = intern ("internal-border-width");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4177 staticpro (&Qinternal_border_width);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4178 Qleft = intern ("left");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4179 staticpro (&Qleft);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4180 Qmouse_color = intern ("mouse-color");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4181 staticpro (&Qmouse_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4182 Qnone = intern ("none");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4183 staticpro (&Qnone);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4184 Qparent_id = intern ("parent-id");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4185 staticpro (&Qparent_id);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4186 Qscroll_bar_width = intern ("scroll-bar-width");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4187 staticpro (&Qscroll_bar_width);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4188 Qsuppress_icon = intern ("suppress-icon");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4189 staticpro (&Qsuppress_icon);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4190 Qtop = intern ("top");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4191 staticpro (&Qtop);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4192 Qundefined_color = intern ("undefined-color");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4193 staticpro (&Qundefined_color);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4194 Qvertical_scroll_bars = intern ("vertical-scroll-bars");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4195 staticpro (&Qvertical_scroll_bars);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4196 Qvisibility = intern ("visibility");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4197 staticpro (&Qvisibility);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4198 Qwindow_id = intern ("window-id");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4199 staticpro (&Qwindow_id);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4200 Qx_frame_parameter = intern ("x-frame-parameter");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4201 staticpro (&Qx_frame_parameter);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4202 Qx_resource_name = intern ("x-resource-name");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4203 staticpro (&Qx_resource_name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4204 Quser_position = intern ("user-position");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4205 staticpro (&Quser_position);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4206 Quser_size = intern ("user-size");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4207 staticpro (&Quser_size);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4208 Qdisplay = intern ("display");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4209 staticpro (&Qdisplay);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4210 /* This is the end of symbol initialization. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4211
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4212 Fput (Qundefined_color, Qerror_conditions,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4213 Fcons (Qundefined_color, Fcons (Qerror, Qnil)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4214 Fput (Qundefined_color, Qerror_message,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4215 build_string ("Undefined color"));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4216
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4217 DEFVAR_LISP ("win32-color-map", &Vwin32_color_map,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4218 "A array of color name mappings for windows.");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4219 Vwin32_color_map = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4220
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4221 init_x_parm_symbols ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4222
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4223 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4224 "List of directories to search for bitmap files for win32.");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4225 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4226
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4227 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4228 "The shape of the pointer when over text.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4229 Changing the value does not affect existing frames\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4230 unless you set the mouse color.");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4231 Vx_pointer_shape = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4232
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4233 DEFVAR_LISP ("x-resource-name", &Vx_resource_name,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4234 "The name Emacs uses to look up resources; for internal use only.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4235 `x-get-resource' uses this as the first component of the instance name\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4236 when requesting resource values.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4237 Emacs initially sets `x-resource-name' to the name under which Emacs\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4238 was invoked, or to the value specified with the `-name' or `-rn'\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4239 switches, if present.");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4240 Vx_resource_name = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4241
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4242 Vx_nontext_pointer_shape = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4243
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4244 Vx_mode_pointer_shape = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4245
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4246 DEFVAR_INT ("x-sensitive-text-pointer-shape",
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4247 &Vx_sensitive_text_pointer_shape,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4248 "The shape of the pointer when over mouse-sensitive text.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4249 This variable takes effect when you create a new frame\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4250 or when you set the mouse color.");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4251 Vx_sensitive_text_pointer_shape = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4252
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4253 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4254 "A string indicating the foreground color of the cursor box.");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4255 Vx_cursor_fore_pixel = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4256
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4257 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4258 "Non-nil if no window manager is in use.\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4259 Emacs doesn't try to figure this out; this is always nil\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4260 unless you set it to something else.");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4261 /* We don't have any way to find this out, so set it to nil
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4262 and maybe the user would like to set it to t. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4263 Vx_no_window_manager = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4264
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4265 defsubr (&Sx_get_resource);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4266 defsubr (&Sx_list_fonts);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4267 defsubr (&Sx_display_color_p);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4268 defsubr (&Sx_display_grayscale_p);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4269 defsubr (&Sx_color_defined_p);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4270 defsubr (&Sx_color_values);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4271 defsubr (&Sx_server_max_request_size);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4272 defsubr (&Sx_server_vendor);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4273 defsubr (&Sx_server_version);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4274 defsubr (&Sx_display_pixel_width);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4275 defsubr (&Sx_display_pixel_height);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4276 defsubr (&Sx_display_mm_width);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4277 defsubr (&Sx_display_mm_height);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4278 defsubr (&Sx_display_screens);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4279 defsubr (&Sx_display_planes);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4280 defsubr (&Sx_display_color_cells);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4281 defsubr (&Sx_display_visual_class);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4282 defsubr (&Sx_display_backing_store);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4283 defsubr (&Sx_display_save_under);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4284 defsubr (&Sx_parse_geometry);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4285 defsubr (&Sx_create_frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4286 defsubr (&Sfocus_frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4287 defsubr (&Sunfocus_frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4288 defsubr (&Sx_open_connection);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4289 defsubr (&Sx_close_connection);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4290 defsubr (&Sx_display_list);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4291 defsubr (&Sx_synchronize);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4292
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4293 /* Win32 specific functions */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4294
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4295 defsubr (&Swin32_select_font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4296 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4297
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4298 #undef abort
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4299
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4300 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4301 win32_abort()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4302 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4303 MessageBox (NULL,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4304 "A fatal error has occurred - aborting!",
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4305 "Emacs Abort Dialog",
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4306 MB_OK|MB_ICONEXCLAMATION);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4307 abort();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4308 }
|