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