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