Mercurial > emacs
annotate src/xfns.c @ 1366:ebf903dc2d70
(custom-prin1-chars): Var defined, and renamed from prin1-chars.
(circle-tree, circle-table): Define vars.
(cust-print-vector, cust-print-list): Rename level to circle-level.
(cust-print-top-level): Likewise.
(circle-level): Var defined.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 08 Oct 1992 06:44:24 +0000 |
parents | 059624bf9bf0 |
children | 57f20a185901 |
rev | line source |
---|---|
389 | 1 /* Functions for the X window system. |
708 | 2 Copyright (C) 1989, 1992 Free Software Foundation. |
389 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
708 | 8 the Free Software Foundation; either version 2, or (at your option) |
389 | 9 any later version. |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | |
20 /* Completely rewritten by Richard Stallman. */ | |
21 | |
22 /* Rewritten for X11 by Joseph Arceneaux */ | |
23 | |
24 #if 0 | |
25 #include <stdio.h> | |
26 #endif | |
27 #include <signal.h> | |
28 #include "config.h" | |
29 #include "lisp.h" | |
30 #include "xterm.h" | |
771 | 31 #include "frame.h" |
389 | 32 #include "window.h" |
33 #include "buffer.h" | |
34 #include "dispextern.h" | |
35 #include "xscrollbar.h" | |
515 | 36 #include "keyboard.h" |
389 | 37 |
38 #ifdef HAVE_X_WINDOWS | |
39 extern void abort (); | |
40 | |
41 #define min(a,b) ((a) < (b) ? (a) : (b)) | |
42 #define max(a,b) ((a) > (b) ? (a) : (b)) | |
43 | |
44 #ifdef HAVE_X11 | |
45 /* X Resource data base */ | |
46 static XrmDatabase xrdb; | |
47 | |
48 /* The class of this X application. */ | |
49 #define EMACS_CLASS "Emacs" | |
50 | |
51 /* Title name and application name for X stuff. */ | |
398 | 52 extern char *x_id_name; |
389 | 53 extern Lisp_Object invocation_name; |
54 | |
55 /* The background and shape of the mouse pointer, and shape when not | |
56 over text or in the modeline. */ | |
57 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; | |
58 | |
59 /* Color of chars displayed in cursor box. */ | |
60 Lisp_Object Vx_cursor_fore_pixel; | |
61 | |
62 /* If non-nil, use vertical bar cursor. */ | |
63 Lisp_Object Vbar_cursor; | |
64 | |
65 /* The X Visual we are using for X windows (the default) */ | |
66 Visual *screen_visual; | |
67 | |
68 /* How many screens this X display has. */ | |
69 int x_screen_count; | |
70 | |
71 /* The vendor supporting this X server. */ | |
72 Lisp_Object Vx_vendor; | |
73 | |
74 /* The vendor's release number for this X server. */ | |
75 int x_release; | |
76 | |
77 /* Height of this X screen in pixels. */ | |
78 int x_screen_height; | |
79 | |
80 /* Height of this X screen in millimeters. */ | |
81 int x_screen_height_mm; | |
82 | |
83 /* Width of this X screen in pixels. */ | |
84 int x_screen_width; | |
85 | |
86 /* Width of this X screen in millimeters. */ | |
87 int x_screen_width_mm; | |
88 | |
89 /* Does this X screen do backing store? */ | |
90 Lisp_Object Vx_backing_store; | |
91 | |
92 /* Does this X screen do save-unders? */ | |
93 int x_save_under; | |
94 | |
95 /* Number of planes for this screen. */ | |
96 int x_screen_planes; | |
97 | |
98 /* X Visual type of this screen. */ | |
99 Lisp_Object Vx_screen_visual; | |
100 | |
101 /* Non nil if no window manager is in use. */ | |
102 Lisp_Object Vx_no_window_manager; | |
103 | |
104 static char *x_visual_strings[] = | |
105 { | |
106 "StaticGray", | |
107 "GrayScale", | |
108 "StaticColor", | |
109 "PseudoColor", | |
110 "TrueColor", | |
111 "DirectColor" | |
112 }; | |
113 | |
114 /* `t' if a mouse button is depressed. */ | |
115 | |
116 Lisp_Object Vmouse_depressed; | |
117 | |
700
6a15fb0422ef
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
697
diff
changeset
|
118 extern unsigned int x_mouse_x, x_mouse_y, x_mouse_grabbed; |
6a15fb0422ef
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
697
diff
changeset
|
119 extern Lisp_Object unread_command_char; |
6a15fb0422ef
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
697
diff
changeset
|
120 |
389 | 121 /* Atom for indicating window state to the window manager. */ |
122 Atom Xatom_wm_change_state; | |
123 | |
124 /* When emacs became the selection owner. */ | |
125 extern Time x_begin_selection_own; | |
126 | |
127 /* The value of the current emacs selection. */ | |
128 extern Lisp_Object Vx_selection_value; | |
129 | |
130 /* Emacs' selection property identifier. */ | |
131 extern Atom Xatom_emacs_selection; | |
132 | |
133 /* Clipboard selection atom. */ | |
134 extern Atom Xatom_clipboard_selection; | |
135 | |
136 /* Clipboard atom. */ | |
137 extern Atom Xatom_clipboard; | |
138 | |
139 /* Atom for indicating incremental selection transfer. */ | |
140 extern Atom Xatom_incremental; | |
141 | |
142 /* Atom for indicating multiple selection request list */ | |
143 extern Atom Xatom_multiple; | |
144 | |
145 /* Atom for what targets emacs handles. */ | |
146 extern Atom Xatom_targets; | |
147 | |
148 /* Atom for indicating timstamp selection request */ | |
149 extern Atom Xatom_timestamp; | |
150 | |
151 /* Atom requesting we delete our selection. */ | |
152 extern Atom Xatom_delete; | |
153 | |
154 /* Selection magic. */ | |
155 extern Atom Xatom_insert_selection; | |
156 | |
157 /* Type of property for INSERT_SELECTION. */ | |
158 extern Atom Xatom_pair; | |
159 | |
160 /* More selection magic. */ | |
161 extern Atom Xatom_insert_property; | |
162 | |
163 /* Atom for indicating property type TEXT */ | |
164 extern Atom Xatom_text; | |
165 | |
641 | 166 /* Communication with window managers. */ |
167 extern Atom Xatom_wm_protocols; | |
168 | |
169 /* Kinds of protocol things we may receive. */ | |
170 extern Atom Xatom_wm_take_focus; | |
171 extern Atom Xatom_wm_save_yourself; | |
172 extern Atom Xatom_wm_delete_window; | |
173 | |
174 /* Other WM communication */ | |
642 | 175 extern Atom Xatom_wm_configure_denied; /* When our config request is denied */ |
176 extern Atom Xatom_wm_window_moved; /* When the WM moves us. */ | |
641 | 177 |
389 | 178 #else /* X10 */ |
179 | |
180 /* Default size of an Emacs window without scroll bar. */ | |
181 static char *default_window = "=80x24+0+0"; | |
182 | |
183 #define MAXICID 80 | |
184 char iconidentity[MAXICID]; | |
185 #define ICONTAG "emacs@" | |
186 char minibuffer_iconidentity[MAXICID]; | |
187 #define MINIBUFFER_ICONTAG "minibuffer@" | |
188 | |
189 #endif /* X10 */ | |
190 | |
191 /* The last 23 bits of the timestamp of the last mouse button event. */ | |
192 Time mouse_timestamp; | |
193 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
194 /* Evaluate this expression to rebuild the section of syms_of_xfns |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
195 that initializes and staticpros the symbols declared below. Note |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
196 that Emacs 18 has a bug that keeps C-x C-e from being able to |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
197 evaluate this expression. |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
198 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
199 (progn |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
200 ;; Accumulate a list of the symbols we want to initialize from the |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
201 ;; declarations at the top of the file. |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
202 (goto-char (point-min)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
203 (search-forward "/\*&&& symbols declared here &&&*\/\n") |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
204 (let (symbol-list) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
205 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)") |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
206 (setq symbol-list |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
207 (cons (buffer-substring (match-beginning 1) (match-end 1)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
208 symbol-list)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
209 (forward-line 1)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
210 (setq symbol-list (nreverse symbol-list)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
211 ;; Delete the section of syms_of_... where we initialize the symbols. |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
212 (search-forward "\n /\*&&& init symbols here &&&*\/\n") |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
213 (let ((start (point))) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
214 (while (looking-at "^ Q") |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
215 (forward-line 2)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
216 (kill-region start (point))) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
217 ;; Write a new symbol initialization section. |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
218 (while symbol-list |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
219 (insert (format " %s = intern (\"" (car symbol-list))) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
220 (let ((start (point))) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
221 (insert (substring (car symbol-list) 1)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
222 (subst-char-in-region start (point) ?_ ?-)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
223 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list))) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
224 (setq symbol-list (cdr symbol-list))))) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
225 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
226 */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
227 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
228 /*&&& symbols declared here &&&*/ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
229 Lisp_Object Qauto_raise; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
230 Lisp_Object Qauto_lower; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
231 Lisp_Object Qbackground_color; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
232 Lisp_Object Qborder_color; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
233 Lisp_Object Qborder_width; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
234 Lisp_Object Qcursor_color; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
235 Lisp_Object Qfont; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
236 Lisp_Object Qforeground_color; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
237 Lisp_Object Qgeometry; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
238 Lisp_Object Qhorizontal_scroll_bar; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
239 Lisp_Object Qicon_left; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
240 Lisp_Object Qicon_top; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
241 Lisp_Object Qicon_type; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
242 Lisp_Object Qiconic_startup; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
243 Lisp_Object Qinternal_border_width; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
244 Lisp_Object Qleft; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
245 Lisp_Object Qmouse_color; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
246 Lisp_Object Qparent_id; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
247 Lisp_Object Qsuppress_icon; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
248 Lisp_Object Qsuppress_initial_map; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
249 Lisp_Object Qtop; |
389 | 250 Lisp_Object Qundefined_color; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
251 Lisp_Object Qvertical_scroll_bar; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
252 Lisp_Object Qwindow_id; |
771 | 253 Lisp_Object Qx_frame_parameter; |
389 | 254 |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
255 /* The below are defined in frame.c. */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
256 extern Lisp_Object Qheight, Qminibuffer, Qname, Qnone, Qonly, Qwidth; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
257 extern Lisp_Object Qunsplittable; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
258 |
389 | 259 extern Lisp_Object Vwindow_system_version; |
260 | |
261 /* Mouse map for clicks in windows. */ | |
262 extern Lisp_Object Vglobal_mouse_map; | |
263 | |
264 /* Points to table of defined typefaces. */ | |
265 struct face *x_face_table[MAX_FACES_AND_GLYPHS]; | |
266 | |
771 | 267 /* Return the Emacs frame-object corresponding to an X window. |
268 It could be the frame's main window or an icon window. */ | |
269 | |
270 struct frame * | |
271 x_window_to_frame (wdesc) | |
389 | 272 int wdesc; |
273 { | |
771 | 274 Lisp_Object tail, frame; |
275 struct frame *f; | |
276 | |
277 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) | |
389 | 278 { |
771 | 279 frame = XCONS (tail)->car; |
280 if (XTYPE (frame) != Lisp_Frame) | |
389 | 281 continue; |
771 | 282 f = XFRAME (frame); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
283 if (FRAME_X_WINDOW (f) == wdesc |
771 | 284 || f->display.x->icon_desc == wdesc) |
285 return f; | |
389 | 286 } |
287 return 0; | |
288 } | |
289 | |
771 | 290 /* Map an X window that implements a scroll bar to the Emacs frame it |
389 | 291 belongs to. Also store in *PART a symbol identifying which part of |
292 the scroll bar it is. */ | |
293 | |
771 | 294 struct frame * |
389 | 295 x_window_to_scrollbar (wdesc, part_ptr, prefix_ptr) |
296 int wdesc; | |
297 Lisp_Object *part_ptr; | |
298 enum scroll_bar_prefix *prefix_ptr; | |
299 { | |
771 | 300 Lisp_Object tail, frame; |
301 struct frame *f; | |
302 | |
303 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) | |
389 | 304 { |
771 | 305 frame = XCONS (tail)->car; |
306 if (XTYPE (frame) != Lisp_Frame) | |
389 | 307 continue; |
308 | |
771 | 309 f = XFRAME (frame); |
389 | 310 if (part_ptr == 0 && prefix_ptr == 0) |
771 | 311 return f; |
312 | |
313 if (f->display.x->v_scrollbar == wdesc) | |
389 | 314 { |
315 *part_ptr = Qvscrollbar_part; | |
316 *prefix_ptr = VSCROLL_BAR_PREFIX; | |
771 | 317 return f; |
389 | 318 } |
771 | 319 else if (f->display.x->v_slider == wdesc) |
389 | 320 { |
321 *part_ptr = Qvslider_part; | |
322 *prefix_ptr = VSCROLL_SLIDER_PREFIX; | |
771 | 323 return f; |
389 | 324 } |
771 | 325 else if (f->display.x->v_thumbup == wdesc) |
389 | 326 { |
327 *part_ptr = Qvthumbup_part; | |
328 *prefix_ptr = VSCROLL_THUMBUP_PREFIX; | |
771 | 329 return f; |
389 | 330 } |
771 | 331 else if (f->display.x->v_thumbdown == wdesc) |
389 | 332 { |
333 *part_ptr = Qvthumbdown_part; | |
334 *prefix_ptr = VSCROLL_THUMBDOWN_PREFIX; | |
771 | 335 return f; |
389 | 336 } |
771 | 337 else if (f->display.x->h_scrollbar == wdesc) |
389 | 338 { |
339 *part_ptr = Qhscrollbar_part; | |
340 *prefix_ptr = HSCROLL_BAR_PREFIX; | |
771 | 341 return f; |
389 | 342 } |
771 | 343 else if (f->display.x->h_slider == wdesc) |
389 | 344 { |
345 *part_ptr = Qhslider_part; | |
346 *prefix_ptr = HSCROLL_SLIDER_PREFIX; | |
771 | 347 return f; |
389 | 348 } |
771 | 349 else if (f->display.x->h_thumbleft == wdesc) |
389 | 350 { |
351 *part_ptr = Qhthumbleft_part; | |
352 *prefix_ptr = HSCROLL_THUMBLEFT_PREFIX; | |
771 | 353 return f; |
389 | 354 } |
771 | 355 else if (f->display.x->h_thumbright == wdesc) |
389 | 356 { |
357 *part_ptr = Qhthumbright_part; | |
358 *prefix_ptr = HSCROLL_THUMBRIGHT_PREFIX; | |
771 | 359 return f; |
389 | 360 } |
361 } | |
362 return 0; | |
363 } | |
364 | |
771 | 365 /* Connect the frame-parameter names for X frames |
389 | 366 to the ways of passing the parameter values to the window system. |
367 | |
368 The name of a parameter, as a Lisp symbol, | |
771 | 369 has an `x-frame-parameter' property which is an integer in Lisp |
370 but can be interpreted as an `enum x_frame_parm' in C. */ | |
371 | |
372 enum x_frame_parm | |
389 | 373 { |
374 X_PARM_FOREGROUND_COLOR, | |
375 X_PARM_BACKGROUND_COLOR, | |
376 X_PARM_MOUSE_COLOR, | |
377 X_PARM_CURSOR_COLOR, | |
378 X_PARM_BORDER_COLOR, | |
379 X_PARM_ICON_TYPE, | |
380 X_PARM_FONT, | |
381 X_PARM_BORDER_WIDTH, | |
382 X_PARM_INTERNAL_BORDER_WIDTH, | |
383 X_PARM_NAME, | |
384 X_PARM_AUTORAISE, | |
385 X_PARM_AUTOLOWER, | |
386 X_PARM_VERT_SCROLLBAR, | |
387 X_PARM_HORIZ_SCROLLBAR, | |
388 }; | |
389 | |
390 | |
771 | 391 struct x_frame_parm_table |
389 | 392 { |
393 char *name; | |
771 | 394 void (*setter)( /* struct frame *frame, Lisp_Object val, oldval */ ); |
389 | 395 }; |
396 | |
397 void x_set_foreground_color (); | |
398 void x_set_background_color (); | |
399 void x_set_mouse_color (); | |
400 void x_set_cursor_color (); | |
401 void x_set_border_color (); | |
402 void x_set_icon_type (); | |
403 void x_set_font (); | |
404 void x_set_border_width (); | |
405 void x_set_internal_border_width (); | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
406 void x_explicitly_set_name (); |
389 | 407 void x_set_autoraise (); |
408 void x_set_autolower (); | |
409 void x_set_vertical_scrollbar (); | |
410 void x_set_horizontal_scrollbar (); | |
411 | |
771 | 412 static struct x_frame_parm_table x_frame_parms[] = |
389 | 413 { |
414 "foreground-color", x_set_foreground_color, | |
415 "background-color", x_set_background_color, | |
416 "mouse-color", x_set_mouse_color, | |
417 "cursor-color", x_set_cursor_color, | |
418 "border-color", x_set_border_color, | |
419 "icon-type", x_set_icon_type, | |
420 "font", x_set_font, | |
421 "border-width", x_set_border_width, | |
422 "internal-border-width", x_set_internal_border_width, | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
423 "name", x_explicitly_set_name, |
389 | 424 "autoraise", x_set_autoraise, |
425 "autolower", x_set_autolower, | |
426 "vertical-scrollbar", x_set_vertical_scrollbar, | |
427 "horizontal-scrollbar", x_set_horizontal_scrollbar, | |
428 }; | |
429 | |
771 | 430 /* Attach the `x-frame-parameter' properties to |
389 | 431 the Lisp symbol names of parameters relevant to X. */ |
432 | |
433 init_x_parm_symbols () | |
434 { | |
435 int i; | |
436 | |
771 | 437 for (i = 0; i < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]); i++) |
438 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, | |
389 | 439 make_number (i)); |
440 } | |
441 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
442 #if 1 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
443 /* Change the parameters of FRAME as specified by ALIST. |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
444 If a parameter is not specially recognized, do nothing; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
445 otherwise call the `x_set_...' function for that parameter. */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
446 void |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
447 x_set_frame_parameters (f, alist) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
448 FRAME_PTR f; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
449 Lisp_Object alist; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
450 { |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
451 Lisp_Object tail; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
452 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
453 /* If both of these parameters are present, it's more efficient to |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
454 set them both at once. So we wait until we've looked at the |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
455 entire list before we set them. */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
456 Lisp_Object width, height; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
457 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
458 /* Same here. */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
459 Lisp_Object left, top; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
460 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
461 XSET (width, Lisp_Int, FRAME_WIDTH (f)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
462 XSET (height, Lisp_Int, FRAME_HEIGHT (f)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
463 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
464 XSET (top, Lisp_Int, f->display.x->top_pos); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
465 XSET (left, Lisp_Int, f->display.x->left_pos); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
466 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
467 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
468 { |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
469 Lisp_Object elt, prop, val; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
470 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
471 elt = Fcar (tail); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
472 prop = Fcar (elt); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
473 val = Fcdr (elt); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
474 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
475 if (EQ (prop, Qwidth)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
476 width = val; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
477 else if (EQ (prop, Qheight)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
478 height = val; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
479 else if (EQ (prop, Qtop)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
480 top = val; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
481 else if (EQ (prop, Qleft)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
482 left = val; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
483 else |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
484 { |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
485 register Lisp_Object tem; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
486 tem = Fget (prop, Qx_frame_parameter); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
487 if (XTYPE (tem) == Lisp_Int |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
488 && XINT (tem) >= 0 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
489 && XINT (tem) < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
490 (*x_frame_parms[XINT (tem)].setter)(f, val, |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
491 get_frame_param (f, prop)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
492 store_frame_param (f, prop, val); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
493 } |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
494 } |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
495 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
496 /* Don't call these unless they've changed; the window may not actually |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
497 exist yet. */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
498 { |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
499 Lisp_Object frame; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
500 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
501 XSET (frame, Lisp_Frame, f); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
502 if (XINT (width) != FRAME_WIDTH (f) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
503 || XINT (height) != FRAME_HEIGHT (f)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
504 Fset_frame_size (frame, width, height); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
505 if (XINT (left) != f->display.x->left_pos |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
506 || XINT (top) != f->display.x->top_pos) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
507 Fset_frame_position (frame, left, top); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
508 } |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
509 } |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
510 #else |
771 | 511 /* Report to X that a frame parameter of frame F is being set or changed. |
389 | 512 PARAM is the symbol that says which parameter. |
513 VAL is the new value. | |
514 OLDVAL is the old value. | |
515 If the parameter is not specially recognized, do nothing; | |
516 otherwise the `x_set_...' function for this parameter. */ | |
517 | |
518 void | |
771 | 519 x_set_frame_param (f, param, val, oldval) |
520 register struct frame *f; | |
389 | 521 Lisp_Object param; |
522 register Lisp_Object val; | |
523 register Lisp_Object oldval; | |
524 { | |
525 register Lisp_Object tem; | |
771 | 526 tem = Fget (param, Qx_frame_parameter); |
389 | 527 if (XTYPE (tem) == Lisp_Int |
528 && XINT (tem) >= 0 | |
771 | 529 && XINT (tem) < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])) |
530 (*x_frame_parms[XINT (tem)].setter)(f, val, oldval); | |
389 | 531 } |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
532 #endif |
771 | 533 /* Insert a description of internally-recorded parameters of frame X |
389 | 534 into the parameter alist *ALISTPTR that is to be given to the user. |
535 Only parameters that are specific to the X window system | |
771 | 536 and whose values are not correctly recorded in the frame's |
389 | 537 param_alist need to be considered here. */ |
538 | |
771 | 539 x_report_frame_params (f, alistptr) |
540 struct frame *f; | |
389 | 541 Lisp_Object *alistptr; |
542 { | |
543 char buf[16]; | |
544 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
545 store_in_alist (alistptr, Qleft, make_number (f->display.x->left_pos)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
546 store_in_alist (alistptr, Qtop, make_number (f->display.x->top_pos)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
547 store_in_alist (alistptr, Qborder_width, |
771 | 548 make_number (f->display.x->border_width)); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
549 store_in_alist (alistptr, Qinternal_border_width, |
771 | 550 make_number (f->display.x->internal_border_width)); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
551 sprintf (buf, "%d", FRAME_X_WINDOW (f)); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
552 store_in_alist (alistptr, Qwindow_id, |
389 | 553 build_string (buf)); |
554 } | |
555 | |
556 /* Decide if color named COLOR is valid for the display | |
771 | 557 associated with the selected frame. */ |
389 | 558 int |
559 defined_color (color, color_def) | |
560 char *color; | |
561 Color *color_def; | |
562 { | |
563 register int foo; | |
564 Colormap screen_colormap; | |
565 | |
566 BLOCK_INPUT; | |
567 #ifdef HAVE_X11 | |
568 screen_colormap | |
569 = DefaultColormap (x_current_display, XDefaultScreen (x_current_display)); | |
570 | |
571 foo = XParseColor (x_current_display, screen_colormap, | |
572 color, color_def) | |
573 && XAllocColor (x_current_display, screen_colormap, color_def); | |
574 #else | |
575 foo = XParseColor (color, color_def) && XGetHardwareColor (color_def); | |
576 #endif /* not HAVE_X11 */ | |
577 UNBLOCK_INPUT; | |
578 | |
579 if (foo) | |
580 return 1; | |
581 else | |
582 return 0; | |
583 } | |
584 | |
585 /* Given a string ARG naming a color, compute a pixel value from it | |
771 | 586 suitable for screen F. |
587 If F is not a color screen, return DEF (default) regardless of what | |
389 | 588 ARG says. */ |
589 | |
590 int | |
591 x_decode_color (arg, def) | |
592 Lisp_Object arg; | |
593 int def; | |
594 { | |
595 Color cdef; | |
596 | |
597 CHECK_STRING (arg, 0); | |
598 | |
599 if (strcmp (XSTRING (arg)->data, "black") == 0) | |
600 return BLACK_PIX_DEFAULT; | |
601 else if (strcmp (XSTRING (arg)->data, "white") == 0) | |
602 return WHITE_PIX_DEFAULT; | |
603 | |
604 #ifdef HAVE_X11 | |
485 | 605 if (XFASTINT (x_screen_planes) == 1) |
389 | 606 return def; |
607 #else | |
485 | 608 if (DISPLAY_CELLS == 1) |
389 | 609 return def; |
610 #endif | |
611 | |
612 if (defined_color (XSTRING (arg)->data, &cdef)) | |
613 return cdef.pixel; | |
614 else | |
615 Fsignal (Qundefined_color, Fcons (arg, Qnil)); | |
616 } | |
617 | |
771 | 618 /* Functions called only from `x_set_frame_param' |
389 | 619 to set individual parameters. |
620 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
621 If FRAME_X_WINDOW (f) is 0, |
771 | 622 the frame is being created and its X-window does not exist yet. |
389 | 623 In that case, just record the parameter's new value |
624 in the standard place; do not attempt to change the window. */ | |
625 | |
626 void | |
771 | 627 x_set_foreground_color (f, arg, oldval) |
628 struct frame *f; | |
389 | 629 Lisp_Object arg, oldval; |
630 { | |
771 | 631 f->display.x->foreground_pixel = x_decode_color (arg, BLACK_PIX_DEFAULT); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
632 if (FRAME_X_WINDOW (f) != 0) |
389 | 633 { |
634 #ifdef HAVE_X11 | |
635 BLOCK_INPUT; | |
771 | 636 XSetForeground (x_current_display, f->display.x->normal_gc, |
637 f->display.x->foreground_pixel); | |
638 XSetBackground (x_current_display, f->display.x->reverse_gc, | |
639 f->display.x->foreground_pixel); | |
640 if (f->display.x->v_scrollbar) | |
389 | 641 { |
642 Pixmap up_arrow_pixmap, down_arrow_pixmap, slider_pixmap; | |
643 | |
771 | 644 XSetWindowBorder (x_current_display, f->display.x->v_scrollbar, |
645 f->display.x->foreground_pixel); | |
389 | 646 |
647 slider_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
648 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 649 gray_bits, 16, 16, |
771 | 650 f->display.x->foreground_pixel, |
651 f->display.x->background_pixel, | |
389 | 652 DefaultDepth (x_current_display, |
653 XDefaultScreen (x_current_display))); | |
654 up_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
655 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 656 up_arrow_bits, 16, 16, |
771 | 657 f->display.x->foreground_pixel, |
658 f->display.x->background_pixel, | |
389 | 659 DefaultDepth (x_current_display, |
660 XDefaultScreen (x_current_display))); | |
661 down_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
662 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 663 down_arrow_bits, 16, 16, |
771 | 664 f->display.x->foreground_pixel, |
665 f->display.x->background_pixel, | |
389 | 666 DefaultDepth (x_current_display, |
667 XDefaultScreen (x_current_display))); | |
668 | |
771 | 669 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbup, |
389 | 670 up_arrow_pixmap); |
771 | 671 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbdown, |
389 | 672 down_arrow_pixmap); |
771 | 673 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_slider, |
389 | 674 slider_pixmap); |
675 | |
771 | 676 XClearWindow (XDISPLAY f->display.x->v_thumbup); |
677 XClearWindow (XDISPLAY f->display.x->v_thumbdown); | |
678 XClearWindow (XDISPLAY f->display.x->v_slider); | |
389 | 679 |
680 XFreePixmap (x_current_display, down_arrow_pixmap); | |
681 XFreePixmap (x_current_display, up_arrow_pixmap); | |
682 XFreePixmap (x_current_display, slider_pixmap); | |
683 } | |
771 | 684 if (f->display.x->h_scrollbar) |
389 | 685 { |
686 Pixmap left_arrow_pixmap, right_arrow_pixmap, slider_pixmap; | |
687 | |
771 | 688 XSetWindowBorder (x_current_display, f->display.x->h_scrollbar, |
689 f->display.x->foreground_pixel); | |
389 | 690 |
691 slider_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
692 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 693 gray_bits, 16, 16, |
771 | 694 f->display.x->foreground_pixel, |
695 f->display.x->background_pixel, | |
389 | 696 DefaultDepth (x_current_display, |
697 XDefaultScreen (x_current_display))); | |
698 | |
699 left_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
700 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 701 up_arrow_bits, 16, 16, |
771 | 702 f->display.x->foreground_pixel, |
703 f->display.x->background_pixel, | |
389 | 704 DefaultDepth (x_current_display, |
705 XDefaultScreen (x_current_display))); | |
706 right_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
707 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 708 down_arrow_bits, 16, 16, |
771 | 709 f->display.x->foreground_pixel, |
710 f->display.x->background_pixel, | |
389 | 711 DefaultDepth (x_current_display, |
712 XDefaultScreen (x_current_display))); | |
713 | |
771 | 714 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_slider, |
389 | 715 slider_pixmap); |
771 | 716 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbleft, |
389 | 717 left_arrow_pixmap); |
771 | 718 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbright, |
389 | 719 right_arrow_pixmap); |
720 | |
771 | 721 XClearWindow (XDISPLAY f->display.x->h_thumbleft); |
722 XClearWindow (XDISPLAY f->display.x->h_thumbright); | |
723 XClearWindow (XDISPLAY f->display.x->h_slider); | |
389 | 724 |
725 XFreePixmap (x_current_display, slider_pixmap); | |
726 XFreePixmap (x_current_display, left_arrow_pixmap); | |
727 XFreePixmap (x_current_display, right_arrow_pixmap); | |
728 } | |
729 UNBLOCK_INPUT; | |
730 #endif /* HAVE_X11 */ | |
771 | 731 if (f->visible) |
732 redraw_frame (f); | |
389 | 733 } |
734 } | |
735 | |
736 void | |
771 | 737 x_set_background_color (f, arg, oldval) |
738 struct frame *f; | |
389 | 739 Lisp_Object arg, oldval; |
740 { | |
741 Pixmap temp; | |
742 int mask; | |
743 | |
771 | 744 f->display.x->background_pixel = x_decode_color (arg, WHITE_PIX_DEFAULT); |
745 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
746 if (FRAME_X_WINDOW (f) != 0) |
389 | 747 { |
748 BLOCK_INPUT; | |
749 #ifdef HAVE_X11 | |
771 | 750 /* The main frame area. */ |
751 XSetBackground (x_current_display, f->display.x->normal_gc, | |
752 f->display.x->background_pixel); | |
753 XSetForeground (x_current_display, f->display.x->reverse_gc, | |
754 f->display.x->background_pixel); | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
755 XSetWindowBackground (x_current_display, FRAME_X_WINDOW (f), |
771 | 756 f->display.x->background_pixel); |
389 | 757 |
758 /* Scroll bars. */ | |
771 | 759 if (f->display.x->v_scrollbar) |
389 | 760 { |
761 Pixmap up_arrow_pixmap, down_arrow_pixmap, slider_pixmap; | |
762 | |
771 | 763 XSetWindowBackground (x_current_display, f->display.x->v_scrollbar, |
764 f->display.x->background_pixel); | |
389 | 765 |
766 slider_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
767 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 768 gray_bits, 16, 16, |
771 | 769 f->display.x->foreground_pixel, |
770 f->display.x->background_pixel, | |
389 | 771 DefaultDepth (x_current_display, |
772 XDefaultScreen (x_current_display))); | |
773 up_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
774 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 775 up_arrow_bits, 16, 16, |
771 | 776 f->display.x->foreground_pixel, |
777 f->display.x->background_pixel, | |
389 | 778 DefaultDepth (x_current_display, |
779 XDefaultScreen (x_current_display))); | |
780 down_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
781 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 782 down_arrow_bits, 16, 16, |
771 | 783 f->display.x->foreground_pixel, |
784 f->display.x->background_pixel, | |
389 | 785 DefaultDepth (x_current_display, |
786 XDefaultScreen (x_current_display))); | |
787 | |
771 | 788 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbup, |
389 | 789 up_arrow_pixmap); |
771 | 790 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbdown, |
389 | 791 down_arrow_pixmap); |
771 | 792 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_slider, |
389 | 793 slider_pixmap); |
794 | |
771 | 795 XClearWindow (XDISPLAY f->display.x->v_thumbup); |
796 XClearWindow (XDISPLAY f->display.x->v_thumbdown); | |
797 XClearWindow (XDISPLAY f->display.x->v_slider); | |
389 | 798 |
799 XFreePixmap (x_current_display, down_arrow_pixmap); | |
800 XFreePixmap (x_current_display, up_arrow_pixmap); | |
801 XFreePixmap (x_current_display, slider_pixmap); | |
802 } | |
771 | 803 if (f->display.x->h_scrollbar) |
389 | 804 { |
805 Pixmap left_arrow_pixmap, right_arrow_pixmap, slider_pixmap; | |
806 | |
771 | 807 XSetWindowBackground (x_current_display, f->display.x->h_scrollbar, |
808 f->display.x->background_pixel); | |
389 | 809 |
810 slider_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
811 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 812 gray_bits, 16, 16, |
771 | 813 f->display.x->foreground_pixel, |
814 f->display.x->background_pixel, | |
389 | 815 DefaultDepth (x_current_display, |
816 XDefaultScreen (x_current_display))); | |
817 | |
818 left_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
819 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 820 up_arrow_bits, 16, 16, |
771 | 821 f->display.x->foreground_pixel, |
822 f->display.x->background_pixel, | |
389 | 823 DefaultDepth (x_current_display, |
824 XDefaultScreen (x_current_display))); | |
825 right_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
826 XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f), |
389 | 827 down_arrow_bits, 16, 16, |
771 | 828 f->display.x->foreground_pixel, |
829 f->display.x->background_pixel, | |
389 | 830 DefaultDepth (x_current_display, |
831 XDefaultScreen (x_current_display))); | |
832 | |
771 | 833 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_slider, |
389 | 834 slider_pixmap); |
771 | 835 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbleft, |
389 | 836 left_arrow_pixmap); |
771 | 837 XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbright, |
389 | 838 right_arrow_pixmap); |
839 | |
771 | 840 XClearWindow (XDISPLAY f->display.x->h_thumbleft); |
841 XClearWindow (XDISPLAY f->display.x->h_thumbright); | |
842 XClearWindow (XDISPLAY f->display.x->h_slider); | |
389 | 843 |
844 XFreePixmap (x_current_display, slider_pixmap); | |
845 XFreePixmap (x_current_display, left_arrow_pixmap); | |
846 XFreePixmap (x_current_display, right_arrow_pixmap); | |
847 } | |
848 #else | |
771 | 849 temp = XMakeTile (f->display.x->background_pixel); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
850 XChangeBackground (FRAME_X_WINDOW (f), temp); |
389 | 851 XFreePixmap (temp); |
852 #endif /* not HAVE_X11 */ | |
853 UNBLOCK_INPUT; | |
854 | |
771 | 855 if (f->visible) |
856 redraw_frame (f); | |
389 | 857 } |
858 } | |
859 | |
860 void | |
771 | 861 x_set_mouse_color (f, arg, oldval) |
862 struct frame *f; | |
389 | 863 Lisp_Object arg, oldval; |
864 { | |
865 Cursor cursor, nontext_cursor, mode_cursor; | |
866 int mask_color; | |
867 | |
868 if (!EQ (Qnil, arg)) | |
771 | 869 f->display.x->mouse_pixel = x_decode_color (arg, BLACK_PIX_DEFAULT); |
870 mask_color = f->display.x->background_pixel; | |
389 | 871 /* No invisible pointers. */ |
771 | 872 if (mask_color == f->display.x->mouse_pixel |
873 && mask_color == f->display.x->background_pixel) | |
874 f->display.x->mouse_pixel = f->display.x->foreground_pixel; | |
389 | 875 |
876 BLOCK_INPUT; | |
877 #ifdef HAVE_X11 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
878 |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
879 /* It's not okay to crash if the user selects a screwey cursor. */ |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
880 x_catch_errors (); |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
881 |
389 | 882 if (!EQ (Qnil, Vx_pointer_shape)) |
883 { | |
884 CHECK_NUMBER (Vx_pointer_shape, 0); | |
885 cursor = XCreateFontCursor (x_current_display, XINT (Vx_pointer_shape)); | |
886 } | |
887 else | |
888 cursor = XCreateFontCursor (x_current_display, XC_xterm); | |
889 | |
890 if (!EQ (Qnil, Vx_nontext_pointer_shape)) | |
891 { | |
892 CHECK_NUMBER (Vx_nontext_pointer_shape, 0); | |
893 nontext_cursor = XCreateFontCursor (x_current_display, | |
894 XINT (Vx_nontext_pointer_shape)); | |
895 } | |
896 else | |
897 nontext_cursor = XCreateFontCursor (x_current_display, XC_left_ptr); | |
898 | |
899 if (!EQ (Qnil, Vx_mode_pointer_shape)) | |
900 { | |
901 CHECK_NUMBER (Vx_mode_pointer_shape, 0); | |
902 mode_cursor = XCreateFontCursor (x_current_display, | |
903 XINT (Vx_mode_pointer_shape)); | |
904 } | |
905 else | |
906 mode_cursor = XCreateFontCursor (x_current_display, XC_xterm); | |
907 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
908 /* Check and report errors with the above calls. */ |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
909 x_check_errors ("can't set cursor shape: %s"); |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
910 x_uncatch_errors (); |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
911 |
389 | 912 { |
913 XColor fore_color, back_color; | |
914 | |
771 | 915 fore_color.pixel = f->display.x->mouse_pixel; |
389 | 916 back_color.pixel = mask_color; |
917 XQueryColor (x_current_display, | |
918 DefaultColormap (x_current_display, | |
919 DefaultScreen (x_current_display)), | |
920 &fore_color); | |
921 XQueryColor (x_current_display, | |
922 DefaultColormap (x_current_display, | |
923 DefaultScreen (x_current_display)), | |
924 &back_color); | |
925 XRecolorCursor (x_current_display, cursor, | |
926 &fore_color, &back_color); | |
927 XRecolorCursor (x_current_display, nontext_cursor, | |
928 &fore_color, &back_color); | |
929 XRecolorCursor (x_current_display, mode_cursor, | |
930 &fore_color, &back_color); | |
931 } | |
932 #else /* X10 */ | |
933 cursor = XCreateCursor (16, 16, MouseCursor, MouseMask, | |
934 0, 0, | |
771 | 935 f->display.x->mouse_pixel, |
936 f->display.x->background_pixel, | |
389 | 937 GXcopy); |
938 #endif /* X10 */ | |
939 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
940 if (FRAME_X_WINDOW (f) != 0) |
389 | 941 { |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
942 XDefineCursor (XDISPLAY FRAME_X_WINDOW (f), cursor); |
389 | 943 } |
944 | |
771 | 945 if (cursor != f->display.x->text_cursor && f->display.x->text_cursor != 0) |
946 XFreeCursor (XDISPLAY f->display.x->text_cursor); | |
947 f->display.x->text_cursor = cursor; | |
389 | 948 #ifdef HAVE_X11 |
771 | 949 if (nontext_cursor != f->display.x->nontext_cursor |
950 && f->display.x->nontext_cursor != 0) | |
951 XFreeCursor (XDISPLAY f->display.x->nontext_cursor); | |
952 f->display.x->nontext_cursor = nontext_cursor; | |
953 | |
954 if (mode_cursor != f->display.x->modeline_cursor | |
955 && f->display.x->modeline_cursor != 0) | |
956 XFreeCursor (XDISPLAY f->display.x->modeline_cursor); | |
957 f->display.x->modeline_cursor = mode_cursor; | |
389 | 958 #endif /* HAVE_X11 */ |
959 | |
960 XFlushQueue (); | |
961 UNBLOCK_INPUT; | |
962 } | |
963 | |
964 void | |
771 | 965 x_set_cursor_color (f, arg, oldval) |
966 struct frame *f; | |
389 | 967 Lisp_Object arg, oldval; |
968 { | |
969 unsigned long fore_pixel; | |
970 | |
971 if (!EQ (Vx_cursor_fore_pixel, Qnil)) | |
972 fore_pixel = x_decode_color (Vx_cursor_fore_pixel, WHITE_PIX_DEFAULT); | |
973 else | |
771 | 974 fore_pixel = f->display.x->background_pixel; |
975 f->display.x->cursor_pixel = x_decode_color (arg, BLACK_PIX_DEFAULT); | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
976 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
977 /* Make sure that the cursor color differs from the background color. */ |
771 | 978 if (f->display.x->cursor_pixel == f->display.x->background_pixel) |
389 | 979 { |
771 | 980 f->display.x->cursor_pixel == f->display.x->mouse_pixel; |
981 if (f->display.x->cursor_pixel == fore_pixel) | |
982 fore_pixel = f->display.x->background_pixel; | |
389 | 983 } |
984 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
985 if (FRAME_X_WINDOW (f) != 0) |
389 | 986 { |
987 #ifdef HAVE_X11 | |
988 BLOCK_INPUT; | |
771 | 989 XSetBackground (x_current_display, f->display.x->cursor_gc, |
990 f->display.x->cursor_pixel); | |
991 XSetForeground (x_current_display, f->display.x->cursor_gc, | |
389 | 992 fore_pixel); |
993 UNBLOCK_INPUT; | |
994 #endif /* HAVE_X11 */ | |
995 | |
771 | 996 if (f->visible) |
389 | 997 { |
771 | 998 x_display_cursor (f, 0); |
999 x_display_cursor (f, 1); | |
389 | 1000 } |
1001 } | |
1002 } | |
1003 | |
771 | 1004 /* Set the border-color of frame F to value described by ARG. |
389 | 1005 ARG can be a string naming a color. |
1006 The border-color is used for the border that is drawn by the X server. | |
1007 Note that this does not fully take effect if done before | |
771 | 1008 F has an x-window; it must be redone when the window is created. |
389 | 1009 |
1010 Note: this is done in two routines because of the way X10 works. | |
1011 | |
1012 Note: under X11, this is normally the province of the window manager, | |
1013 and so emacs' border colors may be overridden. */ | |
1014 | |
1015 void | |
771 | 1016 x_set_border_color (f, arg, oldval) |
1017 struct frame *f; | |
389 | 1018 Lisp_Object arg, oldval; |
1019 { | |
1020 unsigned char *str; | |
1021 int pix; | |
1022 | |
1023 CHECK_STRING (arg, 0); | |
1024 str = XSTRING (arg)->data; | |
1025 | |
1026 #ifndef HAVE_X11 | |
1027 if (!strcmp (str, "grey") || !strcmp (str, "Grey") | |
1028 || !strcmp (str, "gray") || !strcmp (str, "Gray")) | |
1029 pix = -1; | |
1030 else | |
1031 #endif /* X10 */ | |
1032 | |
1033 pix = x_decode_color (arg, BLACK_PIX_DEFAULT); | |
1034 | |
771 | 1035 x_set_border_pixel (f, pix); |
389 | 1036 } |
1037 | |
771 | 1038 /* Set the border-color of frame F to pixel value PIX. |
389 | 1039 Note that this does not fully take effect if done before |
771 | 1040 F has an x-window. */ |
1041 | |
1042 x_set_border_pixel (f, pix) | |
1043 struct frame *f; | |
389 | 1044 int pix; |
1045 { | |
771 | 1046 f->display.x->border_pixel = pix; |
1047 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1048 if (FRAME_X_WINDOW (f) != 0 && f->display.x->border_width > 0) |
389 | 1049 { |
1050 Pixmap temp; | |
1051 int mask; | |
1052 | |
1053 BLOCK_INPUT; | |
1054 #ifdef HAVE_X11 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1055 XSetWindowBorder (x_current_display, FRAME_X_WINDOW (f), |
389 | 1056 pix); |
771 | 1057 if (f->display.x->h_scrollbar) |
1058 XSetWindowBorder (x_current_display, f->display.x->h_slider, | |
389 | 1059 pix); |
771 | 1060 if (f->display.x->v_scrollbar) |
1061 XSetWindowBorder (x_current_display, f->display.x->v_slider, | |
389 | 1062 pix); |
1063 #else | |
1064 if (pix < 0) | |
1065 temp = XMakePixmap ((Bitmap) XStoreBitmap (16, 16, gray_bits), | |
1066 BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT); | |
1067 else | |
1068 temp = XMakeTile (pix); | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1069 XChangeBorder (FRAME_X_WINDOW (f), temp); |
389 | 1070 XFreePixmap (XDISPLAY temp); |
1071 #endif /* not HAVE_X11 */ | |
1072 UNBLOCK_INPUT; | |
1073 | |
771 | 1074 if (f->visible) |
1075 redraw_frame (f); | |
389 | 1076 } |
1077 } | |
1078 | |
1079 void | |
771 | 1080 x_set_icon_type (f, arg, oldval) |
1081 struct frame *f; | |
389 | 1082 Lisp_Object arg, oldval; |
1083 { | |
1084 Lisp_Object tem; | |
1085 int result; | |
1086 | |
1087 if (EQ (oldval, Qnil) == EQ (arg, Qnil)) | |
1088 return; | |
1089 | |
1090 BLOCK_INPUT; | |
485 | 1091 if (NILP (arg)) |
771 | 1092 result = x_text_icon (f, 0); |
389 | 1093 else |
771 | 1094 result = x_bitmap_icon (f, 0); |
389 | 1095 |
1096 if (result) | |
1097 { | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1098 UNBLOCK_INPUT; |
389 | 1099 error ("No icon window available."); |
1100 } | |
1101 | |
1102 /* If the window was unmapped (and its icon was mapped), | |
1103 the new icon is not mapped, so map the window in its stead. */ | |
771 | 1104 if (f->visible) |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1105 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
389 | 1106 |
1107 XFlushQueue (); | |
1108 UNBLOCK_INPUT; | |
1109 } | |
1110 | |
1111 void | |
771 | 1112 x_set_font (f, arg, oldval) |
1113 struct frame *f; | |
389 | 1114 Lisp_Object arg, oldval; |
1115 { | |
1116 unsigned char *name; | |
1117 int result; | |
1118 | |
1119 CHECK_STRING (arg, 1); | |
1120 name = XSTRING (arg)->data; | |
1121 | |
1122 BLOCK_INPUT; | |
771 | 1123 result = x_new_font (f, name); |
389 | 1124 UNBLOCK_INPUT; |
1125 | |
1126 if (result) | |
1127 error ("Font \"%s\" is not defined", name); | |
1128 } | |
1129 | |
1130 void | |
771 | 1131 x_set_border_width (f, arg, oldval) |
1132 struct frame *f; | |
389 | 1133 Lisp_Object arg, oldval; |
1134 { | |
1135 CHECK_NUMBER (arg, 0); | |
1136 | |
771 | 1137 if (XINT (arg) == f->display.x->border_width) |
389 | 1138 return; |
1139 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1140 if (FRAME_X_WINDOW (f) != 0) |
389 | 1141 error ("Cannot change the border width of a window"); |
1142 | |
771 | 1143 f->display.x->border_width = XINT (arg); |
389 | 1144 } |
1145 | |
1146 void | |
771 | 1147 x_set_internal_border_width (f, arg, oldval) |
1148 struct frame *f; | |
389 | 1149 Lisp_Object arg, oldval; |
1150 { | |
1151 int mask; | |
771 | 1152 int old = f->display.x->internal_border_width; |
389 | 1153 |
1154 CHECK_NUMBER (arg, 0); | |
771 | 1155 f->display.x->internal_border_width = XINT (arg); |
1156 if (f->display.x->internal_border_width < 0) | |
1157 f->display.x->internal_border_width = 0; | |
1158 | |
1159 if (f->display.x->internal_border_width == old) | |
389 | 1160 return; |
1161 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1162 if (FRAME_X_WINDOW (f) != 0) |
389 | 1163 { |
1164 BLOCK_INPUT; | |
771 | 1165 x_set_window_size (f, f->width, f->height); |
389 | 1166 #if 0 |
771 | 1167 x_set_resize_hint (f); |
389 | 1168 #endif |
1169 XFlushQueue (); | |
1170 UNBLOCK_INPUT; | |
771 | 1171 SET_FRAME_GARBAGED (f); |
389 | 1172 } |
1173 } | |
1174 | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1175 void x_user_set_name (f, arg, oldval) |
771 | 1176 struct frame *f; |
389 | 1177 Lisp_Object arg, oldval; |
1178 { | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1179 } |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1180 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1181 /* Change the name of frame F to ARG. If ARG is nil, set F's name to |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1182 x_id_name. |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1183 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1184 If EXPLICIT is non-zero, that indicates that lisp code is setting the |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1185 name; if ARG is a string, set F's name to ARG and set |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1186 F->explicit_name; if ARG is Qnil, then clear F->explicit_name. |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1187 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1188 If EXPLICIT is zero, that indicates that Emacs redisplay code is |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1189 suggesting a new name, which lisp code should override; if |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1190 F->explicit_name is set, ignore the new name; otherwise, set it. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1191 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1192 void |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1193 x_set_name (f, name, explicit) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1194 struct frame *f; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1195 Lisp_Object name; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1196 int explicit; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1197 { |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1198 /* Make sure that requests from lisp code override requests from |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1199 Emacs redisplay code. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1200 if (explicit) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1201 { |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1202 /* If we're switching from explicit to implicit, we had better |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1203 update the mode lines and thereby update the title. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1204 if (f->explicit_name && NILP (name)) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1205 update_mode_lines; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1206 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1207 f->explicit_name = ! NILP (name); |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1208 } |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1209 else if (f->explicit_name) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1210 return; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1211 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1212 /* If NAME is nil, set the name to the x_id_name. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1213 if (NILP (name)) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1214 name = build_string (x_id_name); |
833 | 1215 else |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1216 CHECK_STRING (name, 0); |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1217 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1218 /* Don't change the name if it's already NAME. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1219 if (! NILP (Fstring_equal (name, f->name))) |
727 | 1220 return; |
1221 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1222 if (FRAME_X_WINDOW (f)) |
389 | 1223 { |
708 | 1224 BLOCK_INPUT; |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1225 |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1226 #ifdef HAVE_X11R4 |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1227 { |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1228 XTextProperty text; |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1229 text.value = XSTRING (name)->data; |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1230 text.encoding = XA_STRING; |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1231 text.format = 8; |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1232 text.nitems = XSTRING (name)->size; |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1233 XSetWMName (x_current_display, FRAME_X_WINDOW (f), &text); |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1234 XSetWMIconName (x_current_display, FRAME_X_WINDOW (f), &text); |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1235 } |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1236 #else |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1237 XSetIconName (XDISPLAY FRAME_X_WINDOW (f), |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1238 XSTRING (name)->data); |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1239 XStoreName (XDISPLAY FRAME_X_WINDOW (f), |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1240 XSTRING (name)->data); |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1241 #endif |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1242 |
708 | 1243 UNBLOCK_INPUT; |
389 | 1244 } |
727 | 1245 |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1246 f->name = name; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1247 } |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1248 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1249 /* This function should be called when the user's lisp code has |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1250 specified a name for the frame; the name will override any set by the |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1251 redisplay code. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1252 void |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1253 x_explicitly_set_name (f, arg, oldval) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1254 FRAME_PTR f; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1255 Lisp_Object arg, oldval; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1256 { |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1257 x_set_name (f, arg, 1); |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1258 } |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1259 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1260 /* This function should be called by Emacs redisplay code to set the |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1261 name; names set this way will never override names set by the user's |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1262 lisp code. */ |
1125
059624bf9bf0
Declare x_implicitly_set_name to be void.
Jim Blandy <jimb@redhat.com>
parents:
1096
diff
changeset
|
1263 void |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1264 x_implicitly_set_name (f, arg, oldval) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1265 FRAME_PTR f; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1266 Lisp_Object arg, oldval; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1267 { |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1268 x_set_name (f, arg, 0); |
389 | 1269 } |
1270 | |
1271 void | |
771 | 1272 x_set_autoraise (f, arg, oldval) |
1273 struct frame *f; | |
389 | 1274 Lisp_Object arg, oldval; |
1275 { | |
771 | 1276 f->auto_raise = !EQ (Qnil, arg); |
389 | 1277 } |
1278 | |
1279 void | |
771 | 1280 x_set_autolower (f, arg, oldval) |
1281 struct frame *f; | |
389 | 1282 Lisp_Object arg, oldval; |
1283 { | |
771 | 1284 f->auto_lower = !EQ (Qnil, arg); |
389 | 1285 } |
1286 | |
1287 #ifdef HAVE_X11 | |
1288 int n_faces; | |
1289 | |
1290 x_set_face (scr, font, background, foreground, stipple) | |
771 | 1291 struct frame *scr; |
389 | 1292 XFontStruct *font; |
1293 unsigned long background, foreground; | |
1294 Pixmap stipple; | |
1295 { | |
1296 XGCValues gc_values; | |
1297 GC temp_gc; | |
1298 unsigned long gc_mask; | |
1299 struct face *new_face; | |
1300 unsigned int width = 16; | |
1301 unsigned int height = 16; | |
1302 | |
1303 if (n_faces == MAX_FACES_AND_GLYPHS) | |
1304 return 1; | |
1305 | |
1306 /* Create the Graphics Context. */ | |
1307 gc_values.font = font->fid; | |
1308 gc_values.foreground = foreground; | |
1309 gc_values.background = background; | |
1310 gc_values.line_width = 0; | |
1311 gc_mask = GCLineWidth | GCFont | GCForeground | GCBackground; | |
1312 if (stipple) | |
1313 { | |
1314 gc_values.stipple | |
1315 = XCreateBitmapFromData (x_current_display, ROOT_WINDOW, | |
1316 (char *) stipple, width, height); | |
1317 gc_mask |= GCStipple; | |
1318 } | |
1319 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1320 temp_gc = XCreateGC (x_current_display, FRAME_X_WINDOW (scr), |
389 | 1321 gc_mask, &gc_values); |
1322 if (!temp_gc) | |
1323 return 1; | |
1324 new_face = (struct face *) xmalloc (sizeof (struct face)); | |
1325 if (!new_face) | |
1326 { | |
1327 XFreeGC (x_current_display, temp_gc); | |
1328 return 1; | |
1329 } | |
1330 | |
1331 new_face->font = font; | |
1332 new_face->foreground = foreground; | |
1333 new_face->background = background; | |
1334 new_face->face_gc = temp_gc; | |
1335 if (stipple) | |
1336 new_face->stipple = gc_values.stipple; | |
1337 | |
1338 x_face_table[++n_faces] = new_face; | |
1339 return 1; | |
1340 } | |
1341 | |
1342 x_set_glyph (scr, glyph) | |
1343 { | |
1344 } | |
1345 | |
1346 #if 0 | |
1347 DEFUN ("x-set-face-font", Fx_set_face_font, Sx_set_face_font, 4, 2, 0, | |
1348 "Specify face table entry FACE-CODE to be the font named by FONT,\n\ | |
1349 in colors FOREGROUND and BACKGROUND.") | |
1350 (face_code, font_name, foreground, background) | |
1351 Lisp_Object face_code; | |
1352 Lisp_Object font_name; | |
1353 Lisp_Object foreground; | |
1354 Lisp_Object background; | |
1355 { | |
1356 register struct face *fp; /* Current face info. */ | |
1357 register int fn; /* Face number. */ | |
1358 register FONT_TYPE *f; /* Font data structure. */ | |
1359 unsigned char *newname; | |
1360 int fg, bg; | |
1361 GC temp_gc; | |
1362 XGCValues gc_values; | |
1363 | |
1364 /* Need to do something about this. */ | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1365 Drawable drawable = FRAME_X_WINDOW (selected_frame); |
389 | 1366 |
1367 CHECK_NUMBER (face_code, 1); | |
1368 CHECK_STRING (font_name, 2); | |
1369 | |
1370 if (EQ (foreground, Qnil) || EQ (background, Qnil)) | |
1371 { | |
771 | 1372 fg = selected_frame->display.x->foreground_pixel; |
1373 bg = selected_frame->display.x->background_pixel; | |
389 | 1374 } |
1375 else | |
1376 { | |
1377 CHECK_NUMBER (foreground, 0); | |
1378 CHECK_NUMBER (background, 1); | |
1379 | |
1380 fg = x_decode_color (XINT (foreground), BLACK_PIX_DEFAULT); | |
1381 bg = x_decode_color (XINT (background), WHITE_PIX_DEFAULT); | |
1382 } | |
1383 | |
1384 fn = XINT (face_code); | |
1385 if ((fn < 1) || (fn > 255)) | |
1386 error ("Invalid face code, %d", fn); | |
1387 | |
1388 newname = XSTRING (font_name)->data; | |
1389 BLOCK_INPUT; | |
1390 f = (*newname == 0 ? 0 : XGetFont (newname)); | |
1391 UNBLOCK_INPUT; | |
1392 if (f == 0) | |
1393 error ("Font \"%s\" is not defined", newname); | |
1394 | |
1395 fp = x_face_table[fn]; | |
1396 if (fp == 0) | |
1397 { | |
1398 x_face_table[fn] = fp = (struct face *) xmalloc (sizeof (struct face)); | |
1399 bzero (fp, sizeof (struct face)); | |
1400 fp->face_type = x_pixmap; | |
1401 } | |
1402 else if (FACE_IS_FONT (fn)) | |
1403 { | |
1404 BLOCK_INPUT; | |
1405 XFreeGC (FACE_FONT (fn)); | |
1406 UNBLOCK_INPUT; | |
1407 } | |
1408 else if (FACE_IS_IMAGE (fn)) /* This should not happen... */ | |
1409 { | |
1410 BLOCK_INPUT; | |
1411 XFreePixmap (x_current_display, FACE_IMAGE (fn)); | |
1412 fp->face_type = x_font; | |
1413 UNBLOCK_INPUT; | |
1414 } | |
1415 else | |
1416 abort (); | |
1417 | |
1418 fp->face_GLYPH.font_desc.font = f; | |
1419 gc_values.font = f->fid; | |
1420 gc_values.foreground = fg; | |
1421 gc_values.background = bg; | |
1422 fp->face_GLYPH.font_desc.face_gc = XCreateGC (x_current_display, | |
1423 drawable, GCFont | GCForeground | |
1424 | GCBackground, &gc_values); | |
1425 fp->face_GLYPH.font_desc.font_width = FONT_WIDTH (f); | |
1426 fp->face_GLYPH.font_desc.font_height = FONT_HEIGHT (f); | |
1427 | |
1428 return face_code; | |
1429 } | |
1430 #endif | |
1431 #else /* X10 */ | |
1432 DEFUN ("x-set-face", Fx_set_face, Sx_set_face, 4, 4, 0, | |
1433 "Specify face table entry FACE-CODE to be the font named by FONT,\n\ | |
1434 in colors FOREGROUND and BACKGROUND.") | |
1435 (face_code, font_name, foreground, background) | |
1436 Lisp_Object face_code; | |
1437 Lisp_Object font_name; | |
1438 Lisp_Object foreground; | |
1439 Lisp_Object background; | |
1440 { | |
1441 register struct face *fp; /* Current face info. */ | |
1442 register int fn; /* Face number. */ | |
1443 register FONT_TYPE *f; /* Font data structure. */ | |
1444 unsigned char *newname; | |
1445 | |
1446 CHECK_NUMBER (face_code, 1); | |
1447 CHECK_STRING (font_name, 2); | |
1448 | |
1449 fn = XINT (face_code); | |
1450 if ((fn < 1) || (fn > 255)) | |
1451 error ("Invalid face code, %d", fn); | |
1452 | |
1453 /* Ask the server to find the specified font. */ | |
1454 newname = XSTRING (font_name)->data; | |
1455 BLOCK_INPUT; | |
1456 f = (*newname == 0 ? 0 : XGetFont (newname)); | |
1457 UNBLOCK_INPUT; | |
1458 if (f == 0) | |
1459 error ("Font \"%s\" is not defined", newname); | |
1460 | |
1461 /* Get the face structure for face_code in the face table. | |
1462 Make sure it exists. */ | |
1463 fp = x_face_table[fn]; | |
1464 if (fp == 0) | |
1465 { | |
1466 x_face_table[fn] = fp = (struct face *) xmalloc (sizeof (struct face)); | |
1467 bzero (fp, sizeof (struct face)); | |
1468 } | |
1469 | |
1470 /* If this face code already exists, get rid of the old font. */ | |
1471 if (fp->font != 0 && fp->font != f) | |
1472 { | |
1473 BLOCK_INPUT; | |
1474 XLoseFont (fp->font); | |
1475 UNBLOCK_INPUT; | |
1476 } | |
1477 | |
1478 /* Store the specified information in FP. */ | |
1479 fp->fg = x_decode_color (foreground, BLACK_PIX_DEFAULT); | |
1480 fp->bg = x_decode_color (background, WHITE_PIX_DEFAULT); | |
1481 fp->font = f; | |
1482 | |
1483 return face_code; | |
1484 } | |
1485 #endif /* X10 */ | |
1486 | |
1487 #if 0 | |
1488 /* This is excluded because there is no painless way | |
1489 to get or to remember the name of the font. */ | |
1490 | |
1491 DEFUN ("x-get-face", Fx_get_face, Sx_get_face, 1, 1, 0, | |
1492 "Get data defining face code FACE. FACE is an integer.\n\ | |
1493 The value is a list (FONT FG-COLOR BG-COLOR).") | |
1494 (face) | |
1495 Lisp_Object face; | |
1496 { | |
1497 register struct face *fp; /* Current face info. */ | |
1498 register int fn; /* Face number. */ | |
1499 | |
1500 CHECK_NUMBER (face, 1); | |
1501 fn = XINT (face); | |
1502 if ((fn < 1) || (fn > 255)) | |
1503 error ("Invalid face code, %d", fn); | |
1504 | |
1505 /* Make sure the face table exists and this face code is defined. */ | |
1506 if (x_face_table == 0 || x_face_table[fn] == 0) | |
1507 return Qnil; | |
1508 | |
1509 fp = x_face_table[fn]; | |
1510 | |
1511 return Fcons (build_string (fp->name), | |
1512 Fcons (make_number (fp->fg), | |
1513 Fcons (make_number (fp->bg), Qnil))); | |
1514 } | |
1515 #endif /* 0 */ | |
1516 | |
771 | 1517 /* Subroutines of creating an X frame. */ |
389 | 1518 |
1519 #ifdef HAVE_X11 | |
1520 extern char *x_get_string_resource (); | |
1521 extern XrmDatabase x_load_resources (); | |
1522 | |
1523 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 1, 3, 0, | |
1524 "Retrieve the value of ATTRIBUTE from the X defaults database. This\n\ | |
1525 searches using a key of the form \"INSTANCE.ATTRIBUTE\", with class\n\ | |
1526 \"Emacs\", where INSTANCE is the name under which Emacs was invoked.\n\ | |
1527 \n\ | |
1528 Optional arguments COMPONENT and CLASS specify the component for which\n\ | |
1529 we should look up ATTRIBUTE. When specified, Emacs searches using a\n\ | |
1530 key of the form INSTANCE.COMPONENT.ATTRIBUTE, with class \"Emacs.CLASS\".") | |
1531 (attribute, name, class) | |
1532 Lisp_Object attribute, name, class; | |
1533 { | |
1534 register char *value; | |
1535 char *name_key; | |
1536 char *class_key; | |
1537 | |
1538 CHECK_STRING (attribute, 0); | |
485 | 1539 if (!NILP (name)) |
389 | 1540 CHECK_STRING (name, 1); |
485 | 1541 if (!NILP (class)) |
389 | 1542 CHECK_STRING (class, 2); |
485 | 1543 if (NILP (name) != NILP (class)) |
389 | 1544 error ("x-get-resource: must specify both NAME and CLASS or neither"); |
1545 | |
485 | 1546 if (NILP (name)) |
389 | 1547 { |
398 | 1548 name_key = (char *) alloca (XSTRING (invocation_name)->size + 1 |
1549 + XSTRING (attribute)->size + 1); | |
1550 | |
389 | 1551 sprintf (name_key, "%s.%s", |
1552 XSTRING (invocation_name)->data, | |
1553 XSTRING (attribute)->data); | |
1554 class_key = EMACS_CLASS; | |
1555 } | |
1556 else | |
1557 { | |
398 | 1558 name_key = (char *) alloca (XSTRING (invocation_name)->size + 1 |
1559 + XSTRING (name)->size + 1 | |
1560 + XSTRING (attribute)->size + 1); | |
1561 | |
389 | 1562 class_key = (char *) alloca (sizeof (EMACS_CLASS) |
1563 + XSTRING (class)->size + 1); | |
1564 | |
1565 sprintf (name_key, "%s.%s.%s", | |
1566 XSTRING (invocation_name)->data, | |
1567 XSTRING (name)->data, | |
1568 XSTRING (attribute)->data); | |
1569 sprintf (class_key, "%s.%s", | |
1570 XSTRING (invocation_name)->data, | |
1571 XSTRING (class)->data); | |
1572 } | |
1573 | |
1574 value = x_get_string_resource (xrdb, name_key, class_key); | |
1575 | |
1576 if (value != (char *) 0) | |
1577 return build_string (value); | |
1578 else | |
1579 return Qnil; | |
1580 } | |
1581 | |
1582 #else /* X10 */ | |
1583 | |
398 | 1584 DEFUN ("x-get-default", Fx_get_default, Sx_get_default, 1, 1, 0, |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1585 "Get X default ATTRIBUTE from the system, or nil if no default.\n\ |
389 | 1586 Value is a string (when not nil) and ATTRIBUTE is also a string.\n\ |
1587 The defaults are specified in the file `~/.Xdefaults'.") | |
398 | 1588 (arg) |
1589 Lisp_Object arg; | |
389 | 1590 { |
1591 register unsigned char *value; | |
1592 | |
1593 CHECK_STRING (arg, 1); | |
1594 | |
1595 value = (unsigned char *) XGetDefault (XDISPLAY | |
1596 XSTRING (invocation_name)->data, | |
1597 XSTRING (arg)->data); | |
1598 if (value == 0) | |
1599 /* Try reversing last two args, in case this is the buggy version of X. */ | |
1600 value = (unsigned char *) XGetDefault (XDISPLAY | |
1601 XSTRING (arg)->data, | |
1602 XSTRING (invocation_name)->data); | |
1603 if (value != 0) | |
1604 return build_string (value); | |
1605 else | |
1606 return (Qnil); | |
1607 } | |
1608 | |
398 | 1609 #define Fx_get_resource(attribute, name, class) Fx_get_default(attribute) |
389 | 1610 |
1611 #endif /* X10 */ | |
1612 | |
398 | 1613 /* Types we might convert a resource string into. */ |
1614 enum resource_types | |
1615 { | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1616 number, boolean, string, symbol, |
398 | 1617 }; |
1618 | |
389 | 1619 /* Return the value of parameter PARAM. |
398 | 1620 |
771 | 1621 First search ALIST, then Vdefault_frame_alist, then the X defaults |
641 | 1622 database, using ATTRIBUTE as the attribute name. |
398 | 1623 |
1624 Convert the resource to the type specified by desired_type. | |
1625 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1626 If no default is specified, return Qunbound. If you call |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1627 x_get_arg, make sure you deal with Qunbound in a reasonable way, |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1628 and don't let it get stored in any lisp-visible variables! */ |
389 | 1629 |
1630 static Lisp_Object | |
641 | 1631 x_get_arg (alist, param, attribute, type) |
1632 Lisp_Object alist, param; | |
398 | 1633 char *attribute; |
1634 enum resource_types type; | |
389 | 1635 { |
1636 register Lisp_Object tem; | |
1637 | |
1638 tem = Fassq (param, alist); | |
1639 if (EQ (tem, Qnil)) | |
771 | 1640 tem = Fassq (param, Vdefault_frame_alist); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1641 if (EQ (tem, Qnil)) |
389 | 1642 { |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1643 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1644 if (attribute) |
398 | 1645 { |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1646 tem = Fx_get_resource (build_string (attribute), Qnil, Qnil); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1647 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1648 if (NILP (tem)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1649 return Qunbound; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1650 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1651 switch (type) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1652 { |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1653 case number: |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1654 return make_number (atoi (XSTRING (tem)->data)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1655 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1656 case boolean: |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1657 tem = Fdowncase (tem); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1658 if (!strcmp (XSTRING (tem)->data, "on") |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1659 || !strcmp (XSTRING (tem)->data, "true")) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1660 return Qt; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1661 else |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1662 return Qnil; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1663 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1664 case string: |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1665 return tem; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1666 |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1667 case symbol: |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1668 return intern (tem); |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1669 |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1670 default: |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1671 abort (); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1672 } |
398 | 1673 } |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1674 else |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1675 return Qunbound; |
389 | 1676 } |
1677 return Fcdr (tem); | |
1678 } | |
1679 | |
771 | 1680 /* Record in frame F the specified or default value according to ALIST |
389 | 1681 of the parameter named PARAM (a Lisp symbol). |
1682 If no value is specified for PARAM, look for an X default for XPROP | |
771 | 1683 on the frame named NAME. |
389 | 1684 If that is not found either, use the value DEFLT. */ |
1685 | |
1686 static Lisp_Object | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1687 x_default_parameter (f, alist, prop, deflt, xprop, type) |
771 | 1688 struct frame *f; |
389 | 1689 Lisp_Object alist; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1690 Lisp_Object prop; |
389 | 1691 Lisp_Object deflt; |
1692 char *xprop; | |
398 | 1693 enum resource_types type; |
389 | 1694 { |
1695 Lisp_Object tem; | |
1696 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1697 tem = x_get_arg (alist, prop, xprop, type); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1698 if (EQ (tem, Qunbound)) |
389 | 1699 tem = deflt; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1700 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); |
389 | 1701 return tem; |
1702 } | |
1703 | |
1704 DEFUN ("x-geometry", Fx_geometry, Sx_geometry, 1, 1, 0, | |
1705 "Parse an X-style geometry string STRING.\n\ | |
1706 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).") | |
1707 (string) | |
1708 { | |
1709 int geometry, x, y; | |
1710 unsigned int width, height; | |
1711 Lisp_Object values[4]; | |
1712 | |
1713 CHECK_STRING (string, 0); | |
1714 | |
1715 geometry = XParseGeometry ((char *) XSTRING (string)->data, | |
1716 &x, &y, &width, &height); | |
1717 | |
1718 switch (geometry & 0xf) /* Mask out {X,Y}Negative */ | |
1719 { | |
1720 case (XValue | YValue): | |
1721 /* What's one pixel among friends? | |
1722 Perhaps fix this some day by returning symbol `extreme-top'... */ | |
1723 if (x == 0 && (geometry & XNegative)) | |
1724 x = -1; | |
1725 if (y == 0 && (geometry & YNegative)) | |
1726 y = -1; | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1727 values[0] = Fcons (Qleft, make_number (x)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1728 values[1] = Fcons (Qtop, make_number (y)); |
389 | 1729 return Flist (2, values); |
1730 break; | |
1731 | |
1732 case (WidthValue | HeightValue): | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1733 values[0] = Fcons (Qwidth, make_number (width)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1734 values[1] = Fcons (Qheight, make_number (height)); |
389 | 1735 return Flist (2, values); |
1736 break; | |
1737 | |
1738 case (XValue | YValue | WidthValue | HeightValue): | |
1739 if (x == 0 && (geometry & XNegative)) | |
1740 x = -1; | |
1741 if (y == 0 && (geometry & YNegative)) | |
1742 y = -1; | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1743 values[0] = Fcons (Qwidth, make_number (width)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1744 values[1] = Fcons (Qheight, make_number (height)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1745 values[2] = Fcons (Qleft, make_number (x)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1746 values[3] = Fcons (Qtop, make_number (y)); |
389 | 1747 return Flist (4, values); |
1748 break; | |
1749 | |
1750 case 0: | |
1751 return Qnil; | |
1752 | |
1753 default: | |
1754 error ("Must specify x and y value, and/or width and height"); | |
1755 } | |
1756 } | |
1757 | |
1758 #ifdef HAVE_X11 | |
1759 /* Calculate the desired size and position of this window, | |
1760 or set rubber-band prompting if none. */ | |
1761 | |
1762 #define DEFAULT_ROWS 40 | |
1763 #define DEFAULT_COLS 80 | |
1764 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1765 static int |
771 | 1766 x_figure_window_size (f, parms) |
1767 struct frame *f; | |
389 | 1768 Lisp_Object parms; |
1769 { | |
1770 register Lisp_Object tem0, tem1; | |
1771 int height, width, left, top; | |
1772 register int geometry; | |
1773 long window_prompting = 0; | |
1774 | |
1775 /* Default values if we fall through. | |
1776 Actually, if that happens we should get | |
1777 window manager prompting. */ | |
771 | 1778 f->width = DEFAULT_COLS; |
1779 f->height = DEFAULT_ROWS; | |
1780 f->display.x->top_pos = 1; | |
1781 f->display.x->left_pos = 1; | |
389 | 1782 |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1783 tem0 = x_get_arg (parms, Qheight, 0, number); |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1784 tem1 = x_get_arg (parms, Qwidth, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1785 if (! EQ (tem0, Qunbound) && ! EQ (tem1, Qunbound)) |
389 | 1786 { |
1787 CHECK_NUMBER (tem0, 0); | |
1788 CHECK_NUMBER (tem1, 0); | |
771 | 1789 f->height = XINT (tem0); |
1790 f->width = XINT (tem1); | |
389 | 1791 window_prompting |= USSize; |
1792 } | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1793 else if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
389 | 1794 error ("Must specify *both* height and width"); |
1795 | |
771 | 1796 f->display.x->pixel_width = (FONT_WIDTH (f->display.x->font) * f->width |
1797 + 2 * f->display.x->internal_border_width); | |
1798 f->display.x->pixel_height = (FONT_HEIGHT (f->display.x->font) * f->height | |
1799 + 2 * f->display.x->internal_border_width); | |
389 | 1800 |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1801 tem0 = x_get_arg (parms, Qtop, 0, number); |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1802 tem1 = x_get_arg (parms, Qleft, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1803 if (! EQ (tem0, Qunbound) && ! EQ (tem1, Qunbound)) |
389 | 1804 { |
1805 CHECK_NUMBER (tem0, 0); | |
1806 CHECK_NUMBER (tem1, 0); | |
771 | 1807 f->display.x->top_pos = XINT (tem0); |
1808 f->display.x->left_pos = XINT (tem1); | |
1809 x_calc_absolute_position (f); | |
389 | 1810 window_prompting |= USPosition; |
1811 } | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1812 else if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
389 | 1813 error ("Must specify *both* top and left corners"); |
1814 | |
1815 switch (window_prompting) | |
1816 { | |
1817 case USSize | USPosition: | |
1818 return window_prompting; | |
1819 break; | |
1820 | |
1821 case USSize: /* Got the size, need the position. */ | |
1822 window_prompting |= PPosition; | |
1823 return window_prompting; | |
1824 break; | |
1825 | |
1826 case USPosition: /* Got the position, need the size. */ | |
1827 window_prompting |= PSize; | |
1828 return window_prompting; | |
1829 break; | |
1830 | |
1831 case 0: /* Got nothing, take both from geometry. */ | |
1832 window_prompting |= PPosition | PSize; | |
1833 return window_prompting; | |
1834 break; | |
1835 | |
1836 default: | |
1837 /* Somehow a bit got set in window_prompting that we didn't | |
1838 put there. */ | |
1839 abort (); | |
1840 } | |
1841 } | |
1842 | |
1843 static void | |
771 | 1844 x_window (f) |
1845 struct frame *f; | |
389 | 1846 { |
1847 XSetWindowAttributes attributes; | |
1848 unsigned long attribute_mask; | |
1849 XClassHint class_hints; | |
1850 | |
771 | 1851 attributes.background_pixel = f->display.x->background_pixel; |
1852 attributes.border_pixel = f->display.x->border_pixel; | |
389 | 1853 attributes.bit_gravity = StaticGravity; |
1854 attributes.backing_store = NotUseful; | |
1855 attributes.save_under = True; | |
1856 attributes.event_mask = STANDARD_EVENT_SET; | |
1857 attribute_mask = (CWBackPixel | CWBorderPixel | CWBitGravity | |
1858 #if 0 | |
1859 | CWBackingStore | CWSaveUnder | |
1860 #endif | |
1861 | CWEventMask); | |
1862 | |
1863 BLOCK_INPUT; | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1864 FRAME_X_WINDOW (f) |
389 | 1865 = XCreateWindow (x_current_display, ROOT_WINDOW, |
771 | 1866 f->display.x->left_pos, |
1867 f->display.x->top_pos, | |
1868 PIXEL_WIDTH (f), PIXEL_HEIGHT (f), | |
1869 f->display.x->border_width, | |
389 | 1870 CopyFromParent, /* depth */ |
1871 InputOutput, /* class */ | |
1872 screen_visual, /* set in Fx_open_connection */ | |
1873 attribute_mask, &attributes); | |
1874 | |
771 | 1875 class_hints.res_name = (char *) XSTRING (f->name)->data; |
389 | 1876 class_hints.res_class = EMACS_CLASS; |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1877 XSetClassHint (x_current_display, FRAME_X_WINDOW (f), &class_hints); |
771 | 1878 |
817 | 1879 /* x_set_name normally ignores requests to set the name if the |
1880 requested name is the same as the current name. This is the one | |
1881 place where that assumption isn't correct; f->name is set, but | |
1882 the X server hasn't been told. */ | |
1883 { | |
1884 Lisp_Object name = f->name; | |
1885 | |
1886 f->name = Qnil; | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1887 x_implicitly_set_name (f, name, Qnil); |
817 | 1888 } |
1889 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1890 XDefineCursor (XDISPLAY FRAME_X_WINDOW (f), |
771 | 1891 f->display.x->text_cursor); |
389 | 1892 UNBLOCK_INPUT; |
1893 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1894 if (FRAME_X_WINDOW (f) == 0) |
389 | 1895 error ("Unable to create window."); |
1896 } | |
1897 | |
1898 /* Handle the icon stuff for this window. Perhaps later we might | |
1899 want an x_set_icon_position which can be called interactively as | |
1900 well. */ | |
1901 | |
1902 static void | |
771 | 1903 x_icon (f, parms) |
1904 struct frame *f; | |
389 | 1905 Lisp_Object parms; |
1906 { | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1907 Lisp_Object icon_x, icon_y; |
389 | 1908 |
1909 /* Set the position of the icon. Note that twm groups all | |
1910 icons in an icon window. */ | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1911 icon_x = x_get_arg (parms, Qicon_left, 0, number); |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1912 icon_y = x_get_arg (parms, Qicon_top, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1913 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) |
389 | 1914 { |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1915 CHECK_NUMBER (icon_x, 0); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1916 CHECK_NUMBER (icon_y, 0); |
389 | 1917 } |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1918 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) |
389 | 1919 error ("Both left and top icon corners of icon must be specified"); |
1920 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1921 BLOCK_INPUT; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1922 |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1923 if (! EQ (icon_x, Qunbound)) |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1924 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1925 |
389 | 1926 /* Start up iconic or window? */ |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1927 x_wm_set_window_state (f, |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1928 (EQ (x_get_arg (parms, Qiconic_startup, 0, boolean), |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1929 Qt) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1930 ? IconicState |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1931 : NormalState)); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1932 |
389 | 1933 UNBLOCK_INPUT; |
1934 } | |
1935 | |
1936 /* Make the GC's needed for this window, setting the | |
1937 background, border and mouse colors; also create the | |
1938 mouse cursor and the gray border tile. */ | |
1939 | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1940 static char cursor_bits[] = |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1941 { |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1942 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1943 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1944 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1945 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1946 }; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
1947 |
389 | 1948 static void |
771 | 1949 x_make_gc (f) |
1950 struct frame *f; | |
389 | 1951 { |
1952 XGCValues gc_values; | |
1953 GC temp_gc; | |
1954 XImage tileimage; | |
1955 | |
771 | 1956 /* Create the GC's of this frame. |
389 | 1957 Note that many default values are used. */ |
1958 | |
1959 /* Normal video */ | |
771 | 1960 gc_values.font = f->display.x->font->fid; |
1961 gc_values.foreground = f->display.x->foreground_pixel; | |
1962 gc_values.background = f->display.x->background_pixel; | |
389 | 1963 gc_values.line_width = 0; /* Means 1 using fast algorithm. */ |
771 | 1964 f->display.x->normal_gc = XCreateGC (x_current_display, |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1965 FRAME_X_WINDOW (f), |
389 | 1966 GCLineWidth | GCFont |
1967 | GCForeground | GCBackground, | |
1968 &gc_values); | |
1969 | |
1970 /* Reverse video style. */ | |
771 | 1971 gc_values.foreground = f->display.x->background_pixel; |
1972 gc_values.background = f->display.x->foreground_pixel; | |
1973 f->display.x->reverse_gc = XCreateGC (x_current_display, | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1974 FRAME_X_WINDOW (f), |
389 | 1975 GCFont | GCForeground | GCBackground |
1976 | GCLineWidth, | |
1977 &gc_values); | |
1978 | |
1979 /* Cursor has cursor-color background, background-color foreground. */ | |
771 | 1980 gc_values.foreground = f->display.x->background_pixel; |
1981 gc_values.background = f->display.x->cursor_pixel; | |
389 | 1982 gc_values.fill_style = FillOpaqueStippled; |
1983 gc_values.stipple | |
1984 = XCreateBitmapFromData (x_current_display, ROOT_WINDOW, | |
1985 cursor_bits, 16, 16); | |
771 | 1986 f->display.x->cursor_gc |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1987 = XCreateGC (x_current_display, FRAME_X_WINDOW (f), |
389 | 1988 (GCFont | GCForeground | GCBackground |
1989 | GCFillStyle | GCStipple | GCLineWidth), | |
1990 &gc_values); | |
1991 | |
1992 /* Create the gray border tile used when the pointer is not in | |
771 | 1993 the frame. Since this depends on the frame's pixel values, |
1994 this must be done on a per-frame basis. */ | |
1995 f->display.x->border_tile = | |
389 | 1996 XCreatePixmap (x_current_display, ROOT_WINDOW, 16, 16, |
1997 DefaultDepth (x_current_display, | |
1998 XDefaultScreen (x_current_display))); | |
771 | 1999 gc_values.foreground = f->display.x->foreground_pixel; |
2000 gc_values.background = f->display.x->background_pixel; | |
389 | 2001 temp_gc = XCreateGC (x_current_display, |
771 | 2002 (Drawable) f->display.x->border_tile, |
389 | 2003 GCForeground | GCBackground, &gc_values); |
2004 | |
2005 /* These are things that should be determined by the server, in | |
2006 Fx_open_connection */ | |
2007 tileimage.height = 16; | |
2008 tileimage.width = 16; | |
2009 tileimage.xoffset = 0; | |
2010 tileimage.format = XYBitmap; | |
2011 tileimage.data = gray_bits; | |
2012 tileimage.byte_order = LSBFirst; | |
2013 tileimage.bitmap_unit = 8; | |
2014 tileimage.bitmap_bit_order = LSBFirst; | |
2015 tileimage.bitmap_pad = 8; | |
2016 tileimage.bytes_per_line = (16 + 7) >> 3; | |
2017 tileimage.depth = 1; | |
771 | 2018 XPutImage (x_current_display, f->display.x->border_tile, temp_gc, |
389 | 2019 &tileimage, 0, 0, 0, 0, 16, 16); |
2020 XFreeGC (x_current_display, temp_gc); | |
2021 } | |
2022 #endif /* HAVE_X11 */ | |
2023 | |
771 | 2024 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, |
389 | 2025 1, 1, 0, |
771 | 2026 "Make a new X window, which is called a \"frame\" in Emacs terms.\n\ |
2027 Return an Emacs frame object representing the X window.\n\ | |
2028 ALIST is an alist of frame parameters.\n\ | |
2029 If the parameters specify that the frame should not have a minibuffer,\n\ | |
697
6dd85fc4fb2c
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
689
diff
changeset
|
2030 and do not specify a specific minibuffer window to use,\n\ |
771 | 2031 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\ |
2032 be shared by the new frame.") | |
389 | 2033 (parms) |
2034 Lisp_Object parms; | |
2035 { | |
2036 #ifdef HAVE_X11 | |
771 | 2037 struct frame *f; |
2038 Lisp_Object frame, tem; | |
389 | 2039 Lisp_Object name; |
2040 int minibuffer_only = 0; | |
2041 long window_prompting = 0; | |
2042 int width, height; | |
2043 | |
2044 if (x_current_display == 0) | |
2045 error ("X windows are not in use or not initialized"); | |
2046 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2047 name = x_get_arg (parms, Qname, "Title", string); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2048 if (EQ (name, Qunbound) || NILP (name)) |
398 | 2049 name = build_string (x_id_name); |
2050 if (XTYPE (name) != Lisp_String) | |
771 | 2051 error ("x-create-frame: name parameter must be a string"); |
398 | 2052 |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2053 tem = x_get_arg (parms, Qminibuffer, 0, symbol); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2054 if (EQ (tem, Qnone) || NILP (tem)) |
771 | 2055 f = make_frame_without_minibuffer (Qnil); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2056 else if (EQ (tem, Qonly)) |
389 | 2057 { |
771 | 2058 f = make_minibuffer_frame (); |
389 | 2059 minibuffer_only = 1; |
2060 } | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2061 else if (XTYPE (tem) == Lisp_Window) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2062 f = make_frame_without_minibuffer (tem); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2063 else |
771 | 2064 f = make_frame (1); |
2065 | |
2066 /* Set the name; the functions to which we pass f expect the | |
389 | 2067 name to be set. */ |
771 | 2068 XSET (f->name, Lisp_String, name); |
2069 | |
2070 XSET (frame, Lisp_Frame, f); | |
2071 f->output_method = output_x_window; | |
2072 f->display.x = (struct x_display *) xmalloc (sizeof (struct x_display)); | |
2073 bzero (f->display.x, sizeof (struct x_display)); | |
2074 | |
2075 /* Note that the frame has no physical cursor right now. */ | |
2076 f->phys_cursor_x = -1; | |
485 | 2077 |
389 | 2078 /* Extract the window parameters from the supplied values |
2079 that are needed to determine window geometry. */ | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2080 x_default_parameter (f, parms, Qfont, |
398 | 2081 build_string ("9x15"), "font", string); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2082 x_default_parameter (f, parms, Qbackground_color, |
398 | 2083 build_string ("white"), "background", string); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2084 x_default_parameter (f, parms, Qborder_width, |
398 | 2085 make_number (2), "BorderWidth", number); |
727 | 2086 /* This defaults to 2 in order to match XTerms. */ |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2087 x_default_parameter (f, parms, Qinternal_border_width, |
727 | 2088 make_number (2), "InternalBorderWidth", number); |
389 | 2089 |
2090 /* Also do the stuff which must be set before the window exists. */ | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2091 x_default_parameter (f, parms, Qforeground_color, |
398 | 2092 build_string ("black"), "foreground", string); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2093 x_default_parameter (f, parms, Qmouse_color, |
398 | 2094 build_string ("black"), "mouse", string); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2095 x_default_parameter (f, parms, Qcursor_color, |
398 | 2096 build_string ("black"), "cursor", string); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2097 x_default_parameter (f, parms, Qborder_color, |
398 | 2098 build_string ("black"), "border", string); |
389 | 2099 |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2100 /* When XSetWMHints eventually gets called, this will indicate that |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2101 we use the "Passive Input" input model. Unless we do this, we |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2102 don't get the Focus{In,Out} events that we need to draw the |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2103 cursor correctly. Accursed bureaucrats. |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2104 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2105 We set this here and leave it, because we know, being decidedly |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2106 non-humble programmers (nay, weigh'd low by our hubris!), that |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2107 Fx_create_frame calls x_icon which begat x_wm_set_window_state |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2108 which begat XSetWMHints, which will get this information to the |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2109 right parties. -JimB |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2110 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2111 XWhipsAndChains (x_current_display, IronMaiden, &TheRack); */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2112 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2113 f->display.x->wm_hints.input = True; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2114 f->display.x->wm_hints.flags |= InputHint; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2115 |
771 | 2116 f->display.x->parent_desc = ROOT_WINDOW; |
2117 window_prompting = x_figure_window_size (f, parms); | |
2118 | |
2119 x_window (f); | |
2120 x_icon (f, parms); | |
2121 x_make_gc (f); | |
2122 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2123 /* We need to do this after creating the X window, so that the |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2124 icon-creation functions can say whose icon they're describing. */ |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2125 x_default_parameter (f, parms, Qicon_type, Qnil, "IconType", symbol); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2126 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2127 x_default_parameter (f, parms, Qauto_raise, Qnil, "AutoRaise", boolean); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2128 x_default_parameter (f, parms, Qauto_lower, Qnil, "AutoLower", boolean); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2129 |
771 | 2130 /* Dimensions, especially f->height, must be done via change_frame_size. |
389 | 2131 Change will not be effected unless different from the current |
771 | 2132 f->height. */ |
2133 width = f->width; | |
2134 height = f->height; | |
2135 f->height = f->width = 0; | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2136 change_frame_size (f, height, width, 1, 0); |
389 | 2137 BLOCK_INPUT; |
771 | 2138 x_wm_set_size_hint (f, window_prompting); |
389 | 2139 UNBLOCK_INPUT; |
2140 | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2141 tem = x_get_arg (parms, Qunsplittable, 0, boolean); |
771 | 2142 f->no_split = minibuffer_only || EQ (tem, Qt); |
389 | 2143 |
2144 /* Now handle the rest of the parameters. */ | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2145 x_default_parameter (f, parms, Qhorizontal_scroll_bar, |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2146 Qnil, "HScrollBar", boolean); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2147 x_default_parameter (f, parms, Qvertical_scroll_bar, |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2148 Qnil, "VScrollBar", boolean); |
389 | 2149 |
771 | 2150 /* Make the window appear on the frame and enable display. */ |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2151 if (!EQ (x_get_arg (parms, Qsuppress_initial_map, 0, boolean), Qt)) |
771 | 2152 x_make_frame_visible (f); |
2153 | |
2154 return frame; | |
389 | 2155 #else /* X10 */ |
771 | 2156 struct frame *f; |
2157 Lisp_Object frame, tem; | |
389 | 2158 Lisp_Object name; |
2159 int pixelwidth, pixelheight; | |
2160 Cursor cursor; | |
2161 int height, width; | |
2162 Window parent; | |
2163 Pixmap temp; | |
2164 int minibuffer_only = 0; | |
2165 Lisp_Object vscroll, hscroll; | |
2166 | |
2167 if (x_current_display == 0) | |
2168 error ("X windows are not in use or not initialized"); | |
2169 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2170 name = Fassq (Qname, parms); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2171 |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2172 tem = x_get_arg (parms, Qminibuffer, 0, symbol); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2173 if (EQ (tem, Qnone)) |
771 | 2174 f = make_frame_without_minibuffer (Qnil); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2175 else if (EQ (tem, Qonly)) |
389 | 2176 { |
771 | 2177 f = make_minibuffer_frame (); |
389 | 2178 minibuffer_only = 1; |
2179 } | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2180 else if (EQ (tem, Qnil) || EQ (tem, Qunbound)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2181 f = make_frame (1); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2182 else |
771 | 2183 f = make_frame_without_minibuffer (tem); |
389 | 2184 |
2185 parent = ROOT_WINDOW; | |
2186 | |
771 | 2187 XSET (frame, Lisp_Frame, f); |
2188 f->output_method = output_x_window; | |
2189 f->display.x = (struct x_display *) xmalloc (sizeof (struct x_display)); | |
2190 bzero (f->display.x, sizeof (struct x_display)); | |
389 | 2191 |
2192 /* Some temprorary default values for height and width. */ | |
2193 width = 80; | |
2194 height = 40; | |
771 | 2195 f->display.x->left_pos = -1; |
2196 f->display.x->top_pos = -1; | |
2197 | |
2198 /* Give the frame a default name (which may be overridden with PARMS). */ | |
389 | 2199 |
2200 strncpy (iconidentity, ICONTAG, MAXICID); | |
2201 if (gethostname (&iconidentity[sizeof (ICONTAG) - 1], | |
2202 (MAXICID - 1) - sizeof (ICONTAG))) | |
2203 iconidentity[sizeof (ICONTAG) - 2] = '\0'; | |
771 | 2204 f->name = build_string (iconidentity); |
389 | 2205 |
2206 /* Extract some window parameters from the supplied values. | |
2207 These are the parameters that affect window geometry. */ | |
2208 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2209 tem = x_get_arg (parms, Qfont, "BodyFont", string); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2210 if (EQ (tem, Qunbound)) |
389 | 2211 tem = build_string ("9x15"); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2212 x_set_font (f, tem, Qnil); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2213 x_default_parameter (f, parms, Qborder_color, |
398 | 2214 build_string ("black"), "Border", string); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2215 x_default_parameter (f, parms, Qbackground_color, |
398 | 2216 build_string ("white"), "Background", string); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2217 x_default_parameter (f, parms, Qforeground_color, |
398 | 2218 build_string ("black"), "Foreground", string); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2219 x_default_parameter (f, parms, Qmouse_color, |
398 | 2220 build_string ("black"), "Mouse", string); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2221 x_default_parameter (f, parms, Qcursor_color, |
398 | 2222 build_string ("black"), "Cursor", string); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2223 x_default_parameter (f, parms, Qborder_width, |
398 | 2224 make_number (2), "BorderWidth", number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2225 x_default_parameter (f, parms, Qinternal_border_width, |
398 | 2226 make_number (4), "InternalBorderWidth", number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2227 x_default_parameter (f, parms, Qauto_raise, |
398 | 2228 Qnil, "AutoRaise", boolean); |
2229 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2230 hscroll = EQ (x_get_arg (parms, Qhorizontal_scroll_bar, 0, boolean), Qt); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2231 vscroll = EQ (x_get_arg (parms, Qvertical_scroll_bar, 0, boolean), Qt); |
389 | 2232 |
771 | 2233 if (f->display.x->internal_border_width < 0) |
2234 f->display.x->internal_border_width = 0; | |
389 | 2235 |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2236 tem = x_get_arg (parms, Qwindow_id, 0, number); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2237 if (!EQ (tem, Qunbound)) |
389 | 2238 { |
2239 WINDOWINFO_TYPE wininfo; | |
2240 int nchildren; | |
2241 Window *children, root; | |
2242 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2243 CHECK_NUMBER (tem, 0); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2244 FRAME_X_WINDOW (f) = (Window) XINT (tem); |
389 | 2245 |
2246 BLOCK_INPUT; | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2247 XGetWindowInfo (FRAME_X_WINDOW (f), &wininfo); |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2248 XQueryTree (FRAME_X_WINDOW (f), &parent, &nchildren, &children); |
389 | 2249 free (children); |
2250 UNBLOCK_INPUT; | |
2251 | |
771 | 2252 height = (wininfo.height - 2 * f->display.x->internal_border_width) |
2253 / FONT_HEIGHT (f->display.x->font); | |
2254 width = (wininfo.width - 2 * f->display.x->internal_border_width) | |
2255 / FONT_WIDTH (f->display.x->font); | |
2256 f->display.x->left_pos = wininfo.x; | |
2257 f->display.x->top_pos = wininfo.y; | |
2258 f->visible = wininfo.mapped != 0; | |
2259 f->display.x->border_width = wininfo.bdrwidth; | |
2260 f->display.x->parent_desc = parent; | |
389 | 2261 } |
2262 else | |
2263 { | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2264 tem = x_get_arg (parms, Qparent_id, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2265 if (!EQ (tem, Qunbound)) |
389 | 2266 { |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2267 CHECK_NUMBER (tem, 0); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2268 parent = (Window) XINT (tem); |
389 | 2269 } |
771 | 2270 f->display.x->parent_desc = parent; |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2271 tem = x_get_arg (parms, Qheight, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2272 if (EQ (tem, Qunbound)) |
389 | 2273 { |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2274 tem = x_get_arg (parms, Qwidth, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2275 if (EQ (tem, Qunbound)) |
389 | 2276 { |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2277 tem = x_get_arg (parms, Qtop, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2278 if (EQ (tem, Qunbound)) |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2279 tem = x_get_arg (parms, Qleft, 0, number); |
389 | 2280 } |
2281 } | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2282 /* Now TEM is Qunbound if no edge or size was specified. |
389 | 2283 In that case, we must do rubber-banding. */ |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2284 if (EQ (tem, Qunbound)) |
389 | 2285 { |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2286 tem = x_get_arg (parms, Qgeometry, 0, number); |
771 | 2287 x_rubber_band (f, |
2288 &f->display.x->left_pos, &f->display.x->top_pos, | |
389 | 2289 &width, &height, |
2290 (XTYPE (tem) == Lisp_String | |
2291 ? (char *) XSTRING (tem)->data : ""), | |
771 | 2292 XSTRING (f->name)->data, |
485 | 2293 !NILP (hscroll), !NILP (vscroll)); |
389 | 2294 } |
2295 else | |
2296 { | |
2297 /* Here if at least one edge or size was specified. | |
2298 Demand that they all were specified, and use them. */ | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2299 tem = x_get_arg (parms, Qheight, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2300 if (EQ (tem, Qunbound)) |
389 | 2301 error ("Height not specified"); |
2302 CHECK_NUMBER (tem, 0); | |
2303 height = XINT (tem); | |
2304 | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2305 tem = x_get_arg (parms, Qwidth, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2306 if (EQ (tem, Qunbound)) |
389 | 2307 error ("Width not specified"); |
2308 CHECK_NUMBER (tem, 0); | |
2309 width = XINT (tem); | |
2310 | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2311 tem = x_get_arg (parms, Qtop, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2312 if (EQ (tem, Qunbound)) |
389 | 2313 error ("Top position not specified"); |
2314 CHECK_NUMBER (tem, 0); | |
771 | 2315 f->display.x->left_pos = XINT (tem); |
389 | 2316 |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2317 tem = x_get_arg (parms, Qleft, 0, number); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2318 if (EQ (tem, Qunbound)) |
389 | 2319 error ("Left position not specified"); |
2320 CHECK_NUMBER (tem, 0); | |
771 | 2321 f->display.x->top_pos = XINT (tem); |
389 | 2322 } |
2323 | |
771 | 2324 pixelwidth = (width * FONT_WIDTH (f->display.x->font) |
2325 + 2 * f->display.x->internal_border_width | |
485 | 2326 + (!NILP (vscroll) ? VSCROLL_WIDTH : 0)); |
771 | 2327 pixelheight = (height * FONT_HEIGHT (f->display.x->font) |
2328 + 2 * f->display.x->internal_border_width | |
485 | 2329 + (!NILP (hscroll) ? HSCROLL_HEIGHT : 0)); |
389 | 2330 |
2331 BLOCK_INPUT; | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2332 FRAME_X_WINDOW (f) |
389 | 2333 = XCreateWindow (parent, |
771 | 2334 f->display.x->left_pos, /* Absolute horizontal offset */ |
2335 f->display.x->top_pos, /* Absolute Vertical offset */ | |
389 | 2336 pixelwidth, pixelheight, |
771 | 2337 f->display.x->border_width, |
389 | 2338 BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT); |
2339 UNBLOCK_INPUT; | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2340 if (FRAME_X_WINDOW (f) == 0) |
389 | 2341 error ("Unable to create window."); |
2342 } | |
2343 | |
2344 /* Install the now determined height and width | |
2345 in the windows and in phys_lines and desired_lines. */ | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2346 change_frame_size (f, height, width, 1, 0); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2347 XSelectInput (FRAME_X_WINDOW (f), KeyPressed | ExposeWindow |
389 | 2348 | ButtonPressed | ButtonReleased | ExposeRegion | ExposeCopy |
2349 | EnterWindow | LeaveWindow | UnmapWindow ); | |
771 | 2350 x_set_resize_hint (f); |
389 | 2351 |
2352 /* Tell the server the window's default name. */ | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2353 XStoreName (XDISPLAY FRAME_X_WINDOW (f), XSTRING (f->name)->data); |
708 | 2354 |
389 | 2355 /* Now override the defaults with all the rest of the specified |
2356 parms. */ | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2357 tem = x_get_arg (parms, Qunsplittable, 0, boolean); |
771 | 2358 f->no_split = minibuffer_only || EQ (tem, Qt); |
389 | 2359 |
2360 /* Do not create an icon window if the caller says not to */ | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2361 if (!EQ (x_get_arg (parms, Qsuppress_icon, 0, boolean), Qt) |
771 | 2362 || f->display.x->parent_desc != ROOT_WINDOW) |
389 | 2363 { |
771 | 2364 x_text_icon (f, iconidentity); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2365 x_default_parameter (f, parms, Qicon_type, Qnil, |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2366 "BitmapIcon", symbol); |
389 | 2367 } |
2368 | |
2369 /* Tell the X server the previously set values of the | |
2370 background, border and mouse colors; also create the mouse cursor. */ | |
2371 BLOCK_INPUT; | |
771 | 2372 temp = XMakeTile (f->display.x->background_pixel); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2373 XChangeBackground (FRAME_X_WINDOW (f), temp); |
389 | 2374 XFreePixmap (temp); |
2375 UNBLOCK_INPUT; | |
771 | 2376 x_set_border_pixel (f, f->display.x->border_pixel); |
2377 | |
2378 x_set_mouse_color (f, Qnil, Qnil); | |
389 | 2379 |
2380 /* Now override the defaults with all the rest of the specified parms. */ | |
2381 | |
771 | 2382 Fmodify_frame_parameters (frame, parms); |
389 | 2383 |
485 | 2384 if (!NILP (vscroll)) |
771 | 2385 install_vertical_scrollbar (f, pixelwidth, pixelheight); |
485 | 2386 if (!NILP (hscroll)) |
771 | 2387 install_horizontal_scrollbar (f, pixelwidth, pixelheight); |
2388 | |
2389 /* Make the window appear on the frame and enable display. */ | |
389 | 2390 |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2391 if (!EQ (x_get_arg (parms, Qsuppress_initial_map, 0, boolean), Qt)) |
771 | 2392 x_make_window_visible (f); |
2393 FRAME_GARBAGED (f); | |
2394 | |
2395 return frame; | |
389 | 2396 #endif /* X10 */ |
2397 } | |
2398 | |
771 | 2399 DEFUN ("focus-frame", Ffocus_frame, Sfocus_frame, 1, 1, 0, |
2400 "Set the focus on FRAME.") | |
2401 (frame) | |
2402 Lisp_Object frame; | |
389 | 2403 { |
771 | 2404 CHECK_LIVE_FRAME (frame, 0); |
2405 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2406 if (FRAME_X_P (XFRAME (frame))) |
389 | 2407 { |
2408 BLOCK_INPUT; | |
771 | 2409 x_focus_on_frame (XFRAME (frame)); |
389 | 2410 UNBLOCK_INPUT; |
771 | 2411 return frame; |
389 | 2412 } |
2413 | |
2414 return Qnil; | |
2415 } | |
2416 | |
771 | 2417 DEFUN ("unfocus-frame", Funfocus_frame, Sunfocus_frame, 0, 0, 0, |
2418 "If a frame has been focused, release it.") | |
389 | 2419 () |
2420 { | |
771 | 2421 if (x_focus_frame) |
389 | 2422 { |
2423 BLOCK_INPUT; | |
771 | 2424 x_unfocus_frame (x_focus_frame); |
389 | 2425 UNBLOCK_INPUT; |
2426 } | |
2427 | |
2428 return Qnil; | |
2429 } | |
2430 | |
2431 #ifndef HAVE_X11 | |
2432 /* Computes an X-window size and position either from geometry GEO | |
2433 or with the mouse. | |
2434 | |
771 | 2435 F is a frame. It specifies an X window which is used to |
389 | 2436 determine which display to compute for. Its font, borders |
2437 and colors control how the rectangle will be displayed. | |
2438 | |
2439 X and Y are where to store the positions chosen. | |
2440 WIDTH and HEIGHT are where to store the sizes chosen. | |
2441 | |
2442 GEO is the geometry that may specify some of the info. | |
2443 STR is a prompt to display. | |
2444 HSCROLL and VSCROLL say whether we have horiz and vert scroll bars. */ | |
2445 | |
2446 int | |
771 | 2447 x_rubber_band (f, x, y, width, height, geo, str, hscroll, vscroll) |
2448 struct frame *f; | |
389 | 2449 int *x, *y, *width, *height; |
2450 char *geo; | |
2451 char *str; | |
2452 int hscroll, vscroll; | |
2453 { | |
2454 OpaqueFrame frame; | |
2455 Window tempwindow; | |
2456 WindowInfo wininfo; | |
2457 int border_color; | |
2458 int background_color; | |
2459 Lisp_Object tem; | |
2460 int mask; | |
2461 | |
2462 BLOCK_INPUT; | |
2463 | |
771 | 2464 background_color = f->display.x->background_pixel; |
2465 border_color = f->display.x->border_pixel; | |
2466 | |
2467 frame.bdrwidth = f->display.x->border_width; | |
389 | 2468 frame.border = XMakeTile (border_color); |
2469 frame.background = XMakeTile (background_color); | |
2470 tempwindow = XCreateTerm (str, "emacs", geo, default_window, &frame, 10, 5, | |
771 | 2471 (2 * f->display.x->internal_border_width |
389 | 2472 + (vscroll ? VSCROLL_WIDTH : 0)), |
771 | 2473 (2 * f->display.x->internal_border_width |
389 | 2474 + (hscroll ? HSCROLL_HEIGHT : 0)), |
771 | 2475 width, height, f->display.x->font, |
2476 FONT_WIDTH (f->display.x->font), | |
2477 FONT_HEIGHT (f->display.x->font)); | |
389 | 2478 XFreePixmap (frame.border); |
2479 XFreePixmap (frame.background); | |
2480 | |
2481 if (tempwindow != 0) | |
2482 { | |
2483 XQueryWindow (tempwindow, &wininfo); | |
2484 XDestroyWindow (tempwindow); | |
2485 *x = wininfo.x; | |
2486 *y = wininfo.y; | |
2487 } | |
2488 | |
2489 /* Coordinates we got are relative to the root window. | |
2490 Convert them to coordinates relative to desired parent window | |
2491 by scanning from there up to the root. */ | |
771 | 2492 tempwindow = f->display.x->parent_desc; |
389 | 2493 while (tempwindow != ROOT_WINDOW) |
2494 { | |
2495 int nchildren; | |
2496 Window *children; | |
2497 XQueryWindow (tempwindow, &wininfo); | |
2498 *x -= wininfo.x; | |
2499 *y -= wininfo.y; | |
2500 XQueryTree (tempwindow, &tempwindow, &nchildren, &children); | |
2501 free (children); | |
2502 } | |
2503 | |
2504 UNBLOCK_INPUT; | |
2505 return tempwindow != 0; | |
2506 } | |
2507 #endif /* not HAVE_X11 */ | |
2508 | |
771 | 2509 /* Set whether frame F has a horizontal scroll bar. |
389 | 2510 VAL is t or nil to specify it. */ |
2511 | |
2512 static void | |
771 | 2513 x_set_horizontal_scrollbar (f, val, oldval) |
2514 struct frame *f; | |
389 | 2515 Lisp_Object val, oldval; |
2516 { | |
485 | 2517 if (!NILP (val)) |
389 | 2518 { |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2519 if (FRAME_X_WINDOW (f) != 0) |
389 | 2520 { |
2521 BLOCK_INPUT; | |
771 | 2522 f->display.x->h_scrollbar_height = HSCROLL_HEIGHT; |
2523 x_set_window_size (f, f->width, f->height); | |
2524 install_horizontal_scrollbar (f); | |
2525 SET_FRAME_GARBAGED (f); | |
389 | 2526 UNBLOCK_INPUT; |
2527 } | |
2528 } | |
2529 else | |
771 | 2530 if (f->display.x->h_scrollbar) |
389 | 2531 { |
2532 BLOCK_INPUT; | |
771 | 2533 f->display.x->h_scrollbar_height = 0; |
2534 XDestroyWindow (XDISPLAY f->display.x->h_scrollbar); | |
2535 f->display.x->h_scrollbar = 0; | |
2536 x_set_window_size (f, f->width, f->height); | |
2537 f->garbaged++; | |
2538 frame_garbaged++; | |
389 | 2539 BLOCK_INPUT; |
2540 } | |
2541 } | |
2542 | |
771 | 2543 /* Set whether frame F has a vertical scroll bar. |
389 | 2544 VAL is t or nil to specify it. */ |
2545 | |
2546 static void | |
771 | 2547 x_set_vertical_scrollbar (f, val, oldval) |
2548 struct frame *f; | |
389 | 2549 Lisp_Object val, oldval; |
2550 { | |
485 | 2551 if (!NILP (val)) |
389 | 2552 { |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2553 if (FRAME_X_WINDOW (f) != 0) |
389 | 2554 { |
2555 BLOCK_INPUT; | |
771 | 2556 f->display.x->v_scrollbar_width = VSCROLL_WIDTH; |
2557 x_set_window_size (f, f->width, f->height); | |
2558 install_vertical_scrollbar (f); | |
2559 SET_FRAME_GARBAGED (f); | |
389 | 2560 UNBLOCK_INPUT; |
2561 } | |
2562 } | |
2563 else | |
771 | 2564 if (f->display.x->v_scrollbar != 0) |
389 | 2565 { |
2566 BLOCK_INPUT; | |
771 | 2567 f->display.x->v_scrollbar_width = 0; |
2568 XDestroyWindow (XDISPLAY f->display.x->v_scrollbar); | |
2569 f->display.x->v_scrollbar = 0; | |
2570 x_set_window_size (f, f->width, f->height); | |
2571 SET_FRAME_GARBAGED (f); | |
389 | 2572 UNBLOCK_INPUT; |
2573 } | |
2574 } | |
2575 | |
2576 /* Create the X windows for a vertical scroll bar | |
771 | 2577 for a frame X that already has an X window but no scroll bar. */ |
389 | 2578 |
2579 static void | |
771 | 2580 install_vertical_scrollbar (f) |
2581 struct frame *f; | |
389 | 2582 { |
771 | 2583 int ibw = f->display.x->internal_border_width; |
389 | 2584 Window parent; |
2585 XColor fore_color, back_color; | |
2586 Pixmap up_arrow_pixmap, down_arrow_pixmap, slider_pixmap; | |
2587 int pix_x, pix_y, width, height, border; | |
2588 | |
771 | 2589 height = f->display.x->pixel_height - ibw - 2; |
389 | 2590 width = VSCROLL_WIDTH - 2; |
771 | 2591 pix_x = f->display.x->pixel_width - ibw/2; |
389 | 2592 pix_y = ibw / 2; |
2593 border = 1; | |
2594 | |
2595 #ifdef HAVE_X11 | |
2596 up_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2597 XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f), |
389 | 2598 up_arrow_bits, 16, 16, |
771 | 2599 f->display.x->foreground_pixel, |
2600 f->display.x->background_pixel, | |
389 | 2601 DefaultDepth (x_current_display, |
2602 XDefaultScreen (x_current_display))); | |
2603 | |
2604 down_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2605 XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f), |
389 | 2606 down_arrow_bits, 16, 16, |
771 | 2607 f->display.x->foreground_pixel, |
2608 f->display.x->background_pixel, | |
389 | 2609 DefaultDepth (x_current_display, |
2610 XDefaultScreen (x_current_display))); | |
2611 | |
2612 slider_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2613 XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f), |
389 | 2614 gray_bits, 16, 16, |
771 | 2615 f->display.x->foreground_pixel, |
2616 f->display.x->background_pixel, | |
389 | 2617 DefaultDepth (x_current_display, |
2618 XDefaultScreen (x_current_display))); | |
2619 | |
2620 /* These cursor shapes will be installed when the mouse enters | |
2621 the appropriate window. */ | |
2622 | |
2623 up_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_up_arrow); | |
2624 down_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_down_arrow); | |
2625 v_double_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_v_double_arrow); | |
2626 | |
771 | 2627 f->display.x->v_scrollbar = |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2628 XCreateSimpleWindow (x_current_display, FRAME_X_WINDOW (f), |
389 | 2629 pix_x, pix_y, width, height, border, |
771 | 2630 f->display.x->foreground_pixel, |
2631 f->display.x->background_pixel); | |
389 | 2632 XFlush (x_current_display); |
771 | 2633 XDefineCursor (x_current_display, f->display.x->v_scrollbar, |
389 | 2634 v_double_arrow_cursor); |
2635 | |
2636 /* Create slider window */ | |
771 | 2637 f->display.x->v_slider = |
2638 XCreateSimpleWindow (x_current_display, f->display.x->v_scrollbar, | |
389 | 2639 0, VSCROLL_WIDTH - 2, |
2640 VSCROLL_WIDTH - 4, VSCROLL_WIDTH - 4, | |
771 | 2641 1, f->display.x->border_pixel, |
2642 f->display.x->foreground_pixel); | |
389 | 2643 XFlush (x_current_display); |
771 | 2644 XDefineCursor (x_current_display, f->display.x->v_slider, |
389 | 2645 v_double_arrow_cursor); |
771 | 2646 XSetWindowBackgroundPixmap (x_current_display, f->display.x->v_slider, |
389 | 2647 slider_pixmap); |
2648 | |
771 | 2649 f->display.x->v_thumbup = |
2650 XCreateSimpleWindow (x_current_display, f->display.x->v_scrollbar, | |
389 | 2651 0, 0, |
2652 VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2, | |
771 | 2653 0, f->display.x->foreground_pixel, |
2654 f->display.x-> background_pixel); | |
389 | 2655 XFlush (x_current_display); |
771 | 2656 XDefineCursor (x_current_display, f->display.x->v_thumbup, |
389 | 2657 up_arrow_cursor); |
771 | 2658 XSetWindowBackgroundPixmap (x_current_display, f->display.x->v_thumbup, |
389 | 2659 up_arrow_pixmap); |
2660 | |
771 | 2661 f->display.x->v_thumbdown = |
2662 XCreateSimpleWindow (x_current_display, f->display.x->v_scrollbar, | |
389 | 2663 0, height - VSCROLL_WIDTH + 2, |
2664 VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2, | |
771 | 2665 0, f->display.x->foreground_pixel, |
2666 f->display.x->background_pixel); | |
389 | 2667 XFlush (x_current_display); |
771 | 2668 XDefineCursor (x_current_display, f->display.x->v_thumbdown, |
389 | 2669 down_arrow_cursor); |
771 | 2670 XSetWindowBackgroundPixmap (x_current_display, f->display.x->v_thumbdown, |
389 | 2671 down_arrow_pixmap); |
2672 | |
771 | 2673 fore_color.pixel = f->display.x->mouse_pixel; |
2674 back_color.pixel = f->display.x->background_pixel; | |
389 | 2675 XQueryColor (x_current_display, |
2676 DefaultColormap (x_current_display, | |
2677 DefaultScreen (x_current_display)), | |
2678 &fore_color); | |
2679 XQueryColor (x_current_display, | |
2680 DefaultColormap (x_current_display, | |
2681 DefaultScreen (x_current_display)), | |
2682 &back_color); | |
2683 XRecolorCursor (x_current_display, up_arrow_cursor, | |
2684 &fore_color, &back_color); | |
2685 XRecolorCursor (x_current_display, down_arrow_cursor, | |
2686 &fore_color, &back_color); | |
2687 XRecolorCursor (x_current_display, v_double_arrow_cursor, | |
2688 &fore_color, &back_color); | |
2689 | |
2690 XFreePixmap (x_current_display, slider_pixmap); | |
2691 XFreePixmap (x_current_display, up_arrow_pixmap); | |
2692 XFreePixmap (x_current_display, down_arrow_pixmap); | |
2693 XFlush (x_current_display); | |
2694 | |
771 | 2695 XSelectInput (x_current_display, f->display.x->v_scrollbar, |
389 | 2696 ButtonPressMask | ButtonReleaseMask |
2697 | PointerMotionMask | PointerMotionHintMask | |
2698 | EnterWindowMask); | |
771 | 2699 XSelectInput (x_current_display, f->display.x->v_slider, |
389 | 2700 ButtonPressMask | ButtonReleaseMask); |
771 | 2701 XSelectInput (x_current_display, f->display.x->v_thumbdown, |
389 | 2702 ButtonPressMask | ButtonReleaseMask); |
771 | 2703 XSelectInput (x_current_display, f->display.x->v_thumbup, |
389 | 2704 ButtonPressMask | ButtonReleaseMask); |
2705 XFlush (x_current_display); | |
2706 | |
2707 /* This should be done at the same time as the main window. */ | |
771 | 2708 XMapWindow (x_current_display, f->display.x->v_scrollbar); |
2709 XMapSubwindows (x_current_display, f->display.x->v_scrollbar); | |
389 | 2710 XFlush (x_current_display); |
2711 #else /* not HAVE_X11 */ | |
2712 Bitmap b; | |
2713 Pixmap fore_tile, back_tile, bord_tile; | |
2714 static short up_arrow_bits[] = { | |
2715 0x0000, 0x0180, 0x03c0, 0x07e0, | |
2716 0x0ff0, 0x1ff8, 0x3ffc, 0x7ffe, | |
2717 0x0180, 0x0180, 0x0180, 0x0180, | |
2718 0x0180, 0x0180, 0x0180, 0xffff}; | |
2719 static short down_arrow_bits[] = { | |
2720 0xffff, 0x0180, 0x0180, 0x0180, | |
2721 0x0180, 0x0180, 0x0180, 0x0180, | |
2722 0x7ffe, 0x3ffc, 0x1ff8, 0x0ff0, | |
2723 0x07e0, 0x03c0, 0x0180, 0x0000}; | |
2724 | |
771 | 2725 fore_tile = XMakeTile (f->display.x->foreground_pixel); |
2726 back_tile = XMakeTile (f->display.x->background_pixel); | |
2727 bord_tile = XMakeTile (f->display.x->border_pixel); | |
389 | 2728 |
2729 b = XStoreBitmap (VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2, up_arrow_bits); | |
2730 up_arrow_pixmap = XMakePixmap (b, | |
771 | 2731 f->display.x->foreground_pixel, |
2732 f->display.x->background_pixel); | |
389 | 2733 XFreeBitmap (b); |
2734 | |
2735 b = XStoreBitmap (VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2, down_arrow_bits); | |
2736 down_arrow_pixmap = XMakePixmap (b, | |
771 | 2737 f->display.x->foreground_pixel, |
2738 f->display.x->background_pixel); | |
389 | 2739 XFreeBitmap (b); |
2740 | |
771 | 2741 ibw = f->display.x->internal_border_width; |
2742 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2743 f->display.x->v_scrollbar = XCreateWindow (FRAME_X_WINDOW (f), |
389 | 2744 width - VSCROLL_WIDTH - ibw/2, |
2745 ibw/2, | |
2746 VSCROLL_WIDTH - 2, | |
2747 height - ibw - 2, | |
2748 1, bord_tile, back_tile); | |
2749 | |
771 | 2750 f->display.x->v_scrollbar_width = VSCROLL_WIDTH; |
2751 | |
2752 f->display.x->v_thumbup = XCreateWindow (f->display.x->v_scrollbar, | |
389 | 2753 0, 0, |
2754 VSCROLL_WIDTH - 2, | |
2755 VSCROLL_WIDTH - 2, | |
2756 0, 0, up_arrow_pixmap); | |
771 | 2757 XTileAbsolute (f->display.x->v_thumbup); |
2758 | |
2759 f->display.x->v_thumbdown = XCreateWindow (f->display.x->v_scrollbar, | |
389 | 2760 0, |
2761 height - ibw - VSCROLL_WIDTH, | |
2762 VSCROLL_WIDTH - 2, | |
2763 VSCROLL_WIDTH - 2, | |
2764 0, 0, down_arrow_pixmap); | |
771 | 2765 XTileAbsolute (f->display.x->v_thumbdown); |
2766 | |
2767 f->display.x->v_slider = XCreateWindow (f->display.x->v_scrollbar, | |
389 | 2768 0, VSCROLL_WIDTH - 2, |
2769 VSCROLL_WIDTH - 4, | |
2770 VSCROLL_WIDTH - 4, | |
2771 1, back_tile, fore_tile); | |
2772 | |
771 | 2773 XSelectInput (f->display.x->v_scrollbar, |
389 | 2774 (ButtonPressed | ButtonReleased | KeyPressed)); |
771 | 2775 XSelectInput (f->display.x->v_thumbup, |
389 | 2776 (ButtonPressed | ButtonReleased | KeyPressed)); |
2777 | |
771 | 2778 XSelectInput (f->display.x->v_thumbdown, |
389 | 2779 (ButtonPressed | ButtonReleased | KeyPressed)); |
2780 | |
771 | 2781 XMapWindow (f->display.x->v_thumbup); |
2782 XMapWindow (f->display.x->v_thumbdown); | |
2783 XMapWindow (f->display.x->v_slider); | |
2784 XMapWindow (f->display.x->v_scrollbar); | |
389 | 2785 |
2786 XFreePixmap (fore_tile); | |
2787 XFreePixmap (back_tile); | |
2788 XFreePixmap (up_arrow_pixmap); | |
2789 XFreePixmap (down_arrow_pixmap); | |
2790 #endif /* not HAVE_X11 */ | |
2791 } | |
2792 | |
2793 static void | |
771 | 2794 install_horizontal_scrollbar (f) |
2795 struct frame *f; | |
389 | 2796 { |
771 | 2797 int ibw = f->display.x->internal_border_width; |
389 | 2798 Window parent; |
2799 Pixmap left_arrow_pixmap, right_arrow_pixmap, slider_pixmap; | |
2800 int pix_x, pix_y; | |
2801 int width; | |
2802 | |
2803 pix_x = ibw; | |
771 | 2804 pix_y = PIXEL_HEIGHT (f) - HSCROLL_HEIGHT - ibw ; |
2805 width = PIXEL_WIDTH (f) - 2 * ibw; | |
2806 if (f->display.x->v_scrollbar_width) | |
2807 width -= (f->display.x->v_scrollbar_width + 1); | |
389 | 2808 |
2809 #ifdef HAVE_X11 | |
2810 left_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2811 XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f), |
389 | 2812 left_arrow_bits, 16, 16, |
771 | 2813 f->display.x->foreground_pixel, |
2814 f->display.x->background_pixel, | |
389 | 2815 DefaultDepth (x_current_display, |
2816 XDefaultScreen (x_current_display))); | |
2817 | |
2818 right_arrow_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2819 XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f), |
389 | 2820 right_arrow_bits, 16, 16, |
771 | 2821 f->display.x->foreground_pixel, |
2822 f->display.x->background_pixel, | |
389 | 2823 DefaultDepth (x_current_display, |
2824 XDefaultScreen (x_current_display))); | |
2825 | |
2826 slider_pixmap = | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2827 XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f), |
389 | 2828 gray_bits, 16, 16, |
771 | 2829 f->display.x->foreground_pixel, |
2830 f->display.x->background_pixel, | |
389 | 2831 DefaultDepth (x_current_display, |
2832 XDefaultScreen (x_current_display))); | |
2833 | |
2834 left_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_left_arrow); | |
2835 right_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_right_arrow); | |
2836 h_double_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_h_double_arrow); | |
2837 | |
771 | 2838 f->display.x->h_scrollbar = |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2839 XCreateSimpleWindow (x_current_display, FRAME_X_WINDOW (f), |
389 | 2840 pix_x, pix_y, |
2841 width - ibw - 2, HSCROLL_HEIGHT - 2, 1, | |
771 | 2842 f->display.x->foreground_pixel, |
2843 f->display.x->background_pixel); | |
2844 XDefineCursor (x_current_display, f->display.x->h_scrollbar, | |
389 | 2845 h_double_arrow_cursor); |
2846 | |
771 | 2847 f->display.x->h_slider = |
2848 XCreateSimpleWindow (x_current_display, f->display.x->h_scrollbar, | |
389 | 2849 0, 0, |
2850 HSCROLL_HEIGHT - 4, HSCROLL_HEIGHT - 4, | |
771 | 2851 1, f->display.x->foreground_pixel, |
2852 f->display.x->background_pixel); | |
2853 XDefineCursor (x_current_display, f->display.x->h_slider, | |
389 | 2854 h_double_arrow_cursor); |
771 | 2855 XSetWindowBackgroundPixmap (x_current_display, f->display.x->h_slider, |
389 | 2856 slider_pixmap); |
2857 | |
771 | 2858 f->display.x->h_thumbleft = |
2859 XCreateSimpleWindow (x_current_display, f->display.x->h_scrollbar, | |
389 | 2860 0, 0, |
2861 HSCROLL_HEIGHT - 2, HSCROLL_HEIGHT - 2, | |
771 | 2862 0, f->display.x->foreground_pixel, |
2863 f->display.x->background_pixel); | |
2864 XDefineCursor (x_current_display, f->display.x->h_thumbleft, | |
389 | 2865 left_arrow_cursor); |
771 | 2866 XSetWindowBackgroundPixmap (x_current_display, f->display.x->h_thumbleft, |
389 | 2867 left_arrow_pixmap); |
2868 | |
771 | 2869 f->display.x->h_thumbright = |
2870 XCreateSimpleWindow (x_current_display, f->display.x->h_scrollbar, | |
389 | 2871 width - ibw - HSCROLL_HEIGHT, 0, |
2872 HSCROLL_HEIGHT - 2, HSCROLL_HEIGHT -2, | |
771 | 2873 0, f->display.x->foreground_pixel, |
2874 f->display.x->background_pixel); | |
2875 XDefineCursor (x_current_display, f->display.x->h_thumbright, | |
389 | 2876 right_arrow_cursor); |
771 | 2877 XSetWindowBackgroundPixmap (x_current_display, f->display.x->h_thumbright, |
389 | 2878 right_arrow_pixmap); |
2879 | |
2880 XFreePixmap (x_current_display, slider_pixmap); | |
2881 XFreePixmap (x_current_display, left_arrow_pixmap); | |
2882 XFreePixmap (x_current_display, right_arrow_pixmap); | |
2883 | |
771 | 2884 XSelectInput (x_current_display, f->display.x->h_scrollbar, |
389 | 2885 ButtonPressMask | ButtonReleaseMask |
2886 | PointerMotionMask | PointerMotionHintMask | |
2887 | EnterWindowMask); | |
771 | 2888 XSelectInput (x_current_display, f->display.x->h_slider, |
389 | 2889 ButtonPressMask | ButtonReleaseMask); |
771 | 2890 XSelectInput (x_current_display, f->display.x->h_thumbright, |
389 | 2891 ButtonPressMask | ButtonReleaseMask); |
771 | 2892 XSelectInput (x_current_display, f->display.x->h_thumbleft, |
389 | 2893 ButtonPressMask | ButtonReleaseMask); |
2894 | |
771 | 2895 XMapWindow (x_current_display, f->display.x->h_scrollbar); |
2896 XMapSubwindows (x_current_display, f->display.x->h_scrollbar); | |
389 | 2897 #else /* not HAVE_X11 */ |
2898 Bitmap b; | |
2899 Pixmap fore_tile, back_tile, bord_tile; | |
2900 #endif | |
2901 } | |
2902 | |
2903 #ifndef HAVE_X11 /* X10 */ | |
2904 #define XMoveResizeWindow XConfigureWindow | |
2905 #endif /* not HAVE_X11 */ | |
2906 | |
2907 /* Adjust the displayed position in the scroll bar for window W. */ | |
2908 | |
2909 void | |
771 | 2910 adjust_scrollbars (f) |
2911 struct frame *f; | |
389 | 2912 { |
2913 int pos; | |
2914 int first_char_in_window, char_beyond_window, chars_in_window; | |
2915 int chars_in_buffer, buffer_size; | |
771 | 2916 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); |
2917 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2918 if (! FRAME_X_P (f)) |
389 | 2919 return; |
2920 | |
771 | 2921 if (f->display.x->v_scrollbar != 0) |
389 | 2922 { |
2923 int h, height; | |
2924 struct buffer *b = XBUFFER (w->buffer); | |
2925 | |
2926 buffer_size = Z - BEG; | |
2927 chars_in_buffer = ZV - BEGV; | |
2928 first_char_in_window = marker_position (w->start); | |
2929 char_beyond_window = buffer_size + 1 - XFASTINT (w->window_end_pos); | |
2930 chars_in_window = char_beyond_window - first_char_in_window; | |
2931 | |
2932 /* Calculate height of scrollbar area */ | |
2933 | |
771 | 2934 height = f->height * FONT_HEIGHT (f->display.x->font) |
2935 + f->display.x->internal_border_width | |
2936 - 2 * (f->display.x->v_scrollbar_width); | |
389 | 2937 |
2938 /* Figure starting position for the scrollbar slider */ | |
2939 | |
2940 if (chars_in_buffer <= 0) | |
2941 pos = 0; | |
2942 else | |
2943 pos = ((first_char_in_window - BEGV - BEG) * height | |
2944 / chars_in_buffer); | |
2945 pos = max (0, pos); | |
2946 pos = min (pos, height - 2); | |
2947 | |
2948 /* Figure length of the slider */ | |
2949 | |
2950 if (chars_in_buffer <= 0) | |
2951 h = height; | |
2952 else | |
2953 h = (chars_in_window * height) / chars_in_buffer; | |
2954 h = min (h, height - pos); | |
2955 h = max (h, 1); | |
2956 | |
2957 /* Add thumbup offset to starting position of slider */ | |
2958 | |
771 | 2959 pos += (f->display.x->v_scrollbar_width - 2); |
389 | 2960 |
2961 XMoveResizeWindow (XDISPLAY | |
771 | 2962 f->display.x->v_slider, |
389 | 2963 0, pos, |
771 | 2964 f->display.x->v_scrollbar_width - 4, h); |
389 | 2965 } |
2966 | |
771 | 2967 if (f->display.x->h_scrollbar != 0) |
389 | 2968 { |
2969 int l, length; /* Length of the scrollbar area */ | |
2970 | |
771 | 2971 length = f->width * FONT_WIDTH (f->display.x->font) |
2972 + f->display.x->internal_border_width | |
2973 - 2 * (f->display.x->h_scrollbar_height); | |
389 | 2974 |
2975 /* Starting position for horizontal slider */ | |
2976 if (! w->hscroll) | |
2977 pos = 0; | |
2978 else | |
771 | 2979 pos = (w->hscroll * length) / (w->hscroll + f->width); |
389 | 2980 pos = max (0, pos); |
2981 pos = min (pos, length - 2); | |
2982 | |
2983 /* Length of slider */ | |
2984 l = length - pos; | |
2985 | |
2986 /* Add thumbup offset */ | |
771 | 2987 pos += (f->display.x->h_scrollbar_height - 2); |
389 | 2988 |
2989 XMoveResizeWindow (XDISPLAY | |
771 | 2990 f->display.x->h_slider, |
389 | 2991 pos, 0, |
771 | 2992 l, f->display.x->h_scrollbar_height - 4); |
389 | 2993 } |
2994 } | |
2995 | |
771 | 2996 /* Adjust the size of the scroll bars of frame F, |
2997 when the frame size has changed. */ | |
389 | 2998 |
2999 void | |
771 | 3000 x_resize_scrollbars (f) |
3001 struct frame *f; | |
389 | 3002 { |
771 | 3003 int ibw = f->display.x->internal_border_width; |
389 | 3004 int pixelwidth, pixelheight; |
3005 | |
771 | 3006 if (f == 0 |
3007 || f->display.x == 0 | |
3008 || (f->display.x->v_scrollbar == 0 | |
3009 && f->display.x->h_scrollbar == 0)) | |
389 | 3010 return; |
3011 | |
771 | 3012 /* Get the size of the frame. */ |
3013 pixelwidth = (f->width * FONT_WIDTH (f->display.x->font) | |
3014 + 2 * ibw + f->display.x->v_scrollbar_width); | |
3015 pixelheight = (f->height * FONT_HEIGHT (f->display.x->font) | |
3016 + 2 * ibw + f->display.x->h_scrollbar_height); | |
3017 | |
3018 if (f->display.x->v_scrollbar_width && f->display.x->v_scrollbar) | |
389 | 3019 { |
3020 BLOCK_INPUT; | |
3021 XMoveResizeWindow (XDISPLAY | |
771 | 3022 f->display.x->v_scrollbar, |
3023 pixelwidth - f->display.x->v_scrollbar_width - ibw/2, | |
389 | 3024 ibw/2, |
771 | 3025 f->display.x->v_scrollbar_width - 2, |
389 | 3026 pixelheight - ibw - 2); |
3027 XMoveWindow (XDISPLAY | |
771 | 3028 f->display.x->v_thumbdown, 0, |
3029 pixelheight - ibw - f->display.x->v_scrollbar_width); | |
389 | 3030 UNBLOCK_INPUT; |
3031 } | |
3032 | |
771 | 3033 if (f->display.x->h_scrollbar_height && f->display.x->h_scrollbar) |
389 | 3034 { |
771 | 3035 if (f->display.x->v_scrollbar_width) |
3036 pixelwidth -= f->display.x->v_scrollbar_width + 1; | |
389 | 3037 |
3038 BLOCK_INPUT; | |
3039 XMoveResizeWindow (XDISPLAY | |
771 | 3040 f->display.x->h_scrollbar, |
389 | 3041 ibw / 2, |
771 | 3042 pixelheight - f->display.x->h_scrollbar_height - ibw / 2, |
389 | 3043 pixelwidth - ibw - 2, |
771 | 3044 f->display.x->h_scrollbar_height - 2); |
389 | 3045 XMoveWindow (XDISPLAY |
771 | 3046 f->display.x->h_thumbright, |
3047 pixelwidth - ibw - f->display.x->h_scrollbar_height, 0); | |
389 | 3048 UNBLOCK_INPUT; |
3049 } | |
3050 } | |
3051 | |
771 | 3052 x_pixel_width (f) |
3053 register struct frame *f; | |
389 | 3054 { |
771 | 3055 return PIXEL_WIDTH (f); |
389 | 3056 } |
3057 | |
771 | 3058 x_pixel_height (f) |
3059 register struct frame *f; | |
389 | 3060 { |
771 | 3061 return PIXEL_HEIGHT (f); |
389 | 3062 } |
3063 | |
3064 DEFUN ("x-defined-color", Fx_defined_color, Sx_defined_color, 1, 1, 0, | |
3065 "Return t if the current X display supports the color named COLOR.") | |
3066 (color) | |
3067 Lisp_Object color; | |
3068 { | |
3069 Color foo; | |
3070 | |
3071 CHECK_STRING (color, 0); | |
3072 | |
3073 if (defined_color (XSTRING (color)->data, &foo)) | |
3074 return Qt; | |
3075 else | |
3076 return Qnil; | |
3077 } | |
3078 | |
3079 DEFUN ("x-color-display-p", Fx_color_display_p, Sx_color_display_p, 0, 0, 0, | |
3080 "Return t if the X display used currently supports color.") | |
3081 () | |
3082 { | |
3083 if (XINT (x_screen_planes) <= 2) | |
3084 return Qnil; | |
3085 | |
3086 switch (screen_visual->class) | |
3087 { | |
3088 case StaticColor: | |
3089 case PseudoColor: | |
3090 case TrueColor: | |
3091 case DirectColor: | |
3092 return Qt; | |
3093 | |
3094 default: | |
3095 return Qnil; | |
3096 } | |
3097 } | |
3098 | |
3099 DEFUN ("x-pixel-width", Fx_pixel_width, Sx_pixel_width, 1, 1, 0, | |
771 | 3100 "Return the width in pixels of FRAME.") |
3101 (frame) | |
3102 Lisp_Object frame; | |
389 | 3103 { |
771 | 3104 CHECK_LIVE_FRAME (frame, 0); |
3105 return make_number (XFRAME (frame)->display.x->pixel_width); | |
389 | 3106 } |
3107 | |
3108 DEFUN ("x-pixel-height", Fx_pixel_height, Sx_pixel_height, 1, 1, 0, | |
771 | 3109 "Return the height in pixels of FRAME.") |
3110 (frame) | |
3111 Lisp_Object frame; | |
389 | 3112 { |
771 | 3113 CHECK_LIVE_FRAME (frame, 0); |
3114 return make_number (XFRAME (frame)->display.x->pixel_height); | |
389 | 3115 } |
3116 | |
689
45401d45581d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
687
diff
changeset
|
3117 #if 0 /* These no longer seem like the right way to do things. */ |
45401d45581d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
687
diff
changeset
|
3118 |
771 | 3119 /* Draw a rectangle on the frame with left top corner including |
389 | 3120 the character specified by LEFT_CHAR and TOP_CHAR. The rectangle is |
3121 CHARS by LINES wide and long and is the color of the cursor. */ | |
3122 | |
3123 void | |
771 | 3124 x_rectangle (f, gc, left_char, top_char, chars, lines) |
3125 register struct frame *f; | |
389 | 3126 GC gc; |
3127 register int top_char, left_char, chars, lines; | |
3128 { | |
3129 int width; | |
3130 int height; | |
771 | 3131 int left = (left_char * FONT_WIDTH (f->display.x->font) |
3132 + f->display.x->internal_border_width); | |
3133 int top = (top_char * FONT_HEIGHT (f->display.x->font) | |
3134 + f->display.x->internal_border_width); | |
389 | 3135 |
3136 if (chars < 0) | |
771 | 3137 width = FONT_WIDTH (f->display.x->font) / 2; |
389 | 3138 else |
771 | 3139 width = FONT_WIDTH (f->display.x->font) * chars; |
389 | 3140 if (lines < 0) |
771 | 3141 height = FONT_HEIGHT (f->display.x->font) / 2; |
389 | 3142 else |
771 | 3143 height = FONT_HEIGHT (f->display.x->font) * lines; |
3144 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3145 XDrawRectangle (x_current_display, FRAME_X_WINDOW (f), |
389 | 3146 gc, left, top, width, height); |
3147 } | |
3148 | |
3149 DEFUN ("x-draw-rectangle", Fx_draw_rectangle, Sx_draw_rectangle, 5, 5, 0, | |
771 | 3150 "Draw a rectangle on FRAME between coordinates specified by\n\ |
389 | 3151 numbers X0, Y0, X1, Y1 in the cursor pixel.") |
771 | 3152 (frame, X0, Y0, X1, Y1) |
3153 register Lisp_Object frame, X0, X1, Y0, Y1; | |
389 | 3154 { |
3155 register int x0, y0, x1, y1, top, left, n_chars, n_lines; | |
3156 | |
771 | 3157 CHECK_LIVE_FRAME (frame, 0); |
389 | 3158 CHECK_NUMBER (X0, 0); |
3159 CHECK_NUMBER (Y0, 1); | |
3160 CHECK_NUMBER (X1, 2); | |
3161 CHECK_NUMBER (Y1, 3); | |
3162 | |
3163 x0 = XINT (X0); | |
3164 x1 = XINT (X1); | |
3165 y0 = XINT (Y0); | |
3166 y1 = XINT (Y1); | |
3167 | |
3168 if (y1 > y0) | |
3169 { | |
3170 top = y0; | |
3171 n_lines = y1 - y0 + 1; | |
3172 } | |
3173 else | |
3174 { | |
3175 top = y1; | |
3176 n_lines = y0 - y1 + 1; | |
3177 } | |
3178 | |
3179 if (x1 > x0) | |
3180 { | |
3181 left = x0; | |
3182 n_chars = x1 - x0 + 1; | |
3183 } | |
3184 else | |
3185 { | |
3186 left = x1; | |
3187 n_chars = x0 - x1 + 1; | |
3188 } | |
3189 | |
3190 BLOCK_INPUT; | |
771 | 3191 x_rectangle (XFRAME (frame), XFRAME (frame)->display.x->cursor_gc, |
389 | 3192 left, top, n_chars, n_lines); |
3193 UNBLOCK_INPUT; | |
3194 | |
3195 return Qt; | |
3196 } | |
3197 | |
3198 DEFUN ("x-erase-rectangle", Fx_erase_rectangle, Sx_erase_rectangle, 5, 5, 0, | |
771 | 3199 "Draw a rectangle drawn on FRAME between coordinates\n\ |
389 | 3200 X0, Y0, X1, Y1 in the regular background-pixel.") |
771 | 3201 (frame, X0, Y0, X1, Y1) |
3202 register Lisp_Object frame, X0, Y0, X1, Y1; | |
389 | 3203 { |
3204 register int x0, y0, x1, y1, top, left, n_chars, n_lines; | |
3205 | |
771 | 3206 CHECK_FRAME (frame, 0); |
389 | 3207 CHECK_NUMBER (X0, 0); |
3208 CHECK_NUMBER (Y0, 1); | |
3209 CHECK_NUMBER (X1, 2); | |
3210 CHECK_NUMBER (Y1, 3); | |
3211 | |
3212 x0 = XINT (X0); | |
3213 x1 = XINT (X1); | |
3214 y0 = XINT (Y0); | |
3215 y1 = XINT (Y1); | |
3216 | |
3217 if (y1 > y0) | |
3218 { | |
3219 top = y0; | |
3220 n_lines = y1 - y0 + 1; | |
3221 } | |
3222 else | |
3223 { | |
3224 top = y1; | |
3225 n_lines = y0 - y1 + 1; | |
3226 } | |
3227 | |
3228 if (x1 > x0) | |
3229 { | |
3230 left = x0; | |
3231 n_chars = x1 - x0 + 1; | |
3232 } | |
3233 else | |
3234 { | |
3235 left = x1; | |
3236 n_chars = x0 - x1 + 1; | |
3237 } | |
3238 | |
3239 BLOCK_INPUT; | |
771 | 3240 x_rectangle (XFRAME (frame), XFRAME (frame)->display.x->reverse_gc, |
389 | 3241 left, top, n_chars, n_lines); |
3242 UNBLOCK_INPUT; | |
3243 | |
3244 return Qt; | |
3245 } | |
3246 | |
3247 /* Draw lines around the text region beginning at the character position | |
3248 TOP_X, TOP_Y and ending at BOTTOM_X and BOTTOM_Y. GC specifies the | |
3249 pixel and line characteristics. */ | |
3250 | |
771 | 3251 #define line_len(line) (FRAME_CURRENT_GLYPHS (f)->used[(line)]) |
389 | 3252 |
3253 static void | |
771 | 3254 outline_region (f, gc, top_x, top_y, bottom_x, bottom_y) |
3255 register struct frame *f; | |
389 | 3256 GC gc; |
3257 int top_x, top_y, bottom_x, bottom_y; | |
3258 { | |
771 | 3259 register int ibw = f->display.x->internal_border_width; |
3260 register int font_w = FONT_WIDTH (f->display.x->font); | |
3261 register int font_h = FONT_HEIGHT (f->display.x->font); | |
389 | 3262 int y = top_y; |
3263 int x = line_len (y); | |
3264 XPoint *pixel_points = (XPoint *) | |
3265 alloca (((bottom_y - top_y + 2) * 4) * sizeof (XPoint)); | |
3266 register XPoint *this_point = pixel_points; | |
3267 | |
3268 /* Do the horizontal top line/lines */ | |
3269 if (top_x == 0) | |
3270 { | |
3271 this_point->x = ibw; | |
3272 this_point->y = ibw + (font_h * top_y); | |
3273 this_point++; | |
3274 if (x == 0) | |
3275 this_point->x = ibw + (font_w / 2); /* Half-size for newline chars. */ | |
3276 else | |
3277 this_point->x = ibw + (font_w * x); | |
3278 this_point->y = (this_point - 1)->y; | |
3279 } | |
3280 else | |
3281 { | |
3282 this_point->x = ibw; | |
3283 this_point->y = ibw + (font_h * (top_y + 1)); | |
3284 this_point++; | |
3285 this_point->x = ibw + (font_w * top_x); | |
3286 this_point->y = (this_point - 1)->y; | |
3287 this_point++; | |
3288 this_point->x = (this_point - 1)->x; | |
3289 this_point->y = ibw + (font_h * top_y); | |
3290 this_point++; | |
3291 this_point->x = ibw + (font_w * x); | |
3292 this_point->y = (this_point - 1)->y; | |
3293 } | |
3294 | |
3295 /* Now do the right side. */ | |
3296 while (y < bottom_y) | |
3297 { /* Right vertical edge */ | |
3298 this_point++; | |
3299 this_point->x = (this_point - 1)->x; | |
3300 this_point->y = ibw + (font_h * (y + 1)); | |
3301 this_point++; | |
3302 | |
3303 y++; /* Horizontal connection to next line */ | |
3304 x = line_len (y); | |
3305 if (x == 0) | |
3306 this_point->x = ibw + (font_w / 2); | |
3307 else | |
3308 this_point->x = ibw + (font_w * x); | |
3309 | |
3310 this_point->y = (this_point - 1)->y; | |
3311 } | |
3312 | |
3313 /* Now do the bottom and connect to the top left point. */ | |
3314 this_point->x = ibw + (font_w * (bottom_x + 1)); | |
3315 | |
3316 this_point++; | |
3317 this_point->x = (this_point - 1)->x; | |
3318 this_point->y = ibw + (font_h * (bottom_y + 1)); | |
3319 this_point++; | |
3320 this_point->x = ibw; | |
3321 this_point->y = (this_point - 1)->y; | |
3322 this_point++; | |
3323 this_point->x = pixel_points->x; | |
3324 this_point->y = pixel_points->y; | |
3325 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3326 XDrawLines (x_current_display, FRAME_X_WINDOW (f), |
389 | 3327 gc, pixel_points, |
3328 (this_point - pixel_points + 1), CoordModeOrigin); | |
3329 } | |
3330 | |
3331 DEFUN ("x-contour-region", Fx_contour_region, Sx_contour_region, 1, 1, 0, | |
3332 "Highlight the region between point and the character under the mouse\n\ | |
771 | 3333 selected frame.") |
389 | 3334 (event) |
3335 register Lisp_Object event; | |
3336 { | |
3337 register int x0, y0, x1, y1; | |
771 | 3338 register struct frame *f = selected_frame; |
389 | 3339 register int p1, p2; |
3340 | |
3341 CHECK_CONS (event, 0); | |
3342 | |
3343 BLOCK_INPUT; | |
3344 x0 = XINT (Fcar (Fcar (event))); | |
3345 y0 = XINT (Fcar (Fcdr (Fcar (event)))); | |
3346 | |
3347 /* If the mouse is past the end of the line, don't that area. */ | |
3348 /* ReWrite this... */ | |
3349 | |
771 | 3350 x1 = f->cursor_x; |
3351 y1 = f->cursor_y; | |
389 | 3352 |
3353 if (y1 > y0) /* point below mouse */ | |
771 | 3354 outline_region (f, f->display.x->cursor_gc, |
389 | 3355 x0, y0, x1, y1); |
3356 else if (y1 < y0) /* point above mouse */ | |
771 | 3357 outline_region (f, f->display.x->cursor_gc, |
389 | 3358 x1, y1, x0, y0); |
3359 else /* same line: draw horizontal rectangle */ | |
3360 { | |
3361 if (x1 > x0) | |
771 | 3362 x_rectangle (f, f->display.x->cursor_gc, |
389 | 3363 x0, y0, (x1 - x0 + 1), 1); |
3364 else if (x1 < x0) | |
771 | 3365 x_rectangle (f, f->display.x->cursor_gc, |
389 | 3366 x1, y1, (x0 - x1 + 1), 1); |
3367 } | |
3368 | |
3369 XFlush (x_current_display); | |
3370 UNBLOCK_INPUT; | |
3371 | |
3372 return Qnil; | |
3373 } | |
3374 | |
3375 DEFUN ("x-uncontour-region", Fx_uncontour_region, Sx_uncontour_region, 1, 1, 0, | |
3376 "Erase any highlighting of the region between point and the character\n\ | |
771 | 3377 at X, Y on the selected frame.") |
389 | 3378 (event) |
3379 register Lisp_Object event; | |
3380 { | |
3381 register int x0, y0, x1, y1; | |
771 | 3382 register struct frame *f = selected_frame; |
389 | 3383 |
3384 BLOCK_INPUT; | |
3385 x0 = XINT (Fcar (Fcar (event))); | |
3386 y0 = XINT (Fcar (Fcdr (Fcar (event)))); | |
771 | 3387 x1 = f->cursor_x; |
3388 y1 = f->cursor_y; | |
389 | 3389 |
3390 if (y1 > y0) /* point below mouse */ | |
771 | 3391 outline_region (f, f->display.x->reverse_gc, |
389 | 3392 x0, y0, x1, y1); |
3393 else if (y1 < y0) /* point above mouse */ | |
771 | 3394 outline_region (f, f->display.x->reverse_gc, |
389 | 3395 x1, y1, x0, y0); |
3396 else /* same line: draw horizontal rectangle */ | |
3397 { | |
3398 if (x1 > x0) | |
771 | 3399 x_rectangle (f, f->display.x->reverse_gc, |
389 | 3400 x0, y0, (x1 - x0 + 1), 1); |
3401 else if (x1 < x0) | |
771 | 3402 x_rectangle (f, f->display.x->reverse_gc, |
389 | 3403 x1, y1, (x0 - x1 + 1), 1); |
3404 } | |
3405 UNBLOCK_INPUT; | |
3406 | |
3407 return Qnil; | |
3408 } | |
3409 | |
3410 #if 0 | |
3411 int contour_begin_x, contour_begin_y; | |
3412 int contour_end_x, contour_end_y; | |
3413 int contour_npoints; | |
3414 | |
3415 /* Clip the top part of the contour lines down (and including) line Y_POS. | |
3416 If X_POS is in the middle (rather than at the end) of the line, drop | |
3417 down a line at that character. */ | |
3418 | |
3419 static void | |
3420 clip_contour_top (y_pos, x_pos) | |
3421 { | |
3422 register XPoint *begin = contour_lines[y_pos].top_left; | |
3423 register XPoint *end; | |
3424 register int npoints; | |
771 | 3425 register struct display_line *line = selected_frame->phys_lines[y_pos + 1]; |
389 | 3426 |
3427 if (x_pos >= line->len - 1) /* Draw one, straight horizontal line. */ | |
3428 { | |
3429 end = contour_lines[y_pos].top_right; | |
3430 npoints = (end - begin + 1); | |
3431 XDrawLines (x_current_display, contour_window, | |
3432 contour_erase_gc, begin_erase, npoints, CoordModeOrigin); | |
3433 | |
3434 bcopy (end, begin + 1, contour_last_point - end + 1); | |
3435 contour_last_point -= (npoints - 2); | |
3436 XDrawLines (x_current_display, contour_window, | |
3437 contour_erase_gc, begin, 2, CoordModeOrigin); | |
3438 XFlush (x_current_display); | |
3439 | |
3440 /* Now, update contour_lines structure. */ | |
3441 } | |
3442 /* ______. */ | |
3443 else /* |________*/ | |
3444 { | |
3445 register XPoint *p = begin + 1; | |
3446 end = contour_lines[y_pos].bottom_right; | |
3447 npoints = (end - begin + 1); | |
3448 XDrawLines (x_current_display, contour_window, | |
3449 contour_erase_gc, begin_erase, npoints, CoordModeOrigin); | |
3450 | |
3451 p->y = begin->y; | |
3452 p->x = ibw + (font_w * (x_pos + 1)); | |
3453 p++; | |
3454 p->y = begin->y + font_h; | |
3455 p->x = (p - 1)->x; | |
3456 bcopy (end, begin + 3, contour_last_point - end + 1); | |
3457 contour_last_point -= (npoints - 5); | |
3458 XDrawLines (x_current_display, contour_window, | |
3459 contour_erase_gc, begin, 4, CoordModeOrigin); | |
3460 XFlush (x_current_display); | |
3461 | |
3462 /* Now, update contour_lines structure. */ | |
3463 } | |
3464 } | |
3465 | |
3466 /* Erase the top horzontal lines of the contour, and then extend | |
3467 the contour upwards. */ | |
3468 | |
3469 static void | |
3470 extend_contour_top (line) | |
3471 { | |
3472 } | |
3473 | |
3474 static void | |
3475 clip_contour_bottom (x_pos, y_pos) | |
3476 int x_pos, y_pos; | |
3477 { | |
3478 } | |
3479 | |
3480 static void | |
3481 extend_contour_bottom (x_pos, y_pos) | |
3482 { | |
3483 } | |
3484 | |
3485 DEFUN ("x-select-region", Fx_select_region, Sx_select_region, 1, 1, "e", | |
3486 "") | |
3487 (event) | |
3488 Lisp_Object event; | |
3489 { | |
771 | 3490 register struct frame *f = selected_frame; |
3491 register int point_x = f->cursor_x; | |
3492 register int point_y = f->cursor_y; | |
389 | 3493 register int mouse_below_point; |
3494 register Lisp_Object obj; | |
3495 register int x_contour_x, x_contour_y; | |
3496 | |
3497 x_contour_x = x_mouse_x; | |
3498 x_contour_y = x_mouse_y; | |
3499 if (x_contour_y > point_y || (x_contour_y == point_y | |
3500 && x_contour_x > point_x)) | |
3501 { | |
3502 mouse_below_point = 1; | |
771 | 3503 outline_region (f, f->display.x->cursor_gc, point_x, point_y, |
389 | 3504 x_contour_x, x_contour_y); |
3505 } | |
3506 else | |
3507 { | |
3508 mouse_below_point = 0; | |
771 | 3509 outline_region (f, f->display.x->cursor_gc, x_contour_x, x_contour_y, |
389 | 3510 point_x, point_y); |
3511 } | |
3512 | |
3513 while (1) | |
3514 { | |
1096
d79192bacdce
(Fx_track_pointer): Pass new args to read_char.
Richard M. Stallman <rms@gnu.org>
parents:
1050
diff
changeset
|
3515 obj = read_char (-1, 0, 0, Qnil, 0); |
389 | 3516 if (XTYPE (obj) != Lisp_Cons) |
3517 break; | |
3518 | |
3519 if (mouse_below_point) | |
3520 { | |
3521 if (x_mouse_y <= point_y) /* Flipped. */ | |
3522 { | |
3523 mouse_below_point = 0; | |
3524 | |
771 | 3525 outline_region (f, f->display.x->reverse_gc, point_x, point_y, |
389 | 3526 x_contour_x, x_contour_y); |
771 | 3527 outline_region (f, f->display.x->cursor_gc, x_mouse_x, x_mouse_y, |
389 | 3528 point_x, point_y); |
3529 } | |
3530 else if (x_mouse_y < x_contour_y) /* Bottom clipped. */ | |
3531 { | |
3532 clip_contour_bottom (x_mouse_y); | |
3533 } | |
3534 else if (x_mouse_y > x_contour_y) /* Bottom extended. */ | |
3535 { | |
3536 extend_bottom_contour (x_mouse_y); | |
3537 } | |
3538 | |
3539 x_contour_x = x_mouse_x; | |
3540 x_contour_y = x_mouse_y; | |
3541 } | |
3542 else /* mouse above or same line as point */ | |
3543 { | |
3544 if (x_mouse_y >= point_y) /* Flipped. */ | |
3545 { | |
3546 mouse_below_point = 1; | |
3547 | |
771 | 3548 outline_region (f, f->display.x->reverse_gc, |
389 | 3549 x_contour_x, x_contour_y, point_x, point_y); |
771 | 3550 outline_region (f, f->display.x->cursor_gc, point_x, point_y, |
389 | 3551 x_mouse_x, x_mouse_y); |
3552 } | |
3553 else if (x_mouse_y > x_contour_y) /* Top clipped. */ | |
3554 { | |
3555 clip_contour_top (x_mouse_y); | |
3556 } | |
3557 else if (x_mouse_y < x_contour_y) /* Top extended. */ | |
3558 { | |
3559 extend_contour_top (x_mouse_y); | |
3560 } | |
3561 } | |
3562 } | |
3563 | |
3564 unread_command_char = obj; | |
3565 if (mouse_below_point) | |
3566 { | |
3567 contour_begin_x = point_x; | |
3568 contour_begin_y = point_y; | |
3569 contour_end_x = x_contour_x; | |
3570 contour_end_y = x_contour_y; | |
3571 } | |
3572 else | |
3573 { | |
3574 contour_begin_x = x_contour_x; | |
3575 contour_begin_y = x_contour_y; | |
3576 contour_end_x = point_x; | |
3577 contour_end_y = point_y; | |
3578 } | |
3579 } | |
3580 #endif | |
3581 | |
3582 DEFUN ("x-horizontal-line", Fx_horizontal_line, Sx_horizontal_line, 1, 1, "e", | |
3583 "") | |
3584 (event) | |
3585 Lisp_Object event; | |
3586 { | |
3587 register Lisp_Object obj; | |
771 | 3588 struct frame *f = selected_frame; |
389 | 3589 register struct window *w = XWINDOW (selected_window); |
771 | 3590 register GC line_gc = f->display.x->cursor_gc; |
3591 register GC erase_gc = f->display.x->reverse_gc; | |
389 | 3592 #if 0 |
3593 char dash_list[] = {6, 4, 6, 4}; | |
3594 int dashes = 4; | |
3595 XGCValues gc_values; | |
3596 #endif | |
3597 register int previous_y; | |
771 | 3598 register int line = (x_mouse_y + 1) * FONT_HEIGHT (f->display.x->font) |
3599 + f->display.x->internal_border_width; | |
3600 register int left = f->display.x->internal_border_width | |
389 | 3601 + (w->left |
771 | 3602 * FONT_WIDTH (f->display.x->font)); |
389 | 3603 register int right = left + (w->width |
771 | 3604 * FONT_WIDTH (f->display.x->font)) |
3605 - f->display.x->internal_border_width; | |
389 | 3606 |
3607 #if 0 | |
3608 BLOCK_INPUT; | |
771 | 3609 gc_values.foreground = f->display.x->cursor_pixel; |
3610 gc_values.background = f->display.x->background_pixel; | |
389 | 3611 gc_values.line_width = 1; |
3612 gc_values.line_style = LineOnOffDash; | |
3613 gc_values.cap_style = CapRound; | |
3614 gc_values.join_style = JoinRound; | |
3615 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3616 line_gc = XCreateGC (x_current_display, FRAME_X_WINDOW (f), |
389 | 3617 GCLineStyle | GCJoinStyle | GCCapStyle |
3618 | GCLineWidth | GCForeground | GCBackground, | |
3619 &gc_values); | |
3620 XSetDashes (x_current_display, line_gc, 0, dash_list, dashes); | |
771 | 3621 gc_values.foreground = f->display.x->background_pixel; |
3622 gc_values.background = f->display.x->foreground_pixel; | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3623 erase_gc = XCreateGC (x_current_display, FRAME_X_WINDOW (f), |
389 | 3624 GCLineStyle | GCJoinStyle | GCCapStyle |
3625 | GCLineWidth | GCForeground | GCBackground, | |
3626 &gc_values); | |
3627 XSetDashes (x_current_display, erase_gc, 0, dash_list, dashes); | |
3628 #endif | |
3629 | |
3630 while (1) | |
3631 { | |
3632 BLOCK_INPUT; | |
3633 if (x_mouse_y >= XINT (w->top) | |
3634 && x_mouse_y < XINT (w->top) + XINT (w->height) - 1) | |
3635 { | |
3636 previous_y = x_mouse_y; | |
771 | 3637 line = (x_mouse_y + 1) * FONT_HEIGHT (f->display.x->font) |
3638 + f->display.x->internal_border_width; | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3639 XDrawLine (x_current_display, FRAME_X_WINDOW (f), |
389 | 3640 line_gc, left, line, right, line); |
3641 } | |
3642 XFlushQueue (); | |
3643 UNBLOCK_INPUT; | |
3644 | |
3645 do | |
3646 { | |
1096
d79192bacdce
(Fx_track_pointer): Pass new args to read_char.
Richard M. Stallman <rms@gnu.org>
parents:
1050
diff
changeset
|
3647 obj = read_char (-1, 0, 0, Qnil, 0); |
389 | 3648 if ((XTYPE (obj) != Lisp_Cons) |
3649 || (! EQ (Fcar (Fcdr (Fcdr (obj))), | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3650 Qvertical_scroll_bar)) |
389 | 3651 || x_mouse_grabbed) |
3652 { | |
3653 BLOCK_INPUT; | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3654 XDrawLine (x_current_display, FRAME_X_WINDOW (f), |
389 | 3655 erase_gc, left, line, right, line); |
3656 UNBLOCK_INPUT; | |
3657 unread_command_char = obj; | |
3658 #if 0 | |
3659 XFreeGC (x_current_display, line_gc); | |
3660 XFreeGC (x_current_display, erase_gc); | |
3661 #endif | |
3662 return Qnil; | |
3663 } | |
3664 } | |
3665 while (x_mouse_y == previous_y); | |
3666 | |
3667 BLOCK_INPUT; | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3668 XDrawLine (x_current_display, FRAME_X_WINDOW (f), |
389 | 3669 erase_gc, left, line, right, line); |
3670 UNBLOCK_INPUT; | |
3671 } | |
3672 } | |
687
e2b747dd6a6e
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
642
diff
changeset
|
3673 #endif |
389 | 3674 |
3675 /* Offset in buffer of character under the pointer, or 0. */ | |
3676 int mouse_buffer_offset; | |
3677 | |
3678 #if 0 | |
3679 /* These keep track of the rectangle following the pointer. */ | |
3680 int mouse_track_top, mouse_track_left, mouse_track_width; | |
3681 | |
3682 DEFUN ("x-track-pointer", Fx_track_pointer, Sx_track_pointer, 0, 0, 0, | |
3683 "Track the pointer.") | |
3684 () | |
3685 { | |
3686 static Cursor current_pointer_shape; | |
771 | 3687 FRAME_PTR f = x_mouse_frame; |
389 | 3688 |
3689 BLOCK_INPUT; | |
771 | 3690 if (EQ (Vmouse_frame_part, Qtext_part) |
3691 && (current_pointer_shape != f->display.x->nontext_cursor)) | |
389 | 3692 { |
3693 unsigned char c; | |
3694 struct buffer *buf; | |
3695 | |
771 | 3696 current_pointer_shape = f->display.x->nontext_cursor; |
389 | 3697 XDefineCursor (x_current_display, |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3698 FRAME_X_WINDOW (f), |
389 | 3699 current_pointer_shape); |
3700 | |
3701 buf = XBUFFER (XWINDOW (Vmouse_window)->buffer); | |
3702 c = *(BUF_CHAR_ADDRESS (buf, mouse_buffer_offset)); | |
3703 } | |
771 | 3704 else if (EQ (Vmouse_frame_part, Qmodeline_part) |
3705 && (current_pointer_shape != f->display.x->modeline_cursor)) | |
389 | 3706 { |
771 | 3707 current_pointer_shape = f->display.x->modeline_cursor; |
389 | 3708 XDefineCursor (x_current_display, |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3709 FRAME_X_WINDOW (f), |
389 | 3710 current_pointer_shape); |
3711 } | |
3712 | |
3713 XFlushQueue (); | |
3714 UNBLOCK_INPUT; | |
3715 } | |
3716 #endif | |
3717 | |
3718 #if 0 | |
3719 DEFUN ("x-track-pointer", Fx_track_pointer, Sx_track_pointer, 1, 1, "e", | |
3720 "Draw rectangle around character under mouse pointer, if there is one.") | |
3721 (event) | |
3722 Lisp_Object event; | |
3723 { | |
3724 struct window *w = XWINDOW (Vmouse_window); | |
771 | 3725 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
389 | 3726 struct buffer *b = XBUFFER (w->buffer); |
3727 Lisp_Object obj; | |
3728 | |
3729 if (! EQ (Vmouse_window, selected_window)) | |
3730 return Qnil; | |
3731 | |
3732 if (EQ (event, Qnil)) | |
3733 { | |
3734 int x, y; | |
3735 | |
771 | 3736 x_read_mouse_position (selected_frame, &x, &y); |
389 | 3737 } |
3738 | |
3739 BLOCK_INPUT; | |
3740 mouse_track_width = 0; | |
3741 mouse_track_left = mouse_track_top = -1; | |
3742 | |
3743 do | |
3744 { | |
3745 if ((x_mouse_x != mouse_track_left | |
3746 && (x_mouse_x < mouse_track_left | |
3747 || x_mouse_x > (mouse_track_left + mouse_track_width))) | |
3748 || x_mouse_y != mouse_track_top) | |
3749 { | |
3750 int hp = 0; /* Horizontal position */ | |
771 | 3751 int len = FRAME_CURRENT_GLYPHS (f)->used[x_mouse_y]; |
3752 int p = FRAME_CURRENT_GLYPHS (f)->bufp[x_mouse_y]; | |
389 | 3753 int tab_width = XINT (b->tab_width); |
485 | 3754 int ctl_arrow_p = !NILP (b->ctl_arrow); |
389 | 3755 unsigned char c; |
3756 int mode_line_vpos = XFASTINT (w->height) + XFASTINT (w->top) - 1; | |
3757 int in_mode_line = 0; | |
3758 | |
771 | 3759 if (! FRAME_CURRENT_GLYPHS (f)->enable[x_mouse_y]) |
389 | 3760 break; |
3761 | |
3762 /* Erase previous rectangle. */ | |
3763 if (mouse_track_width) | |
3764 { | |
771 | 3765 x_rectangle (f, f->display.x->reverse_gc, |
389 | 3766 mouse_track_left, mouse_track_top, |
3767 mouse_track_width, 1); | |
3768 | |
771 | 3769 if ((mouse_track_left == f->phys_cursor_x |
3770 || mouse_track_left == f->phys_cursor_x - 1) | |
3771 && mouse_track_top == f->phys_cursor_y) | |
389 | 3772 { |
771 | 3773 x_display_cursor (f, 1); |
389 | 3774 } |
3775 } | |
3776 | |
3777 mouse_track_left = x_mouse_x; | |
3778 mouse_track_top = x_mouse_y; | |
3779 mouse_track_width = 0; | |
3780 | |
3781 if (mouse_track_left > len) /* Past the end of line. */ | |
3782 goto draw_or_not; | |
3783 | |
3784 if (mouse_track_top == mode_line_vpos) | |
3785 { | |
3786 in_mode_line = 1; | |
3787 goto draw_or_not; | |
3788 } | |
3789 | |
3790 if (tab_width <= 0 || tab_width > 20) tab_width = 8; | |
3791 do | |
3792 { | |
3793 c = FETCH_CHAR (p); | |
771 | 3794 if (len == f->width && hp == len - 1 && c != '\n') |
389 | 3795 goto draw_or_not; |
3796 | |
3797 switch (c) | |
3798 { | |
3799 case '\t': | |
3800 mouse_track_width = tab_width - (hp % tab_width); | |
3801 p++; | |
3802 hp += mouse_track_width; | |
3803 if (hp > x_mouse_x) | |
3804 { | |
3805 mouse_track_left = hp - mouse_track_width; | |
3806 goto draw_or_not; | |
3807 } | |
3808 continue; | |
3809 | |
3810 case '\n': | |
3811 mouse_track_width = -1; | |
3812 goto draw_or_not; | |
3813 | |
3814 default: | |
3815 if (ctl_arrow_p && (c < 040 || c == 0177)) | |
3816 { | |
3817 if (p > ZV) | |
3818 goto draw_or_not; | |
3819 | |
3820 mouse_track_width = 2; | |
3821 p++; | |
3822 hp +=2; | |
3823 if (hp > x_mouse_x) | |
3824 { | |
3825 mouse_track_left = hp - mouse_track_width; | |
3826 goto draw_or_not; | |
3827 } | |
3828 } | |
3829 else | |
3830 { | |
3831 mouse_track_width = 1; | |
3832 p++; | |
3833 hp++; | |
3834 } | |
3835 continue; | |
3836 } | |
3837 } | |
3838 while (hp <= x_mouse_x); | |
3839 | |
3840 draw_or_not: | |
3841 if (mouse_track_width) /* Over text; use text pointer shape. */ | |
3842 { | |
3843 XDefineCursor (x_current_display, | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3844 FRAME_X_WINDOW (f), |
771 | 3845 f->display.x->text_cursor); |
3846 x_rectangle (f, f->display.x->cursor_gc, | |
389 | 3847 mouse_track_left, mouse_track_top, |
3848 mouse_track_width, 1); | |
3849 } | |
3850 else if (in_mode_line) | |
3851 XDefineCursor (x_current_display, | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3852 FRAME_X_WINDOW (f), |
771 | 3853 f->display.x->modeline_cursor); |
389 | 3854 else |
3855 XDefineCursor (x_current_display, | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3856 FRAME_X_WINDOW (f), |
771 | 3857 f->display.x->nontext_cursor); |
389 | 3858 } |
3859 | |
3860 XFlush (x_current_display); | |
3861 UNBLOCK_INPUT; | |
3862 | |
1096
d79192bacdce
(Fx_track_pointer): Pass new args to read_char.
Richard M. Stallman <rms@gnu.org>
parents:
1050
diff
changeset
|
3863 obj = read_char (-1, 0, 0, Qnil, 0); |
389 | 3864 BLOCK_INPUT; |
3865 } | |
3866 while (XTYPE (obj) == Lisp_Cons /* Mouse event */ | |
3867 && EQ (Fcar (Fcdr (Fcdr (obj))), Qnil) /* Not scrollbar */ | |
3868 && EQ (Vmouse_depressed, Qnil) /* Only motion events */ | |
3869 && EQ (Vmouse_window, selected_window) /* In this window */ | |
771 | 3870 && x_mouse_frame); |
389 | 3871 |
3872 unread_command_char = obj; | |
3873 | |
3874 if (mouse_track_width) | |
3875 { | |
771 | 3876 x_rectangle (f, f->display.x->reverse_gc, |
389 | 3877 mouse_track_left, mouse_track_top, |
3878 mouse_track_width, 1); | |
3879 mouse_track_width = 0; | |
771 | 3880 if ((mouse_track_left == f->phys_cursor_x |
3881 || mouse_track_left - 1 == f->phys_cursor_x) | |
3882 && mouse_track_top == f->phys_cursor_y) | |
389 | 3883 { |
771 | 3884 x_display_cursor (f, 1); |
389 | 3885 } |
3886 } | |
3887 XDefineCursor (x_current_display, | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3888 FRAME_X_WINDOW (f), |
771 | 3889 f->display.x->nontext_cursor); |
389 | 3890 XFlush (x_current_display); |
3891 UNBLOCK_INPUT; | |
3892 | |
3893 return Qnil; | |
3894 } | |
3895 #endif | |
3896 | |
3897 #if 0 | |
3898 #include "glyphs.h" | |
3899 | |
3900 /* Draw a pixmap specified by IMAGE_DATA of dimensions WIDTH and HEIGHT | |
771 | 3901 on the frame F at position X, Y. */ |
3902 | |
3903 x_draw_pixmap (f, x, y, image_data, width, height) | |
3904 struct frame *f; | |
389 | 3905 int x, y, width, height; |
3906 char *image_data; | |
3907 { | |
3908 Pixmap image; | |
3909 | |
3910 image = XCreateBitmapFromData (x_current_display, | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3911 FRAME_X_WINDOW (f), image_data, |
389 | 3912 width, height); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
3913 XCopyPlane (x_current_display, image, FRAME_X_WINDOW (f), |
771 | 3914 f->display.x->normal_gc, 0, 0, width, height, x, y); |
389 | 3915 } |
3916 #endif | |
3917 | |
3918 #if 0 | |
3919 | |
3920 #ifdef HAVE_X11 | |
3921 #define XMouseEvent XEvent | |
3922 #define WhichMouseButton xbutton.button | |
3923 #define MouseWindow xbutton.window | |
3924 #define MouseX xbutton.x | |
3925 #define MouseY xbutton.y | |
3926 #define MouseTime xbutton.time | |
3927 #define ButtonReleased ButtonRelease | |
3928 #define ButtonPressed ButtonPress | |
3929 #else | |
3930 #define XMouseEvent XButtonEvent | |
3931 #define WhichMouseButton detail | |
3932 #define MouseWindow window | |
3933 #define MouseX x | |
3934 #define MouseY y | |
3935 #define MouseTime time | |
3936 #endif /* X11 */ | |
3937 | |
3938 DEFUN ("x-mouse-events", Fx_mouse_events, Sx_mouse_events, 0, 0, 0, | |
3939 "Return number of pending mouse events from X window system.") | |
3940 () | |
3941 { | |
3942 return make_number (queue_event_count (&x_mouse_queue)); | |
3943 } | |
3944 | |
3945 /* Encode the mouse button events in the form expected by the | |
3946 mouse code in Lisp. For X11, this means moving the masks around. */ | |
3947 | |
3948 static int | |
3949 encode_mouse_button (mouse_event) | |
3950 XMouseEvent mouse_event; | |
3951 { | |
3952 register int event_code; | |
3953 register char key_mask; | |
3954 | |
3955 event_code = mouse_event.detail & 3; | |
3956 key_mask = (mouse_event.detail >> 8) & 0xf0; | |
3957 event_code |= key_mask >> 1; | |
3958 if (mouse_event.type == ButtonReleased) event_code |= 0x04; | |
3959 return event_code; | |
3960 } | |
3961 | |
3962 DEFUN ("x-get-mouse-event", Fx_get_mouse_event, Sx_get_mouse_event, | |
3963 0, 1, 0, | |
3964 "Get next mouse event out of mouse event buffer.\n\ | |
3965 Optional ARG non-nil means return nil immediately if no pending event;\n\ | |
3966 otherwise, wait for an event. Returns a four-part list:\n\ | |
771 | 3967 ((X-POS Y-POS) WINDOW FRAME-PART KEYSEQ TIMESTAMP).\n\ |
3968 Normally X-POS and Y-POS are the position of the click on the frame\n\ | |
389 | 3969 (measured in characters and lines), and WINDOW is the window clicked in.\n\ |
3970 KEYSEQ is a string, the key sequence to be looked up in the mouse maps.\n\ | |
771 | 3971 If FRAME-PART is non-nil, the event was on a scrollbar;\n\ |
389 | 3972 then Y-POS is really the total length of the scrollbar, while X-POS is\n\ |
3973 the relative position of the scrollbar's value within that total length,\n\ | |
3974 and a third element OFFSET appears in that list: the height of the thumb-up\n\ | |
3975 area at the top of the scroll bar.\n\ | |
771 | 3976 FRAME-PART is one of the following symbols:\n\ |
389 | 3977 `vertical-scrollbar', `vertical-thumbup', `vertical-thumbdown',\n\ |
3978 `horizontal-scrollbar', `horizontal-thumbleft', `horizontal-thumbright'.\n\ | |
3979 TIMESTAMP is the lower 23 bits of the X-server's timestamp for\n\ | |
3980 the mouse event.") | |
3981 (arg) | |
3982 Lisp_Object arg; | |
3983 { | |
3984 XMouseEvent xrep; | |
3985 register int com_letter; | |
3986 register Lisp_Object tempx; | |
3987 register Lisp_Object tempy; | |
3988 Lisp_Object part, pos, timestamp; | |
3989 int prefix; | |
771 | 3990 struct frame *f; |
389 | 3991 |
3992 int tem; | |
3993 | |
3994 while (1) | |
3995 { | |
3996 BLOCK_INPUT; | |
3997 tem = dequeue_event (&xrep, &x_mouse_queue); | |
3998 UNBLOCK_INPUT; | |
3999 | |
4000 if (tem) | |
4001 { | |
4002 switch (xrep.type) | |
4003 { | |
4004 case ButtonPressed: | |
4005 case ButtonReleased: | |
4006 | |
4007 com_letter = encode_mouse_button (xrep); | |
4008 mouse_timestamp = xrep.MouseTime; | |
4009 | |
771 | 4010 if ((f = x_window_to_frame (xrep.MouseWindow)) != 0) |
389 | 4011 { |
771 | 4012 Lisp_Object frame; |
389 | 4013 |
771 | 4014 if (f->display.x->icon_desc == xrep.MouseWindow) |
389 | 4015 { |
771 | 4016 x_make_frame_visible (f); |
389 | 4017 continue; |
4018 } | |
4019 | |
4020 XSET (tempx, Lisp_Int, | |
771 | 4021 min (f->width-1, max (0, (xrep.MouseX - f->display.x->internal_border_width)/FONT_WIDTH (f->display.x->font)))); |
389 | 4022 XSET (tempy, Lisp_Int, |
771 | 4023 min (f->height-1, max (0, (xrep.MouseY - f->display.x->internal_border_width)/FONT_HEIGHT (f->display.x->font)))); |
389 | 4024 XSET (timestamp, Lisp_Int, (xrep.MouseTime & 0x7fffff)); |
771 | 4025 XSET (frame, Lisp_Frame, f); |
389 | 4026 |
4027 pos = Fcons (tempx, Fcons (tempy, Qnil)); | |
4028 Vmouse_window | |
771 | 4029 = Flocate_window_from_coordinates (frame, pos); |
389 | 4030 |
4031 Vmouse_event | |
4032 = Fcons (pos, | |
4033 Fcons (Vmouse_window, | |
4034 Fcons (Qnil, | |
4035 Fcons (Fchar_to_string (make_number (com_letter)), | |
4036 Fcons (timestamp, Qnil))))); | |
4037 return Vmouse_event; | |
4038 } | |
771 | 4039 else if ((f = x_window_to_scrollbar (xrep.MouseWindow, &part, &prefix)) != 0) |
389 | 4040 { |
4041 int pos, len; | |
4042 Lisp_Object keyseq; | |
4043 char *partname; | |
4044 | |
4045 keyseq = concat2 (Fchar_to_string (make_number (prefix)), | |
4046 Fchar_to_string (make_number (com_letter))); | |
4047 | |
771 | 4048 pos = xrep.MouseY - (f->display.x->v_scrollbar_width - 2); |
389 | 4049 XSET (tempx, Lisp_Int, pos); |
771 | 4050 len = ((FONT_HEIGHT (f->display.x->font) * f->height) |
4051 + f->display.x->internal_border_width | |
4052 - (2 * (f->display.x->v_scrollbar_width - 2))); | |
389 | 4053 XSET (tempy, Lisp_Int, len); |
4054 XSET (timestamp, Lisp_Int, (xrep.MouseTime & 0x7fffff)); | |
771 | 4055 Vmouse_window = f->selected_window; |
389 | 4056 Vmouse_event |
4057 = Fcons (Fcons (tempx, Fcons (tempy, | |
771 | 4058 Fcons (make_number (f->display.x->v_scrollbar_width - 2), |
389 | 4059 Qnil))), |
4060 Fcons (Vmouse_window, | |
4061 Fcons (intern (part), | |
4062 Fcons (keyseq, Fcons (timestamp, | |
4063 Qnil))))); | |
4064 return Vmouse_event; | |
4065 } | |
4066 else | |
4067 continue; | |
4068 | |
4069 #ifdef HAVE_X11 | |
4070 case MotionNotify: | |
4071 | |
4072 com_letter = x11_encode_mouse_button (xrep); | |
771 | 4073 if ((f = x_window_to_frame (xrep.MouseWindow)) != 0) |
389 | 4074 { |
771 | 4075 Lisp_Object frame; |
389 | 4076 |
4077 XSET (tempx, Lisp_Int, | |
771 | 4078 min (f->width-1, |
4079 max (0, (xrep.MouseX - f->display.x->internal_border_width) | |
4080 / FONT_WIDTH (f->display.x->font)))); | |
389 | 4081 XSET (tempy, Lisp_Int, |
771 | 4082 min (f->height-1, |
4083 max (0, (xrep.MouseY - f->display.x->internal_border_width) | |
4084 / FONT_HEIGHT (f->display.x->font)))); | |
389 | 4085 |
771 | 4086 XSET (frame, Lisp_Frame, f); |
389 | 4087 XSET (timestamp, Lisp_Int, (xrep.MouseTime & 0x7fffff)); |
4088 | |
4089 pos = Fcons (tempx, Fcons (tempy, Qnil)); | |
4090 Vmouse_window | |
771 | 4091 = Flocate_window_from_coordinates (frame, pos); |
389 | 4092 |
4093 Vmouse_event | |
4094 = Fcons (pos, | |
4095 Fcons (Vmouse_window, | |
4096 Fcons (Qnil, | |
4097 Fcons (Fchar_to_string (make_number (com_letter)), | |
4098 Fcons (timestamp, Qnil))))); | |
4099 return Vmouse_event; | |
4100 } | |
4101 | |
4102 break; | |
4103 #endif /* HAVE_X11 */ | |
4104 | |
4105 default: | |
771 | 4106 if (f = x_window_to_frame (xrep.MouseWindow)) |
4107 Vmouse_window = f->selected_window; | |
4108 else if (f = x_window_to_scrollbar (xrep.MouseWindow, &part, &prefix)) | |
4109 Vmouse_window = f->selected_window; | |
389 | 4110 return Vmouse_event = Qnil; |
4111 } | |
4112 } | |
4113 | |
485 | 4114 if (!NILP (arg)) |
389 | 4115 return Qnil; |
4116 | |
4117 /* Wait till we get another mouse event. */ | |
4118 wait_reading_process_input (0, 0, 2, 0); | |
4119 } | |
4120 } | |
4121 #endif | |
4122 | |
4123 | |
4124 #ifndef HAVE_X11 | |
4125 DEFUN ("x-store-cut-buffer", Fx_store_cut_buffer, Sx_store_cut_buffer, | |
4126 1, 1, "sStore text in cut buffer: ", | |
4127 "Store contents of STRING into the cut buffer of the X window system.") | |
4128 (string) | |
4129 register Lisp_Object string; | |
4130 { | |
4131 int mask; | |
4132 | |
4133 CHECK_STRING (string, 1); | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4134 if (! FRAME_X_P (selected_frame)) |
771 | 4135 error ("Selected frame does not understand X protocol."); |
389 | 4136 |
4137 BLOCK_INPUT; | |
4138 XStoreBytes ((char *) XSTRING (string)->data, XSTRING (string)->size); | |
4139 UNBLOCK_INPUT; | |
4140 | |
4141 return Qnil; | |
4142 } | |
4143 | |
4144 DEFUN ("x-get-cut-buffer", Fx_get_cut_buffer, Sx_get_cut_buffer, 0, 0, 0, | |
4145 "Return contents of cut buffer of the X window system, as a string.") | |
4146 () | |
4147 { | |
4148 int len; | |
4149 register Lisp_Object string; | |
4150 int mask; | |
4151 register char *d; | |
4152 | |
4153 BLOCK_INPUT; | |
4154 d = XFetchBytes (&len); | |
4155 string = make_string (d, len); | |
4156 XFree (d); | |
4157 UNBLOCK_INPUT; | |
4158 return string; | |
4159 } | |
4160 #endif /* X10 */ | |
4161 | |
4162 #ifdef HAVE_X11 | |
4163 DEFUN ("x-rebind-key", Fx_rebind_key, Sx_rebind_key, 3, 3, 0, | |
4164 "Rebind X keysym KEYSYM, with MODIFIERS, to generate NEWSTRING.\n\ | |
4165 KEYSYM is a string which conforms to the X keysym definitions found\n\ | |
4166 in X11/keysymdef.h, sans the initial XK_. MODIFIERS is nil or a\n\ | |
4167 list of strings specifying modifier keys such as Control_L, which must\n\ | |
4168 also be depressed for NEWSTRING to appear.") | |
4169 (x_keysym, modifiers, newstring) | |
4170 register Lisp_Object x_keysym; | |
4171 register Lisp_Object modifiers; | |
4172 register Lisp_Object newstring; | |
4173 { | |
4174 char *rawstring; | |
642 | 4175 register KeySym keysym; |
4176 KeySym modifier_list[16]; | |
389 | 4177 |
4178 CHECK_STRING (x_keysym, 1); | |
4179 CHECK_STRING (newstring, 3); | |
4180 | |
4181 keysym = XStringToKeysym ((char *) XSTRING (x_keysym)->data); | |
4182 if (keysym == NoSymbol) | |
4183 error ("Keysym does not exist"); | |
4184 | |
485 | 4185 if (NILP (modifiers)) |
389 | 4186 XRebindKeysym (x_current_display, keysym, modifier_list, 0, |
4187 XSTRING (newstring)->data, XSTRING (newstring)->size); | |
4188 else | |
4189 { | |
4190 register Lisp_Object rest, mod; | |
4191 register int i = 0; | |
4192 | |
485 | 4193 for (rest = modifiers; !NILP (rest); rest = Fcdr (rest)) |
389 | 4194 { |
4195 if (i == 16) | |
4196 error ("Can't have more than 16 modifiers"); | |
4197 | |
4198 mod = Fcar (rest); | |
4199 CHECK_STRING (mod, 3); | |
4200 modifier_list[i] = XStringToKeysym ((char *) XSTRING (mod)->data); | |
4201 if (modifier_list[i] == NoSymbol | |
4202 || !IsModifierKey (modifier_list[i])) | |
4203 error ("Element is not a modifier keysym"); | |
4204 i++; | |
4205 } | |
4206 | |
4207 XRebindKeysym (x_current_display, keysym, modifier_list, i, | |
4208 XSTRING (newstring)->data, XSTRING (newstring)->size); | |
4209 } | |
4210 | |
4211 return Qnil; | |
4212 } | |
4213 | |
4214 DEFUN ("x-rebind-keys", Fx_rebind_keys, Sx_rebind_keys, 2, 2, 0, | |
4215 "Rebind KEYCODE to list of strings STRINGS.\n\ | |
4216 STRINGS should be a list of 16 elements, one for each shift combination.\n\ | |
4217 nil as element means don't change.\n\ | |
4218 See the documentation of `x-rebind-key' for more information.") | |
4219 (keycode, strings) | |
4220 register Lisp_Object keycode; | |
4221 register Lisp_Object strings; | |
4222 { | |
4223 register Lisp_Object item; | |
4224 register unsigned char *rawstring; | |
4225 KeySym rawkey, modifier[1]; | |
4226 int strsize; | |
4227 register unsigned i; | |
4228 | |
4229 CHECK_NUMBER (keycode, 1); | |
4230 CHECK_CONS (strings, 2); | |
4231 rawkey = (KeySym) ((unsigned) (XINT (keycode))) & 255; | |
4232 for (i = 0; i <= 15; strings = Fcdr (strings), i++) | |
4233 { | |
4234 item = Fcar (strings); | |
485 | 4235 if (!NILP (item)) |
389 | 4236 { |
4237 CHECK_STRING (item, 2); | |
4238 strsize = XSTRING (item)->size; | |
4239 rawstring = (unsigned char *) xmalloc (strsize); | |
4240 bcopy (XSTRING (item)->data, rawstring, strsize); | |
4241 modifier[1] = 1 << i; | |
4242 XRebindKeysym (x_current_display, rawkey, modifier, 1, | |
4243 rawstring, strsize); | |
4244 } | |
4245 } | |
4246 return Qnil; | |
4247 } | |
4248 #else | |
4249 DEFUN ("x-rebind-key", Fx_rebind_key, Sx_rebind_key, 3, 3, 0, | |
4250 "Rebind KEYCODE, with shift bits SHIFT-MASK, to new string NEWSTRING.\n\ | |
4251 KEYCODE and SHIFT-MASK should be numbers representing the X keyboard code\n\ | |
4252 and shift mask respectively. NEWSTRING is an arbitrary string of keystrokes.\n\ | |
4253 If SHIFT-MASK is nil, then KEYCODE's key will be bound to NEWSTRING for\n\ | |
4254 all shift combinations.\n\ | |
4255 Shift Lock 1 Shift 2\n\ | |
4256 Meta 4 Control 8\n\ | |
4257 \n\ | |
4258 For values of KEYCODE, see /usr/lib/Xkeymap.txt (remember that the codes\n\ | |
4259 in that file are in octal!)\n\ | |
4260 \n\ | |
4261 NOTE: due to an X bug, this function will not take effect unless one has\n\ | |
4262 a `~/.Xkeymap' file. (See the documentation for the `keycomp' program.)\n\ | |
4263 This problem will be fixed in X version 11.") | |
4264 | |
4265 (keycode, shift_mask, newstring) | |
4266 register Lisp_Object keycode; | |
4267 register Lisp_Object shift_mask; | |
4268 register Lisp_Object newstring; | |
4269 { | |
4270 char *rawstring; | |
4271 int keysym, rawshift; | |
4272 int i, strsize; | |
4273 | |
4274 CHECK_NUMBER (keycode, 1); | |
485 | 4275 if (!NILP (shift_mask)) |
389 | 4276 CHECK_NUMBER (shift_mask, 2); |
4277 CHECK_STRING (newstring, 3); | |
4278 strsize = XSTRING (newstring)->size; | |
4279 rawstring = (char *) xmalloc (strsize); | |
4280 bcopy (XSTRING (newstring)->data, rawstring, strsize); | |
4281 | |
4282 keysym = ((unsigned) (XINT (keycode))) & 255; | |
4283 | |
485 | 4284 if (NILP (shift_mask)) |
389 | 4285 { |
4286 for (i = 0; i <= 15; i++) | |
4287 XRebindCode (keysym, i<<11, rawstring, strsize); | |
4288 } | |
4289 else | |
4290 { | |
4291 rawshift = (((unsigned) (XINT (shift_mask))) & 15) << 11; | |
4292 XRebindCode (keysym, rawshift, rawstring, strsize); | |
4293 } | |
4294 return Qnil; | |
4295 } | |
4296 | |
4297 DEFUN ("x-rebind-keys", Fx_rebind_keys, Sx_rebind_keys, 2, 2, 0, | |
4298 "Rebind KEYCODE to list of strings STRINGS.\n\ | |
4299 STRINGS should be a list of 16 elements, one for each shift combination.\n\ | |
4300 nil as element means don't change.\n\ | |
4301 See the documentation of `x-rebind-key' for more information.") | |
4302 (keycode, strings) | |
4303 register Lisp_Object keycode; | |
4304 register Lisp_Object strings; | |
4305 { | |
4306 register Lisp_Object item; | |
4307 register char *rawstring; | |
4308 KeySym rawkey, modifier[1]; | |
4309 int strsize; | |
4310 register unsigned i; | |
4311 | |
4312 CHECK_NUMBER (keycode, 1); | |
4313 CHECK_CONS (strings, 2); | |
4314 rawkey = (KeySym) ((unsigned) (XINT (keycode))) & 255; | |
4315 for (i = 0; i <= 15; strings = Fcdr (strings), i++) | |
4316 { | |
4317 item = Fcar (strings); | |
485 | 4318 if (!NILP (item)) |
389 | 4319 { |
4320 CHECK_STRING (item, 2); | |
4321 strsize = XSTRING (item)->size; | |
4322 rawstring = (char *) xmalloc (strsize); | |
4323 bcopy (XSTRING (item)->data, rawstring, strsize); | |
4324 XRebindCode (rawkey, i << 11, rawstring, strsize); | |
4325 } | |
4326 } | |
4327 return Qnil; | |
4328 } | |
4329 #endif /* not HAVE_X11 */ | |
4330 | |
4331 #ifdef HAVE_X11 | |
4332 Visual * | |
4333 select_visual (screen, depth) | |
4334 Screen *screen; | |
4335 unsigned int *depth; | |
4336 { | |
4337 Visual *v; | |
4338 XVisualInfo *vinfo, vinfo_template; | |
4339 int n_visuals; | |
4340 | |
4341 v = DefaultVisualOfScreen (screen); | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4342 |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4343 #ifdef HAVE_X11R4 |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4344 vinfo_template.visualid = XVisualIDFromVisual (v); |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4345 #else |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4346 vinfo_template.visualid = x->visualid; |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4347 #endif |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4348 |
389 | 4349 vinfo = XGetVisualInfo (x_current_display, VisualIDMask, &vinfo_template, |
4350 &n_visuals); | |
4351 if (n_visuals != 1) | |
4352 fatal ("Can't get proper X visual info"); | |
4353 | |
4354 if ((1 << vinfo->depth) == vinfo->colormap_size) | |
4355 *depth = vinfo->depth; | |
4356 else | |
4357 { | |
4358 int i = 0; | |
4359 int n = vinfo->colormap_size - 1; | |
4360 while (n) | |
4361 { | |
4362 n = n >> 1; | |
4363 i++; | |
4364 } | |
4365 *depth = i; | |
4366 } | |
4367 | |
4368 XFree ((char *) vinfo); | |
4369 return v; | |
4370 } | |
4371 #endif /* HAVE_X11 */ | |
4372 | |
4373 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, | |
4374 1, 2, 0, "Open a connection to an X server.\n\ | |
4375 DISPLAY is the name of the display to connect to. Optional second\n\ | |
4376 arg XRM_STRING is a string of resources in xrdb format.") | |
4377 (display, xrm_string) | |
4378 Lisp_Object display, xrm_string; | |
4379 { | |
4380 unsigned int n_planes; | |
4381 register Screen *x_screen; | |
4382 unsigned char *xrm_option; | |
4383 | |
4384 CHECK_STRING (display, 0); | |
4385 if (x_current_display != 0) | |
4386 error ("X server connection is already initialized"); | |
4387 | |
4388 /* This is what opens the connection and sets x_current_display. | |
4389 This also initializes many symbols, such as those used for input. */ | |
4390 x_term_init (XSTRING (display)->data); | |
4391 | |
4392 #ifdef HAVE_X11 | |
4393 XFASTINT (Vwindow_system_version) = 11; | |
4394 | |
4395 if (!EQ (xrm_string, Qnil)) | |
4396 { | |
4397 CHECK_STRING (xrm_string, 1); | |
4398 xrm_option = (unsigned char *) XSTRING (xrm_string); | |
4399 } | |
4400 else | |
4401 xrm_option = (unsigned char *) 0; | |
4402 xrdb = x_load_resources (x_current_display, xrm_option, EMACS_CLASS); | |
4403 x_current_display->db = xrdb; | |
4404 | |
4405 x_screen = DefaultScreenOfDisplay (x_current_display); | |
4406 | |
4407 x_screen_count = make_number (ScreenCount (x_current_display)); | |
4408 Vx_vendor = build_string (ServerVendor (x_current_display)); | |
4409 x_release = make_number (VendorRelease (x_current_display)); | |
4410 | |
4411 x_screen_height = make_number (HeightOfScreen (x_screen)); | |
4412 x_screen_height_mm = make_number (HeightMMOfScreen (x_screen)); | |
4413 x_screen_width = make_number (WidthOfScreen (x_screen)); | |
4414 x_screen_width_mm = make_number (WidthMMOfScreen (x_screen)); | |
4415 | |
4416 switch (DoesBackingStore (x_screen)) | |
4417 { | |
4418 case Always: | |
4419 Vx_backing_store = intern ("Always"); | |
4420 break; | |
4421 | |
4422 case WhenMapped: | |
4423 Vx_backing_store = intern ("WhenMapped"); | |
4424 break; | |
4425 | |
4426 case NotUseful: | |
4427 Vx_backing_store = intern ("NotUseful"); | |
4428 break; | |
4429 | |
4430 default: | |
4431 error ("Strange value for BackingStore."); | |
4432 break; | |
4433 } | |
4434 | |
4435 if (DoesSaveUnders (x_screen) == True) | |
4436 x_save_under = Qt; | |
4437 else | |
4438 x_save_under = Qnil; | |
4439 | |
4440 screen_visual = select_visual (x_screen, &n_planes); | |
4441 x_screen_planes = make_number (n_planes); | |
4442 Vx_screen_visual = intern (x_visual_strings [screen_visual->class]); | |
4443 | |
4444 /* X Atoms used by emacs. */ | |
4445 BLOCK_INPUT; | |
4446 Xatom_emacs_selection = XInternAtom (x_current_display, "_EMACS_SELECTION_", | |
4447 False); | |
4448 Xatom_clipboard = XInternAtom (x_current_display, "CLIPBOARD", | |
4449 False); | |
4450 Xatom_clipboard_selection = XInternAtom (x_current_display, "_EMACS_CLIPBOARD_", | |
4451 False); | |
4452 Xatom_wm_change_state = XInternAtom (x_current_display, "WM_CHANGE_STATE", | |
4453 False); | |
4454 Xatom_incremental = XInternAtom (x_current_display, "INCR", | |
4455 False); | |
4456 Xatom_multiple = XInternAtom (x_current_display, "MULTIPLE", | |
4457 False); | |
4458 Xatom_targets = XInternAtom (x_current_display, "TARGETS", | |
4459 False); | |
4460 Xatom_timestamp = XInternAtom (x_current_display, "TIMESTAMP", | |
4461 False); | |
4462 Xatom_delete = XInternAtom (x_current_display, "DELETE", | |
4463 False); | |
4464 Xatom_insert_selection = XInternAtom (x_current_display, "INSERT_SELECTION", | |
4465 False); | |
4466 Xatom_pair = XInternAtom (x_current_display, "XA_ATOM_PAIR", | |
4467 False); | |
4468 Xatom_insert_property = XInternAtom (x_current_display, "INSERT_PROPERTY", | |
4469 False); | |
4470 Xatom_text = XInternAtom (x_current_display, "TEXT", | |
4471 False); | |
641 | 4472 Xatom_wm_protocols = XInternAtom (x_current_display, "WM_PROTOCOLS", |
4473 False); | |
4474 Xatom_wm_take_focus = XInternAtom (x_current_display, "WM_TAKE_FOCUS", | |
4475 False); | |
4476 Xatom_wm_save_yourself = XInternAtom (x_current_display, "WM_SAVE_YOURSELF", | |
4477 False); | |
4478 Xatom_wm_delete_window = XInternAtom (x_current_display, "WM_DELETE_WINDOW", | |
4479 False); | |
4480 Xatom_wm_change_state = XInternAtom (x_current_display, "WM_CHANGE_STATE", | |
4481 False); | |
4482 Xatom_wm_configure_denied = XInternAtom (x_current_display, | |
4483 "WM_CONFIGURE_DENIED", False); | |
4484 Xatom_wm_window_moved = XInternAtom (x_current_display, "WM_MOVED", | |
4485 False); | |
389 | 4486 UNBLOCK_INPUT; |
4487 #else /* not HAVE_X11 */ | |
4488 XFASTINT (Vwindow_system_version) = 10; | |
4489 #endif /* not HAVE_X11 */ | |
4490 return Qnil; | |
4491 } | |
4492 | |
4493 DEFUN ("x-close-current-connection", Fx_close_current_connection, | |
4494 Sx_close_current_connection, | |
4495 0, 0, 0, "Close the connection to the current X server.") | |
4496 () | |
4497 { | |
4498 #ifdef HAVE_X11 | |
4499 /* This is ONLY used when killing emacs; For switching displays | |
4500 we'll have to take care of setting CloseDownMode elsewhere. */ | |
4501 | |
4502 if (x_current_display) | |
4503 { | |
4504 BLOCK_INPUT; | |
4505 XSetCloseDownMode (x_current_display, DestroyAll); | |
4506 XCloseDisplay (x_current_display); | |
4507 } | |
4508 else | |
4509 fatal ("No current X display connection to close\n"); | |
4510 #endif | |
4511 return Qnil; | |
4512 } | |
4513 | |
4514 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, | |
4515 1, 1, 0, "If ON is non-nil, report X errors as soon as the erring request is made.\n\ | |
4516 If ON is nil, allow buffering of requests.\n\ | |
4517 Turning on synchronization prohibits the Xlib routines from buffering\n\ | |
4518 requests and seriously degrades performance, but makes debugging much\n\ | |
4519 easier.") | |
4520 (on) | |
4521 Lisp_Object on; | |
4522 { | |
4523 XSynchronize (x_current_display, !EQ (on, Qnil)); | |
4524 | |
4525 return Qnil; | |
4526 } | |
4527 | |
4528 | |
4529 syms_of_xfns () | |
4530 { | |
4531 /* This is zero if not using X windows. */ | |
4532 x_current_display = 0; | |
4533 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4534 /* The section below is built by the lisp expression at the top of the file, |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4535 just above where these variables are declared. */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4536 /*&&& init symbols here &&&*/ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4537 Qauto_raise = intern ("auto-raise"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4538 staticpro (&Qauto_raise); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4539 Qauto_lower = intern ("auto-lower"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4540 staticpro (&Qauto_lower); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4541 Qbackground_color = intern ("background-color"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4542 staticpro (&Qbackground_color); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4543 Qborder_color = intern ("border-color"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4544 staticpro (&Qborder_color); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4545 Qborder_width = intern ("border-width"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4546 staticpro (&Qborder_width); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4547 Qcursor_color = intern ("cursor-color"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4548 staticpro (&Qcursor_color); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4549 Qfont = intern ("font"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4550 staticpro (&Qfont); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4551 Qforeground_color = intern ("foreground-color"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4552 staticpro (&Qforeground_color); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4553 Qgeometry = intern ("geometry"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4554 staticpro (&Qgeometry); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4555 Qhorizontal_scroll_bar = intern ("horizontal-scroll-bar"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4556 staticpro (&Qhorizontal_scroll_bar); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4557 Qicon_left = intern ("icon-left"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4558 staticpro (&Qicon_left); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4559 Qicon_top = intern ("icon-top"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4560 staticpro (&Qicon_top); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4561 Qicon_type = intern ("icon-type"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4562 staticpro (&Qicon_type); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4563 Qiconic_startup = intern ("iconic-startup"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4564 staticpro (&Qiconic_startup); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4565 Qinternal_border_width = intern ("internal-border-width"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4566 staticpro (&Qinternal_border_width); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4567 Qleft = intern ("left"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4568 staticpro (&Qleft); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4569 Qmouse_color = intern ("mouse-color"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4570 staticpro (&Qmouse_color); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4571 Qparent_id = intern ("parent-id"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4572 staticpro (&Qparent_id); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4573 Qsuppress_icon = intern ("suppress-icon"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4574 staticpro (&Qsuppress_icon); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4575 Qsuppress_initial_map = intern ("suppress-initial-map"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4576 staticpro (&Qsuppress_initial_map); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4577 Qtop = intern ("top"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4578 staticpro (&Qtop); |
389 | 4579 Qundefined_color = intern ("undefined-color"); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4580 staticpro (&Qundefined_color); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4581 Qvertical_scroll_bar = intern ("vertical-scroll-bar"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4582 staticpro (&Qvertical_scroll_bar); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4583 Qwindow_id = intern ("window-id"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4584 staticpro (&Qwindow_id); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4585 Qx_frame_parameter = intern ("x-frame-parameter"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4586 staticpro (&Qx_frame_parameter); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4587 /* This is the end of symbol initialization. */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4588 |
389 | 4589 Fput (Qundefined_color, Qerror_conditions, |
4590 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); | |
4591 Fput (Qundefined_color, Qerror_message, | |
4592 build_string ("Undefined color")); | |
4593 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4594 init_x_parm_symbols (); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4595 |
389 | 4596 DEFVAR_INT ("mouse-x-position", &x_mouse_x, |
4597 "The X coordinate of the mouse position, in characters."); | |
4598 x_mouse_x = Qnil; | |
4599 | |
4600 DEFVAR_INT ("mouse-y-position", &x_mouse_y, | |
4601 "The Y coordinate of the mouse position, in characters."); | |
4602 x_mouse_y = Qnil; | |
4603 | |
4604 DEFVAR_INT ("mouse-buffer-offset", &mouse_buffer_offset, | |
4605 "The buffer offset of the character under the pointer."); | |
4606 mouse_buffer_offset = Qnil; | |
4607 | |
4608 DEFVAR_INT ("x-pointer-shape", &Vx_pointer_shape, | |
4609 "The shape of the pointer when over text."); | |
4610 Vx_pointer_shape = Qnil; | |
4611 | |
4612 DEFVAR_INT ("x-nontext-pointer-shape", &Vx_nontext_pointer_shape, | |
4613 "The shape of the pointer when not over text."); | |
4614 Vx_nontext_pointer_shape = Qnil; | |
4615 | |
4616 DEFVAR_INT ("x-mode-pointer-shape", &Vx_mode_pointer_shape, | |
687
e2b747dd6a6e
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
642
diff
changeset
|
4617 "The shape of the pointer when over the mode line."); |
389 | 4618 Vx_mode_pointer_shape = Qnil; |
4619 | |
4620 DEFVAR_LISP ("x-bar-cursor", &Vbar_cursor, | |
4621 "*If non-nil, use a vertical bar cursor. Otherwise, use the traditional box."); | |
4622 Vbar_cursor = Qnil; | |
4623 | |
4624 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, | |
4625 "A string indicating the foreground color of the cursor box."); | |
4626 Vx_cursor_fore_pixel = Qnil; | |
4627 | |
4628 DEFVAR_LISP ("mouse-grabbed", &Vmouse_depressed, | |
4629 "Non-nil if a mouse button is currently depressed."); | |
4630 Vmouse_depressed = Qnil; | |
4631 | |
4632 DEFVAR_INT ("x-screen-count", &x_screen_count, | |
4633 "The number of screens associated with the current display."); | |
4634 DEFVAR_INT ("x-release", &x_release, | |
4635 "The release number of the X server in use."); | |
4636 DEFVAR_LISP ("x-vendor", &Vx_vendor, | |
4637 "The vendor supporting the X server in use."); | |
4638 DEFVAR_INT ("x-screen-height", &x_screen_height, | |
4639 "The height of this X screen in pixels."); | |
4640 DEFVAR_INT ("x-screen-height-mm", &x_screen_height_mm, | |
4641 "The height of this X screen in millimeters."); | |
4642 DEFVAR_INT ("x-screen-width", &x_screen_width, | |
4643 "The width of this X screen in pixels."); | |
4644 DEFVAR_INT ("x-screen-width-mm", &x_screen_width_mm, | |
4645 "The width of this X screen in millimeters."); | |
4646 DEFVAR_LISP ("x-backing-store", &Vx_backing_store, | |
4647 "The backing store capability of this screen.\n\ | |
4648 Values can be the symbols Always, WhenMapped, or NotUseful."); | |
4649 DEFVAR_BOOL ("x-save-under", &x_save_under, | |
4650 "*Non-nil means this X screen supports the SaveUnder feature."); | |
4651 DEFVAR_INT ("x-screen-planes", &x_screen_planes, | |
4652 "The number of planes this monitor supports."); | |
4653 DEFVAR_LISP ("x-screen-visual", &Vx_screen_visual, | |
4654 "The default X visual for this X screen."); | |
4655 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, | |
4656 "t if no X window manager is in use."); | |
4657 | |
4658 #ifdef HAVE_X11 | |
4659 defsubr (&Sx_get_resource); | |
4660 defsubr (&Sx_pixel_width); | |
4661 defsubr (&Sx_pixel_height); | |
689
45401d45581d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
687
diff
changeset
|
4662 #if 0 |
389 | 4663 defsubr (&Sx_draw_rectangle); |
4664 defsubr (&Sx_erase_rectangle); | |
4665 defsubr (&Sx_contour_region); | |
4666 defsubr (&Sx_uncontour_region); | |
689
45401d45581d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
687
diff
changeset
|
4667 #endif |
389 | 4668 defsubr (&Sx_color_display_p); |
4669 defsubr (&Sx_defined_color); | |
4670 #if 0 | |
4671 defsubr (&Sx_track_pointer); | |
4672 defsubr (&Sx_grab_pointer); | |
4673 defsubr (&Sx_ungrab_pointer); | |
436
6e0a136fca4f
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
398
diff
changeset
|
4674 #endif |
389 | 4675 #else |
4676 defsubr (&Sx_get_default); | |
4677 defsubr (&Sx_store_cut_buffer); | |
4678 defsubr (&Sx_get_cut_buffer); | |
4679 defsubr (&Sx_set_face); | |
4680 #endif | |
4681 defsubr (&Sx_geometry); | |
771 | 4682 defsubr (&Sx_create_frame); |
4683 defsubr (&Sfocus_frame); | |
4684 defsubr (&Sunfocus_frame); | |
687
e2b747dd6a6e
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
642
diff
changeset
|
4685 #if 0 |
389 | 4686 defsubr (&Sx_horizontal_line); |
687
e2b747dd6a6e
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
642
diff
changeset
|
4687 #endif |
389 | 4688 defsubr (&Sx_rebind_key); |
4689 defsubr (&Sx_rebind_keys); | |
4690 defsubr (&Sx_open_connection); | |
4691 defsubr (&Sx_close_current_connection); | |
4692 defsubr (&Sx_synchronize); | |
4693 | |
4694 /* This was used in the old event interface which used a separate | |
4695 event queue.*/ | |
4696 #if 0 | |
4697 defsubr (&Sx_mouse_events); | |
4698 defsubr (&Sx_get_mouse_event); | |
4699 #endif | |
4700 } | |
4701 | |
4702 #endif /* HAVE_X_WINDOWS */ |