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