Mercurial > hg > xemacs-beta
annotate src/frame-x.c @ 5066:545ec923b4eb
add documentation on keywords to cl*.el
-------------------- ChangeLog entries follow: --------------------
lisp/ChangeLog addition:
2010-02-22 Ben Wing <ben@xemacs.org>
* cl-seq.el:
* cl-seq.el (reduce):
* cl-seq.el (fill):
* cl-seq.el (replace):
* cl-seq.el (remove*):
* cl-seq.el (remove-if):
* cl-seq.el (remove-if-not):
* cl-seq.el (delete*):
* cl-seq.el (delete-if):
* cl-seq.el (delete-if-not):
* cl-seq.el (remove-duplicates):
* cl-seq.el (delete-duplicates):
* cl-seq.el (substitute):
* cl-seq.el (substitute-if):
* cl-seq.el (substitute-if-not):
* cl-seq.el (nsubstitute):
* cl-seq.el (nsubstitute-if):
* cl-seq.el (nsubstitute-if-not):
* cl-seq.el (find):
* cl-seq.el (find-if):
* cl-seq.el (find-if-not):
* cl-seq.el (position):
* cl-seq.el (position-if):
* cl-seq.el (position-if-not):
* cl-seq.el (count):
* cl-seq.el (count-if):
* cl-seq.el (count-if-not):
* cl-seq.el (mismatch):
* cl-seq.el (search):
* cl-seq.el (sort*):
* cl-seq.el (stable-sort):
* cl-seq.el (merge):
* cl-seq.el (member*):
* cl-seq.el (member-if):
* cl-seq.el (member-if-not):
* cl-seq.el (assoc*):
* cl-seq.el (assoc-if):
* cl-seq.el (assoc-if-not):
* cl-seq.el (rassoc*):
* cl-seq.el (rassoc-if):
* cl-seq.el (rassoc-if-not):
* cl-seq.el (union):
* cl-seq.el (nunion):
* cl-seq.el (intersection):
* cl-seq.el (nintersection):
* cl-seq.el (set-difference):
* cl-seq.el (nset-difference):
* cl-seq.el (set-exclusive-or):
* cl-seq.el (nset-exclusive-or):
* cl-seq.el (subsetp):
* cl-seq.el (subst-if):
* cl-seq.el (subst-if-not):
* cl-seq.el (nsubst):
* cl-seq.el (nsubst-if):
* cl-seq.el (nsubst-if-not):
* cl-seq.el (sublis):
* cl-seq.el (nsublis):
* cl-seq.el (tree-equal):
* cl-seq.el (cl-tree-equal-rec):
* cl.el:
* cl.el (pushnew):
* cl.el (adjoin):
* cl.el (subst):
Document the keywords to the various sequence/list functions.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Mon, 22 Feb 2010 21:17:47 -0600 |
parents | 6f2158fa75ed |
children | 5502045ec510 2a462149bd6a 8b2f75cecb89 |
rev | line source |
---|---|
428 | 1 /* Functions for the X window system. |
2 Copyright (C) 1989, 1992-5, 1997 Free Software Foundation, Inc. | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
3 Copyright (C) 1995, 1996, 2001, 2002, 2004, 2010 Ben Wing. |
428 | 4 |
5 This file is part of XEmacs. | |
6 | |
7 XEmacs is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 2, or (at your option) any | |
10 later version. | |
11 | |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with XEmacs; see the file COPYING. If not, write to | |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 Boston, MA 02111-1307, USA. */ | |
21 | |
22 /* Synched up with: Not synched with FSF. */ | |
23 | |
2367 | 24 /* This file has been Mule-ized, Ben Wing, 10-14-04. */ |
25 | |
428 | 26 /* Substantially rewritten for XEmacs. */ |
27 | |
28 #include <config.h> | |
29 #include "lisp.h" | |
30 | |
800 | 31 #include "buffer.h" |
872 | 32 #include "device-impl.h" |
800 | 33 #include "events.h" |
34 #include "extents.h" | |
35 #include "faces.h" | |
872 | 36 #include "frame-impl.h" |
800 | 37 #include "gutter.h" |
872 | 38 #include "window.h" |
39 | |
40 #include "console-x-impl.h" | |
800 | 41 #include "glyphs-x.h" |
872 | 42 #include "objects-x-impl.h" |
800 | 43 #include "scrollbar-x.h" |
44 | |
428 | 45 #include "xintrinsicp.h" /* CoreP.h needs this */ |
46 #include <X11/CoreP.h> /* Numerous places access the fields of | |
47 a core widget directly. We could | |
48 use XtGetValues(), but ... */ | |
49 #include <X11/Shell.h> | |
50 #include <X11/ShellP.h> | |
4769
5460287a3327
Remove support for pre-X11R5 systems, including systems without Xmu. See
Jerry James <james@xemacs.org>
parents:
4706
diff
changeset
|
51 #include <X11/Xmu/Editres.h> |
428 | 52 #include "EmacsManager.h" |
53 #include "EmacsFrameP.h" | |
54 #include "EmacsShell.h" | |
55 #ifdef EXTERNAL_WIDGET | |
56 #include "ExternalShell.h" | |
57 #endif | |
58 | |
59 #ifdef HAVE_DRAGNDROP | |
60 #include "dragdrop.h" | |
61 #endif | |
62 | |
63 /* Default properties to use when creating frames. */ | |
64 Lisp_Object Vdefault_x_frame_plist; | |
65 | |
2747 | 66 Lisp_Object Qoverride_redirect; |
428 | 67 Lisp_Object Qx_resource_name; |
68 | |
1204 | 69 static const struct memory_description x_frame_data_description_1 [] = { |
1346 | 70 { XD_LISP_OBJECT, offsetof (struct x_frame, last_menubar_buffer) }, |
1204 | 71 { XD_LISP_OBJECT, offsetof (struct x_frame, icon_pixmap) }, |
72 { XD_LISP_OBJECT, offsetof (struct x_frame, icon_pixmap_mask) }, | |
73 { XD_END } | |
74 }; | |
75 | |
3092 | 76 #ifdef NEW_GC |
77 DEFINE_LRECORD_IMPLEMENTATION ("x-frame", x_frame, | |
78 1, /*dumpable-flag*/ | |
79 0, 0, 0, 0, 0, | |
80 x_frame_data_description_1, | |
81 Lisp_X_Frame); | |
82 #else /* not NEW_GC */ | |
1204 | 83 extern const struct sized_memory_description x_frame_data_description; |
84 | |
85 const struct sized_memory_description x_frame_data_description = { | |
86 sizeof (struct x_frame), x_frame_data_description_1 | |
87 }; | |
3092 | 88 #endif /* not NEW_GC */ |
1204 | 89 |
428 | 90 EXFUN (Fx_window_id, 1); |
91 | |
92 | |
93 /************************************************************************/ | |
94 /* helper functions */ | |
95 /************************************************************************/ | |
96 | |
97 /* Return the Emacs frame-object corresponding to an X window */ | |
98 struct frame * | |
99 x_window_to_frame (struct device *d, Window wdesc) | |
100 { | |
101 Lisp_Object tail, frame; | |
102 struct frame *f; | |
103 | |
104 /* This function was previously written to accept only a window argument | |
105 (and to loop over all devices looking for a matching window), but | |
106 that is incorrect because window ID's are not unique across displays. */ | |
107 | |
108 for (tail = DEVICE_FRAME_LIST (d); CONSP (tail); tail = XCDR (tail)) | |
109 { | |
110 frame = XCAR (tail); | |
111 if (!FRAMEP (frame)) | |
112 continue; | |
113 f = XFRAME (frame); | |
114 if (FRAME_X_P (f) && XtWindow (FRAME_X_TEXT_WIDGET (f)) == wdesc) | |
115 return f; | |
116 } | |
117 return 0; | |
118 } | |
119 | |
120 /* Like x_window_to_frame but also compares the window with the widget's | |
121 windows */ | |
122 struct frame * | |
123 x_any_window_to_frame (struct device *d, Window wdesc) | |
124 { | |
125 Widget w; | |
126 assert (DEVICE_X_P (d)); | |
127 | |
128 w = XtWindowToWidget (DEVICE_X_DISPLAY (d), wdesc); | |
129 | |
130 if (!w) | |
131 return 0; | |
132 | |
133 /* We used to map over all frames here and then map over all widgets | |
134 belonging to that frame. However it turns out that this was very fragile | |
442 | 135 as it requires our display structures to be in sync _and_ that the |
428 | 136 loop is told about every new widget somebody adds. Therefore we |
137 now let Xt find it for us (which does a bottom-up search which | |
138 could even be faster) */ | |
139 return x_any_widget_or_parent_to_frame (d, w); | |
140 } | |
141 | |
142 static struct frame * | |
143 x_find_frame_for_window (struct device *d, Window wdesc) | |
144 { | |
145 Lisp_Object tail, frame; | |
146 struct frame *f; | |
147 /* This function was previously written to accept only a window argument | |
148 (and to loop over all devices looking for a matching window), but | |
149 that is incorrect because window ID's are not unique across displays. */ | |
150 | |
151 for (tail = DEVICE_FRAME_LIST (d); CONSP (tail); tail = XCDR (tail)) | |
152 { | |
153 frame = XCAR (tail); | |
154 f = XFRAME (frame); | |
155 /* This frame matches if the window is any of its widgets. */ | |
156 if (wdesc == XtWindow (FRAME_X_SHELL_WIDGET (f)) || | |
157 wdesc == XtWindow (FRAME_X_CONTAINER_WIDGET (f)) || | |
158 wdesc == XtWindow (FRAME_X_TEXT_WIDGET (f))) | |
159 return f; | |
160 | |
161 /* Match if the window is one of the widgets at the top of the frame | |
162 (menubar, Energize psheets). */ | |
163 | |
164 /* Note: Jamie once said | |
165 | |
166 "Do *not* match if the window is this frame's psheet." | |
167 | |
168 But this is wrong and will screw up some functions that expect | |
169 x_any_window_to_frame() to work as advertised. I think the reason | |
170 for this statement is that, in the old (broken) event loop, where | |
171 not all events went through XtDispatchEvent(), psheet events | |
172 would incorrectly get sucked away by Emacs if this function matched | |
173 on psheet widgets. */ | |
174 | |
175 /* Note: that this called only from | |
176 x_any_widget_or_parent_to_frame it is unnecessary to iterate | |
177 over the top level widgets. */ | |
178 | |
179 /* Note: we use to special case scrollbars but this turns out to be a bad idea | |
180 because | |
181 1. We sometimes get events for _unmapped_ scrollbars and our | |
182 callers don't want us to fail. | |
183 2. Starting with the 21.2 widget stuff there are now loads of | |
184 widgets to check and it is easy to forget adding them in a loop here. | |
185 See x_any_window_to_frame | |
186 3. We pick up all widgets now anyway. */ | |
187 } | |
188 | |
189 return 0; | |
190 } | |
191 | |
192 struct frame * | |
193 x_any_widget_or_parent_to_frame (struct device *d, Widget widget) | |
194 { | |
195 while (widget) | |
196 { | |
197 struct frame *f = x_find_frame_for_window (d, XtWindow (widget)); | |
198 if (f) | |
199 return f; | |
200 widget = XtParent (widget); | |
201 } | |
202 | |
203 return 0; | |
204 } | |
205 | |
206 struct frame * | |
207 decode_x_frame (Lisp_Object frame) | |
208 { | |
209 if (NILP (frame)) | |
793 | 210 frame = wrap_frame (selected_frame ()); |
428 | 211 CHECK_LIVE_FRAME (frame); |
212 /* this will also catch dead frames, but putting in the above check | |
213 results in a more useful error */ | |
214 CHECK_X_FRAME (frame); | |
215 return XFRAME (frame); | |
216 } | |
217 | |
218 | |
219 /************************************************************************/ | |
220 /* window-manager interactions */ | |
221 /************************************************************************/ | |
222 | |
223 #if 0 | |
224 /* Not currently used. */ | |
225 | |
226 void | |
227 x_wm_mark_shell_size_user_specified (Widget wmshell) | |
228 { | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
229 assert (XtIsWMShell (wmshell)); |
428 | 230 EmacsShellSetSizeUserSpecified (wmshell); |
231 } | |
232 | |
233 void | |
234 x_wm_mark_shell_position_user_specified (Widget wmshell) | |
235 { | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
236 assert (XtIsWMShell (wmshell)); |
428 | 237 EmacsShellSetPositionUserSpecified (wmshell); |
238 } | |
239 | |
240 #endif | |
241 | |
242 void | |
243 x_wm_set_shell_iconic_p (Widget shell, int iconic_p) | |
244 { | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
245 assert (XtIsWMShell (shell)); |
428 | 246 |
247 /* Because of questionable logic in Shell.c, this sequence can't work: | |
248 | |
249 w = XtCreatePopupShell (...); | |
250 Xt_SET_VALUE (w, XtNiconic, True); | |
251 XtRealizeWidget (w); | |
252 | |
253 The iconic resource is only consulted at initialization time (when | |
254 XtCreatePopupShell is called) instead of at realization time (just | |
255 before the window gets created, which would be more sensible) or | |
256 at management-time (just before the window gets mapped, which would | |
257 be most sensible of all). | |
258 | |
259 The bug is that Shell's SetValues method doesn't do anything to | |
260 w->wm.wm_hints.initial_state until after the widget has been realized. | |
261 Calls to XtSetValues are ignored in the window between creation and | |
262 realization. This is true of MIT X11R5 patch level 25, at least. | |
263 (Apparently some other versions of Xt don't have this bug?) | |
264 */ | |
265 Xt_SET_VALUE (shell, XtNiconic, iconic_p); | |
266 EmacsShellSmashIconicHint (shell, iconic_p); | |
267 } | |
268 | |
269 void | |
270 x_wm_set_cell_size (Widget wmshell, int cw, int ch) | |
271 { | |
272 Arg al [2]; | |
273 | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
274 assert (XtIsWMShell (wmshell)); |
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
275 assert (cw > 0 && ch > 0); |
428 | 276 |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
277 Xt_SET_ARG (al[0], XtNwidthInc, cw); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
278 Xt_SET_ARG (al[1], XtNheightInc, ch); |
428 | 279 XtSetValues (wmshell, al, 2); |
280 } | |
281 | |
282 void | |
283 x_wm_set_variable_size (Widget wmshell, int width, int height) | |
284 { | |
285 Arg al [2]; | |
286 | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
287 assert (XtIsWMShell (wmshell)); |
428 | 288 #ifdef DEBUG_GEOMETRY_MANAGEMENT |
289 /* See comment in EmacsShell.c */ | |
290 printf ("x_wm_set_variable_size: %d %d\n", width, height); | |
291 fflush (stdout); | |
292 #endif | |
293 | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
294 Xt_SET_ARG (al[0], XtNwidthCells, width); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
295 Xt_SET_ARG (al[1], XtNheightCells, height); |
428 | 296 XtSetValues (wmshell, al, 2); |
297 } | |
298 | |
299 /* If the WM_PROTOCOLS property does not already contain WM_TAKE_FOCUS | |
300 and WM_DELETE_WINDOW, then add them. (They may already be present | |
301 because of the toolkit (Motif adds them, for example, but Xt doesn't). | |
302 */ | |
303 static void | |
304 x_wm_hack_wm_protocols (Widget widget) | |
305 { | |
306 Display *dpy = XtDisplay (widget); | |
307 struct device *d = get_device_from_display (dpy); | |
308 Window w = XtWindow (widget); | |
309 int need_delete = 1; | |
310 int need_focus = 1; | |
311 | |
312 assert (XtIsWMShell (widget)); | |
313 | |
314 { | |
1885 | 315 Atom type; |
428 | 316 int format = 0; |
317 unsigned long nitems = 0; | |
318 unsigned long bytes_after; | |
2367 | 319 Rawbyte *prop_return = 0; /* semantically a void* */ |
428 | 320 |
321 if (Success == XGetWindowProperty (dpy, w, DEVICE_XATOM_WM_PROTOCOLS (d), | |
322 0, 100, False, XA_ATOM, | |
323 &type, &format, &nitems, &bytes_after, | |
1885 | 324 &prop_return) |
428 | 325 && format == 32 && type == XA_ATOM) |
326 while (nitems > 0) | |
327 { | |
1885 | 328 Atom *atoms = (Atom *) prop_return; |
428 | 329 nitems--; |
1885 | 330 if (atoms[nitems] == DEVICE_XATOM_WM_DELETE_WINDOW (d)) |
428 | 331 need_delete = 0; |
1885 | 332 else if (atoms[nitems] == DEVICE_XATOM_WM_TAKE_FOCUS (d)) |
428 | 333 need_focus = 0; |
334 } | |
2367 | 335 if (prop_return) XFree ((CRawbyte *) prop_return); |
428 | 336 } |
337 { | |
338 Atom props [10]; | |
339 int count = 0; | |
340 if (need_delete) props[count++] = DEVICE_XATOM_WM_DELETE_WINDOW (d); | |
341 if (need_focus) props[count++] = DEVICE_XATOM_WM_TAKE_FOCUS (d); | |
342 if (count) | |
343 XChangeProperty (dpy, w, DEVICE_XATOM_WM_PROTOCOLS (d), XA_ATOM, 32, | |
2367 | 344 PropModeAppend, (Rawbyte *) props, count); |
428 | 345 } |
346 } | |
347 | |
348 static void | |
2367 | 349 x_wm_store_class_hints (Widget shell, Extbyte *frame_name) |
428 | 350 { |
351 Display *dpy = XtDisplay (shell); | |
2367 | 352 Extbyte *app_name, *app_class; |
428 | 353 XClassHint classhint; |
354 | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
355 assert (XtIsWMShell (shell)); |
428 | 356 |
357 XtGetApplicationNameAndClass (dpy, &app_name, &app_class); | |
358 classhint.res_name = frame_name; | |
359 classhint.res_class = app_class; | |
360 XSetClassHint (dpy, XtWindow (shell), &classhint); | |
361 } | |
362 | |
363 #ifndef HAVE_WMCOMMAND | |
2367 | 364 |
428 | 365 static void |
366 x_wm_maybe_store_wm_command (struct frame *f) | |
367 { | |
368 Widget w = FRAME_X_SHELL_WIDGET (f); | |
369 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
370 | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
371 assert (XtIsWMShell (w)); |
428 | 372 |
373 if (NILP (DEVICE_X_WM_COMMAND_FRAME (d))) | |
374 { | |
375 int argc; | |
2367 | 376 Wexttext **argv; |
428 | 377 make_argc_argv (Vcommand_line_args, &argc, &argv); |
378 XSetCommand (XtDisplay (w), XtWindow (w), argv, argc); | |
379 free_argc_argv (argv); | |
793 | 380 DEVICE_X_WM_COMMAND_FRAME (d) = wrap_frame (f); |
428 | 381 } |
382 } | |
383 | |
384 /* If we're deleting the frame on which the WM_COMMAND property has been | |
385 set, then move that property to another frame so that there is exactly | |
386 one frame that has that property set. | |
387 */ | |
388 static void | |
389 x_wm_maybe_move_wm_command (struct frame *f) | |
390 { | |
391 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
392 | |
393 /* There may not be a frame in DEVICE_X_WM_COMMAND_FRAME() | |
394 if we C-c'ed at startup at the right time. */ | |
395 if (FRAMEP (DEVICE_X_WM_COMMAND_FRAME (d)) | |
396 && f == XFRAME (DEVICE_X_WM_COMMAND_FRAME (d))) | |
397 { | |
398 Lisp_Object rest = DEVICE_FRAME_LIST (d); | |
399 DEVICE_X_WM_COMMAND_FRAME (d) = Qnil; | |
400 /* find some random other X frame that is not this one, or give up */ | |
401 /* skip non-top-level (ExternalClient) frames */ | |
402 while (!NILP (rest) && | |
403 (f == XFRAME (XCAR (rest)) || | |
404 !FRAME_X_TOP_LEVEL_FRAME_P (XFRAME (XCAR (rest))))) | |
405 rest = XCDR (rest); | |
406 if (NILP (rest)) | |
407 return; | |
408 f = XFRAME (XCAR (rest)); | |
409 | |
410 x_wm_maybe_store_wm_command (f); | |
411 | |
412 } | |
413 } | |
2367 | 414 |
428 | 415 #endif /* !HAVE_WMCOMMAND */ |
416 | |
593 | 417 int |
418 x_frame_window_state (struct frame *f) | |
428 | 419 { |
420 Atom actual_type; | |
421 int actual_format; | |
422 unsigned long nitems, bytesafter; | |
2367 | 423 Rawbyte *datap = 0; |
428 | 424 Widget widget; |
593 | 425 int result = -1; |
428 | 426 struct device *d = XDEVICE (FRAME_DEVICE (f)); |
427 | |
428 widget = FRAME_X_SHELL_WIDGET (f); | |
429 if (Success == XGetWindowProperty (XtDisplay (widget), XtWindow (widget), | |
430 DEVICE_XATOM_WM_STATE (d), 0, 2, False, | |
431 DEVICE_XATOM_WM_STATE (d), &actual_type, | |
432 &actual_format, &nitems, &bytesafter, | |
1885 | 433 &datap) |
428 | 434 && datap) |
435 { | |
1885 | 436 unsigned long *ul_result_ptr = (unsigned long *) datap; |
593 | 437 if (nitems <= 2) /* "suggested" by ICCCM version 1 */ |
1885 | 438 result = (int) ul_result_ptr[0]; |
2367 | 439 XFree ((CRawbyte *) datap); |
428 | 440 } |
593 | 441 |
428 | 442 return result; |
443 } | |
444 | |
593 | 445 static int |
446 x_frame_iconified_p (struct frame *f) | |
447 { | |
448 return x_frame_window_state (f) == IconicState; | |
449 } | |
450 | |
428 | 451 |
452 /************************************************************************/ | |
453 /* frame properties */ | |
454 /************************************************************************/ | |
455 | |
456 /* Connect the frame-property names (symbols) to the corresponding | |
457 X Resource Manager names. The name of a property, as a Lisp symbol, | |
793 | 458 has an `x-resource-name' property which is a Lisp string. */ |
428 | 459 |
460 static void | |
461 init_x_prop_symbols (void) | |
462 { | |
463 #define def(sym, rsrc) \ | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4790
diff
changeset
|
464 Fput (sym, Qx_resource_name, build_ascstring (rsrc)) |
428 | 465 #define defi(sym,rsrc) \ |
466 def (sym, rsrc); Fput (sym, Qintegerp, Qt) | |
467 | |
468 #if 0 /* this interferes with things. #### fix this right */ | |
469 def (Qminibuffer, XtNminibuffer); | |
470 def (Qunsplittable, XtNunsplittable); | |
471 #endif | |
472 defi(Qinternal_border_width, XtNinternalBorderWidth); | |
473 def (Qscrollbar_placement, XtNscrollBarPlacement); | |
474 defi(Qinter_line_space, XtNinterline); | |
475 /* font, foreground */ | |
476 def (Qiconic, XtNiconic); | |
477 def (Qbar_cursor, XtNbarCursor); | |
478 def (Qvisual_bell, XtNvisualBell); | |
479 defi(Qbell_volume, XtNbellVolume); | |
480 def (Qpointer_background, XtNpointerBackground); | |
481 def (Qpointer_color, XtNpointerColor); | |
482 def (Qtext_pointer, XtNtextPointer); | |
483 def (Qspace_pointer, XtNspacePointer); | |
484 def (Qmodeline_pointer, XtNmodeLinePointer); | |
485 def (Qgc_pointer, XtNgcPointer); | |
486 /* geometry, initial_geometry */ | |
487 def (Qinitially_unmapped, XtNinitiallyUnmapped); | |
488 /* preferred_width, preferred_height */ | |
489 def (Quse_backing_store, XtNuseBackingStore); | |
490 | |
491 /* inherited: */ | |
492 | |
493 def (Qborder_color, XtNborderColor); | |
494 defi(Qborder_width, XtNborderWidth); | |
495 defi(Qwidth, XtNwidth); | |
496 defi(Qheight, XtNheight); | |
497 defi(Qleft, XtNx); | |
498 defi(Qtop, XtNy); | |
499 | |
500 #undef def | |
3381 | 501 #undef defi |
428 | 502 } |
503 | |
504 static Lisp_Object | |
505 color_to_string (Widget w, unsigned long pixel) | |
506 { | |
867 | 507 Ibyte buf[255]; |
428 | 508 |
509 XColor color; | |
510 color.pixel = pixel; | |
511 XQueryColor (XtDisplay (w), w->core.colormap, &color); | |
771 | 512 qxesprintf (buf, "#%04x%04x%04x", color.red, color.green, color.blue); |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
513 return build_istring (buf); |
428 | 514 } |
515 | |
516 static void | |
517 x_get_top_level_position (Display *d, Window w, Position *x, Position *y) | |
518 { | |
519 Window root, parent = w, *children; | |
520 unsigned int nchildren; | |
521 XWindowAttributes xwa; | |
522 | |
523 do | |
524 { | |
525 w = parent; | |
526 if (!XQueryTree (d, w, &root, &parent, &children, &nchildren)) | |
527 { | |
528 *x = 0; | |
529 *y = 0; | |
530 return; | |
531 } | |
532 XFree (children); | |
533 } | |
534 while (root != parent); | |
535 XGetWindowAttributes (d, w, &xwa); | |
536 *x = xwa.x; | |
537 *y = xwa.y; | |
538 } | |
539 | |
540 #if 0 | |
541 static void | |
542 x_smash_bastardly_shell_position (Widget shell) | |
543 { | |
544 /* Naturally those bastards who wrote Xt couldn't be bothered | |
545 to learn about race conditions and such. We can't trust | |
546 the X and Y values to have any semblance of correctness, | |
547 so we smash the right values in place. */ | |
548 | |
549 /* We might be called before we've actually realized the window (if | |
550 we're checking for the minibuffer resource). This will bomb in | |
551 that case so we don't bother calling it. */ | |
552 if (XtWindow (shell)) | |
553 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), | |
554 &shell->core.x, &shell->core.y); | |
555 } | |
556 #endif /* 0 */ | |
557 | |
558 static Lisp_Object | |
559 x_frame_property (struct frame *f, Lisp_Object property) | |
560 { | |
561 Widget shell = FRAME_X_SHELL_WIDGET (f); | |
562 EmacsFrame w = (EmacsFrame) FRAME_X_TEXT_WIDGET (f); | |
563 Widget gw = (Widget) w; | |
564 | |
565 if (EQ (Qleft, property) || EQ (Qtop, property)) | |
566 { | |
567 Position x, y; | |
568 if (!XtWindow(shell)) | |
569 return Qzero; | |
570 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), &x, &y); | |
571 if (EQ (Qleft, property)) return make_int (x); | |
572 if (EQ (Qtop, property)) return make_int (y); | |
573 } | |
574 if (EQ (Qborder_width, property)) | |
575 return make_int (w->core.border_width); | |
576 if (EQ (Qinternal_border_width, property)) | |
577 return make_int (w->emacs_frame.internal_border_width); | |
578 if (EQ (Qborder_color, property)) | |
579 return color_to_string (gw, w->core.border_pixel); | |
580 if (EQ (Qinter_line_space, property)) | |
581 return make_int (w->emacs_frame.interline); | |
582 if (EQ (Qwindow_id, property)) | |
771 | 583 return Fx_window_id (wrap_frame (f)); |
428 | 584 |
585 return Qunbound; | |
586 } | |
587 | |
588 static int | |
2286 | 589 x_internal_frame_property_p (struct frame *UNUSED (f), Lisp_Object property) |
428 | 590 { |
591 return EQ (property, Qleft) | |
592 || EQ (property, Qtop) | |
593 || EQ (property, Qborder_width) | |
594 || EQ (property, Qinternal_border_width) | |
595 || EQ (property, Qborder_color) | |
596 || EQ (property, Qinter_line_space) | |
597 || EQ (property, Qwindow_id) | |
598 || STRINGP (property); | |
599 } | |
600 | |
601 static Lisp_Object | |
602 x_frame_properties (struct frame *f) | |
603 { | |
604 Lisp_Object props = Qnil; | |
605 Widget shell = FRAME_X_SHELL_WIDGET (f); | |
606 EmacsFrame w = (EmacsFrame) FRAME_X_TEXT_WIDGET (f); | |
607 Widget gw = (Widget) w; | |
608 Position x, y; | |
609 | |
771 | 610 props = cons3 (Qwindow_id, Fx_window_id (wrap_frame (f)), props); |
428 | 611 props = cons3 (Qinter_line_space, make_int (w->emacs_frame.interline), props); |
612 | |
613 props = cons3 (Qborder_color, | |
614 color_to_string (gw, w->core.border_pixel), props); | |
615 props = cons3 (Qinternal_border_width, | |
616 make_int (w->emacs_frame.internal_border_width), props); | |
617 props = cons3 (Qborder_width, make_int (w->core.border_width), props); | |
618 | |
619 if (!XtWindow(shell)) | |
620 x = y = 0; | |
621 else | |
622 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), &x, &y); | |
623 | |
624 props = cons3 (Qtop, make_int (y), props); | |
625 props = cons3 (Qleft, make_int (x), props); | |
626 | |
627 return props; | |
628 } | |
629 | |
630 | |
631 /* Functions called only from `x_set_frame_properties' to set | |
632 individual properties. */ | |
633 | |
634 static void | |
867 | 635 x_set_frame_text_value (struct frame *f, Ibyte *value, |
428 | 636 String Xt_resource_name, |
637 String Xt_resource_encoding_name) | |
638 { | |
639 Atom encoding = XA_STRING; | |
640 String new_XtValue = (String) value; | |
641 String old_XtValue = NULL; | |
642 | |
643 #ifdef MULE | |
867 | 644 Ibyte *ptr; |
428 | 645 /* Optimize for common ASCII case */ |
646 for (ptr = value; *ptr; ptr++) | |
826 | 647 if (!byte_ascii_p (*ptr)) |
428 | 648 { |
649 encoding = DEVICE_XATOM_COMPOUND_TEXT (XDEVICE (FRAME_DEVICE (f))); | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
650 new_XtValue = (String) ITEXT_TO_EXTERNAL (value, Qctext); |
428 | 651 break; |
652 } | |
653 #endif /* MULE */ | |
654 | |
440 | 655 /* #### Caching is device-independent - belongs in update_frame_title. */ |
428 | 656 Xt_GET_VALUE (FRAME_X_SHELL_WIDGET (f), Xt_resource_name, &old_XtValue); |
657 if (!old_XtValue || strcmp (new_XtValue, old_XtValue)) | |
658 { | |
659 Arg al[2]; | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
660 Xt_SET_ARG (al[0], Xt_resource_name, new_XtValue); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
661 Xt_SET_ARG (al[1], Xt_resource_encoding_name, encoding); |
428 | 662 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2); |
663 } | |
664 } | |
665 | |
666 static void | |
867 | 667 x_set_title_from_ibyte (struct frame *f, Ibyte *name) |
428 | 668 { |
669 x_set_frame_text_value (f, name, XtNtitle, XtNtitleEncoding); | |
670 } | |
671 | |
672 static void | |
867 | 673 x_set_icon_name_from_ibyte (struct frame *f, Ibyte *name) |
428 | 674 { |
675 x_set_frame_text_value (f, name, XtNiconName, XtNiconNameEncoding); | |
676 } | |
677 | |
678 /* Set the initial frame size as specified. This function is used | |
679 when the frame's widgets have not yet been realized. In this | |
680 case, it is not sufficient just to set the width and height of | |
681 the EmacsFrame widget, because they will be ignored when the | |
682 widget is realized (instead, the shell's geometry resource is | |
683 used). */ | |
684 | |
685 static void | |
686 x_set_initial_frame_size (struct frame *f, int flags, int x, int y, | |
647 | 687 int w, int h) |
428 | 688 { |
2367 | 689 Ascbyte shell_geom[255]; |
428 | 690 int xval, yval; |
2367 | 691 Ascbyte xsign, ysign; |
692 Boolbyte uspos = !!(flags & (XValue | YValue)); | |
693 Boolbyte ussize = !!(flags & (WidthValue | HeightValue)); | |
694 Ascbyte *temp; | |
428 | 695 |
696 /* assign the correct size to the EmacsFrame widget ... */ | |
697 EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), w, h); | |
698 | |
699 /* and also set the WMShell's geometry */ | |
700 (flags & XNegative) ? (xval = -x, xsign = '-') : (xval = x, xsign = '+'); | |
701 (flags & YNegative) ? (yval = -y, ysign = '-') : (yval = y, ysign = '+'); | |
702 | |
703 if (uspos && ussize) | |
704 sprintf (shell_geom, "=%dx%d%c%d%c%d", w, h, xsign, xval, ysign, yval); | |
705 else if (uspos) | |
706 sprintf (shell_geom, "=%c%d%c%d", xsign, xval, ysign, yval); | |
707 else if (ussize) | |
708 sprintf (shell_geom, "=%dx%d", w, h); | |
709 | |
710 if (uspos || ussize) | |
711 { | |
2367 | 712 temp = xnew_ascbytes (1 + strlen (shell_geom)); |
428 | 713 strcpy (temp, shell_geom); |
714 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp; | |
715 } | |
716 else | |
717 temp = NULL; | |
718 | |
719 Xt_SET_VALUE (FRAME_X_SHELL_WIDGET (f), XtNgeometry, temp); | |
720 } | |
721 | |
722 /* Report to X that a frame property of frame S is being set or changed. | |
723 If the property is not specially recognized, do nothing. | |
724 */ | |
725 | |
726 static void | |
727 x_set_frame_properties (struct frame *f, Lisp_Object plist) | |
728 { | |
729 Position x, y; | |
730 Dimension width = 0, height = 0; | |
731 Bool width_specified_p = False; | |
732 Bool height_specified_p = False; | |
733 Bool x_position_specified_p = False; | |
734 Bool y_position_specified_p = False; | |
735 Bool internal_border_width_specified = False; | |
736 Lisp_Object tail; | |
3415 | 737 Widget w; |
738 | |
739 /* We can be called after the X IO error handler has seen a broken pipe on | |
740 the relevant display. Don't do anything in that case. */ | |
741 if (!FRAME_LIVE_P (f) || DEVICE_X_BEING_DELETED (XDEVICE (FRAME_DEVICE (f)))) | |
742 return; | |
743 | |
744 w = FRAME_X_TEXT_WIDGET (f); | |
428 | 745 |
746 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) | |
747 { | |
748 Lisp_Object prop = Fcar (tail); | |
749 Lisp_Object val = Fcar (Fcdr (tail)); | |
750 | |
751 if (STRINGP (prop)) | |
752 { | |
2367 | 753 const Extbyte *extprop; |
428 | 754 |
755 if (XSTRING_LENGTH (prop) == 0) | |
756 continue; | |
757 | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
758 extprop = LISP_STRING_TO_EXTERNAL (prop, Qxt_widget_arg_encoding); |
428 | 759 if (STRINGP (val)) |
760 { | |
442 | 761 const Extbyte *extval; |
665 | 762 Bytecount extvallen; |
428 | 763 |
2367 | 764 /* !!#### I seriously doubt there is a single external format |
765 for the value of a widget argument; it depends on the | |
766 semantics of the argument. So use of | |
767 Qxt_widget_arg_encoding is totally bogus. --ben */ | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
768 LISP_STRING_TO_SIZED_EXTERNAL (val, extval, extvallen, |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
769 Qxt_widget_arg_encoding); |
428 | 770 XtVaSetValues (w, XtVaTypedArg, extprop, |
2367 | 771 /* !!#### Verify this + 1 and document |
772 as zero-termination */ | |
428 | 773 XtRString, extval, extvallen + 1, |
3463 | 774 NULL); |
428 | 775 } |
776 else | |
777 XtVaSetValues (w, XtVaTypedArg, extprop, XtRInt, | |
778 XINT (val), sizeof (int), | |
3463 | 779 NULL); |
428 | 780 } |
781 else if (SYMBOLP (prop)) | |
782 { | |
783 Lisp_Object str = Fget (prop, Qx_resource_name, Qnil); | |
784 int int_p = !NILP (Fget (prop, Qintegerp, Qnil)); | |
2367 | 785 Extbyte *strext; |
428 | 786 |
787 if (NILP (prop) || NILP (str)) | |
788 { | |
789 /* Kludge to handle the font property. */ | |
790 if (EQ (prop, Qfont)) | |
791 { | |
792 /* If the value is not a string we silently ignore it. */ | |
793 if (STRINGP (val)) | |
794 { | |
795 Lisp_Object frm, font_spec; | |
796 | |
793 | 797 frm = wrap_frame (f); |
428 | 798 font_spec = Fget (Fget_face (Qdefault), Qfont, Qnil); |
799 | |
800 Fadd_spec_to_specifier (font_spec, val, frm, Qnil, Qnil); | |
801 update_frame_face_values (f); | |
802 } | |
803 | |
804 continue; | |
805 } | |
806 else | |
807 continue; | |
808 } | |
809 CHECK_STRING (str); | |
810 | |
811 /* Kludge the width/height so that we interpret them in characters | |
812 instead of pixels. Yuck yuck yuck. */ | |
2367 | 813 if (!qxestrcmp_ascii (XSTRING_DATA (str), "width")) |
428 | 814 { |
815 CHECK_INT (val); | |
816 width = XINT (val); | |
817 width_specified_p = True; | |
818 continue; | |
819 } | |
2367 | 820 if (!qxestrcmp_ascii (XSTRING_DATA (str), "height")) |
428 | 821 { |
822 CHECK_INT (val); | |
823 height = XINT (val); | |
824 height_specified_p = True; | |
825 continue; | |
826 } | |
827 /* Further kludge the x/y. */ | |
2367 | 828 if (!qxestrcmp_ascii (XSTRING_DATA (str), "x")) |
428 | 829 { |
830 CHECK_INT (val); | |
831 x = (Position) XINT (val); | |
832 x_position_specified_p = True; | |
833 continue; | |
834 } | |
2367 | 835 if (!qxestrcmp_ascii (XSTRING_DATA (str), "y")) |
428 | 836 { |
837 CHECK_INT (val); | |
838 y = (Position) XINT (val); | |
839 y_position_specified_p = True; | |
840 continue; | |
841 } | |
842 /* Have you figured out by now that this entire function is | |
843 one gigantic kludge? */ | |
2367 | 844 if (!qxestrcmp_ascii (XSTRING_DATA (str), "internalBorderWidth")) |
428 | 845 { |
846 internal_border_width_specified = True; | |
847 } | |
848 | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
849 strext = LISP_STRING_TO_EXTERNAL (str, Qxt_widget_arg_encoding); |
428 | 850 if (int_p) |
851 { | |
852 CHECK_INT (val); | |
2367 | 853 Xt_SET_VALUE (w, strext, XINT (val)); |
428 | 854 } |
855 else if (EQ (val, Qt)) | |
856 { | |
2367 | 857 Xt_SET_VALUE (w, strext, True); /* XtN...*/ |
428 | 858 } |
859 else if (EQ (val, Qnil)) | |
860 { | |
2367 | 861 Xt_SET_VALUE (w, strext, False); /* XtN...*/ |
428 | 862 } |
863 else | |
864 { | |
2367 | 865 const Extbyte *extval; |
866 Bytecount extvallen; | |
2372 | 867 CHECK_STRING (val); |
2367 | 868 |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
869 LISP_STRING_TO_SIZED_EXTERNAL (val, extval, extvallen, |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
870 Qxt_widget_arg_encoding); |
428 | 871 XtVaSetValues (w, XtVaTypedArg, |
872 /* XtN... */ | |
2367 | 873 strext, |
874 /* !!#### Verify this + 1 and document | |
875 as zero-termination */ | |
876 XtRString, extval, extvallen + 1, | |
3463 | 877 NULL); |
428 | 878 } |
879 | |
880 #ifdef HAVE_SCROLLBARS | |
2367 | 881 if (!qxestrcmp_ascii (XSTRING_DATA (str), "scrollBarWidth") |
882 || !qxestrcmp_ascii (XSTRING_DATA (str), "scrollBarHeight")) | |
428 | 883 { |
884 x_update_frame_scrollbars (f); | |
885 } | |
886 #endif /* HAVE_SCROLLBARS */ | |
887 } | |
888 } | |
889 | |
890 /* Kludge kludge kludge. We need to deal with the size and position | |
891 specially. */ | |
892 { | |
893 int size_specified_p = width_specified_p || height_specified_p; | |
894 int position_specified_p = x_position_specified_p || | |
895 y_position_specified_p; | |
896 | |
897 if (!width_specified_p) | |
898 width = FRAME_WIDTH (f); | |
899 if (!height_specified_p) | |
900 height = FRAME_HEIGHT (f); | |
901 | |
902 /* Kludge kludge kludge kludge. */ | |
903 if (position_specified_p && | |
904 (!x_position_specified_p || !y_position_specified_p)) | |
905 { | |
906 Position dummy; | |
907 Widget shell = FRAME_X_SHELL_WIDGET (f); | |
908 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), | |
909 (x_position_specified_p ? &dummy : &x), | |
910 (y_position_specified_p ? &dummy : &y)); | |
911 #if 0 | |
912 x = (int) (FRAME_X_SHELL_WIDGET (f)->core.x); | |
913 y = (int) (FRAME_X_SHELL_WIDGET (f)->core.y); | |
914 #endif | |
915 } | |
916 | |
917 if (!f->init_finished) | |
918 { | |
919 int flags = (size_specified_p ? WidthValue | HeightValue : 0) | | |
920 (position_specified_p ? | |
921 XValue | YValue | (x < 0 ? XNegative : 0) | (y < 0 ? YNegative : 0) | |
922 : 0); | |
923 if (size_specified_p | |
924 || position_specified_p | |
925 || internal_border_width_specified) | |
926 x_set_initial_frame_size (f, flags, x, y, width, height); | |
927 } | |
928 else | |
929 { | |
930 if (size_specified_p || internal_border_width_specified) | |
931 { | |
793 | 932 Lisp_Object frame = wrap_frame (f); |
933 | |
428 | 934 Fset_frame_size (frame, make_int (width), |
935 make_int (height), Qnil); | |
936 } | |
937 if (position_specified_p) | |
938 { | |
793 | 939 Lisp_Object frame = wrap_frame (f); |
940 | |
428 | 941 Fset_frame_position (frame, make_int (x), make_int (y)); |
942 } | |
943 } | |
944 } | |
945 } | |
946 | |
947 static int frame_title_format_already_set; | |
948 | |
949 static void | |
950 maybe_set_frame_title_format (Widget shell) | |
951 { | |
952 | |
953 /* Only do this if this is the first X frame we're creating. | |
954 | |
955 If the *title resource (or -title option) was specified, then | |
956 set frame-title-format to its value. | |
957 */ | |
958 | |
959 if (!frame_title_format_already_set) | |
960 { | |
961 /* No doubt there's a less stupid way to do this. */ | |
2367 | 962 Extbyte *results[2]; |
963 XtResource resources[2]; | |
964 results[0] = results[1] = 0; | |
965 resources[0].resource_name = XtNtitle; | |
966 resources[0].resource_class = XtCTitle; | |
967 resources[0].resource_type = XtRString; | |
968 resources[0].resource_size = sizeof (String); | |
969 resources[0].resource_offset = 0; | |
970 resources[0].default_type = XtRString; | |
971 resources[0].default_addr = 0; | |
972 resources[1].resource_name = XtNiconName; | |
973 resources[1].resource_class = XtCIconName; | |
974 resources[1].resource_type = XtRString; | |
975 resources[1].resource_size = sizeof (String); | |
976 resources[1].resource_offset = sizeof (Extbyte *); | |
977 resources[1].default_type = XtRString; | |
978 resources[1].default_addr = 0; | |
428 | 979 XtGetSubresources (XtParent (shell), (XtPointer) results, |
980 shell->core.name, | |
981 shell->core.widget_class->core_class.class_name, | |
982 resources, XtNumber (resources), 0, 0); | |
983 if (results[0]) | |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
984 Vframe_title_format = build_extstring (results[0], Qctext); |
428 | 985 if (results[1]) |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
986 Vframe_icon_title_format = build_extstring (results[1], Qctext); |
428 | 987 } |
988 | |
989 frame_title_format_already_set = 1; | |
990 } | |
991 | |
4790
bc4f2511bbea
Remove support for the OffiX drag-and-drop protocol. See xemacs-patches
Jerry James <james@xemacs.org>
parents:
4769
diff
changeset
|
992 #if defined (HAVE_CDE) |
2367 | 993 |
994 static Extbyte * | |
995 start_drag_internal_1 (Lisp_Object event, Lisp_Object data, | |
996 Lisp_Object encoding, XEvent *x_event, int listp, | |
997 Widget *wid_out, Bytecount *len_out, | |
998 int *num_items_out) | |
999 { | |
1000 struct frame *f; | |
1001 Widget wid; | |
1002 struct device *d; | |
1003 struct x_device *xd; | |
1004 XWindowAttributes win_attrib; | |
1005 int modifier = 0, state = 0; | |
1006 Extbyte *dnd_data; | |
1007 Lisp_Event *lisp_event; | |
1008 | |
1009 CHECK_EVENT (event); | |
1010 lisp_event = XEVENT (event); | |
1011 if (EVENT_TYPE (lisp_event) != button_press_event) | |
1012 invalid_argument ("Need button-press event for drag", event); | |
1013 f = decode_x_frame (FW_FRAME (EVENT_CHANNEL (lisp_event))); | |
1014 wid = FRAME_X_TEXT_WIDGET (f); | |
1015 d = XDEVICE (FRAME_DEVICE (f)); | |
1016 xd = DEVICE_X_DATA (d); | |
1017 *num_items_out = 0; | |
1018 | |
1019 if (listp) | |
1020 { | |
1021 DECLARE_EISTRING (ei); | |
1022 | |
1023 EXTERNAL_LIST_LOOP_2 (elt, data) | |
1024 { | |
1025 CHECK_STRING (elt); | |
1026 eicat_lstr (ei, elt); | |
1027 eicat_ch (ei, '\0'); | |
1028 (*num_items_out)++; | |
1029 } | |
1030 eicat_ch (ei, '\0'); | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
1031 TO_EXTERNAL_FORMAT (DATA, (eidata (ei), eilen (ei)), |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
1032 MALLOC, (dnd_data, *len_out), |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
1033 encoding); |
2367 | 1034 } |
1035 else | |
1036 { | |
1037 CHECK_STRING (data); | |
1038 LISP_STRING_TO_SIZED_EXTERNAL_MALLOC (data, dnd_data, *len_out, | |
1039 encoding); | |
1040 *len_out += EXTTEXT_ZTERM_SIZE; | |
1041 (*num_items_out)++; | |
1042 } | |
1043 | |
1044 /* not so gross hack that converts an emacs event back to a XEvent */ | |
1045 | |
1046 x_event->xbutton.type = ButtonPress; | |
1047 x_event->xbutton.send_event = False; | |
1048 x_event->xbutton.display = XtDisplayOfObject (wid); | |
1049 x_event->xbutton.window = XtWindowOfObject (wid); | |
1050 x_event->xbutton.root = XRootWindow (x_event->xbutton.display, 0); | |
1051 x_event->xbutton.subwindow = 0; | |
1052 x_event->xbutton.time = lisp_event->timestamp; | |
1053 x_event->xbutton.x = EVENT_BUTTON_X (lisp_event); | |
1054 x_event->xbutton.y = EVENT_BUTTON_Y (lisp_event); | |
1055 if (Success == XGetWindowAttributes (x_event->xbutton.display, | |
1056 x_event->xbutton.window, | |
1057 &win_attrib)) | |
1058 { | |
1059 x_event->xbutton.x_root = win_attrib.x + EVENT_BUTTON_X (lisp_event); | |
1060 x_event->xbutton.y_root = win_attrib.y + EVENT_BUTTON_Y (lisp_event); | |
1061 } | |
1062 else | |
1063 { | |
1064 x_event->xbutton.x_root = EVENT_BUTTON_X (lisp_event); /* this is wrong */ | |
1065 x_event->xbutton.y_root = EVENT_BUTTON_Y (lisp_event); | |
1066 } | |
1067 | |
1068 modifier = EVENT_BUTTON_MODIFIERS (lisp_event); | |
1069 if (modifier & XEMACS_MOD_SHIFT) state |= ShiftMask; | |
1070 if (modifier & XEMACS_MOD_CONTROL) state |= ControlMask; | |
1071 if (modifier & XEMACS_MOD_META) state |= xd->MetaMask; | |
1072 if (modifier & XEMACS_MOD_SUPER) state |= xd->SuperMask; | |
1073 if (modifier & XEMACS_MOD_HYPER) state |= xd->HyperMask; | |
1074 if (modifier & XEMACS_MOD_ALT) state |= xd->AltMask; | |
1075 state |= Button1Mask << (EVENT_BUTTON_BUTTON (lisp_event) - 1); | |
1076 | |
1077 x_event->xbutton.state = state; | |
1078 x_event->xbutton.button = EVENT_BUTTON_BUTTON (lisp_event); | |
1079 x_event->xbutton.same_screen = True; | |
1080 | |
1081 *wid_out = wid; | |
1082 return dnd_data; | |
1083 } | |
1084 | |
4790
bc4f2511bbea
Remove support for the OffiX drag-and-drop protocol. See xemacs-patches
Jerry James <james@xemacs.org>
parents:
4769
diff
changeset
|
1085 #endif /* defined (HAVE_CDE) */ |
2367 | 1086 |
428 | 1087 #ifdef HAVE_CDE |
1088 #include <Dt/Dt.h> | |
1089 #include <Dt/Dnd.h> | |
1090 | |
1091 static Widget CurrentDragWidget = NULL; | |
1092 static XtCallbackRec dnd_convert_cb_rec[2]; | |
1093 static XtCallbackRec dnd_destroy_cb_rec[2]; | |
1094 static int drag_not_done = 0; | |
1095 | |
1096 static void | |
1097 x_cde_destroy_callback (Widget widget, XtPointer clientData, | |
1098 XtPointer callData) | |
1099 { | |
1100 DtDndDragFinishCallbackStruct *dragFinishInfo = | |
2367 | 1101 (DtDndDragFinishCallbackStruct *) callData; |
428 | 1102 DtDndContext *dragData = dragFinishInfo->dragData; |
1103 int i; | |
1104 | |
1105 /* free the items */ | |
1106 if (callData != NULL && dragData != NULL) | |
1107 { | |
1108 if (dragData->protocol == DtDND_BUFFER_TRANSFER) | |
1109 { | |
1110 for (i = 0; i < dragData->numItems; i++) | |
1111 { | |
2367 | 1112 XtFree ((CRawbyte *) dragData->data.buffers[i].bp); |
428 | 1113 if (dragData->data.buffers[i].name) |
1114 XtFree(dragData->data.buffers[i].name); | |
1115 } | |
1116 } | |
1117 else | |
1118 { | |
1119 for (i = 0; i < dragData->numItems; i++) | |
1120 XtFree(dragData->data.files[i]); | |
1121 } | |
1122 } | |
1123 | |
1124 /* free the data string */ | |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
1125 xfree (clientData); |
428 | 1126 |
1127 CurrentDragWidget = NULL; | |
1128 } | |
1129 | |
1130 static void | |
1131 x_cde_convert_callback (Widget widget, XtPointer clientData, | |
1132 XtPointer callData) | |
1133 { | |
1134 DtDndConvertCallbackStruct *convertInfo = | |
1135 (DtDndConvertCallbackStruct *) callData; | |
2367 | 1136 Extbyte *textdata = (Extbyte *) clientData; |
1137 Extbyte *textptr = NULL; | |
428 | 1138 int i; |
1139 | |
1140 if (convertInfo == NULL) | |
1141 { | |
1142 return; | |
1143 } | |
1144 | |
1145 if ((convertInfo->dragData->protocol != DtDND_BUFFER_TRANSFER | |
1146 && convertInfo->dragData->protocol != DtDND_FILENAME_TRANSFER) || | |
1147 (convertInfo->reason != DtCR_DND_CONVERT_DATA)) | |
1148 { | |
1149 return; | |
1150 } | |
1151 | |
2367 | 1152 for (textptr = textdata, i = 0; |
1153 i < convertInfo->dragData->numItems; | |
1154 textptr += strlen (textptr) + 1, i++) | |
428 | 1155 { |
1156 if (convertInfo->dragData->protocol == DtDND_BUFFER_TRANSFER) | |
1157 { | |
2367 | 1158 convertInfo->dragData->data.buffers[i].bp = XtNewString (textptr); |
1159 convertInfo->dragData->data.buffers[i].size = strlen (textptr); | |
428 | 1160 convertInfo->dragData->data.buffers[i].name = NULL; |
1161 } | |
1162 else | |
1163 { | |
2367 | 1164 convertInfo->dragData->data.files[i] = XtNewString (textptr); |
428 | 1165 } |
1166 } | |
1167 | |
1168 convertInfo->status = DtDND_SUCCESS; | |
1169 } | |
1170 | |
1171 static Lisp_Object | |
2367 | 1172 abort_current_drag (Lisp_Object arg) |
428 | 1173 { |
1174 if (CurrentDragWidget && drag_not_done) | |
1175 { | |
1176 XmDragCancel(CurrentDragWidget); | |
1177 CurrentDragWidget = NULL; | |
1178 } | |
1179 return arg; | |
1180 } | |
1181 | |
1182 DEFUN ("cde-start-drag-internal", Fcde_start_drag_internal, 3, 3, 0, /* | |
1183 Start a CDE drag from a buffer. | |
1184 First argument is the event that started the drag (must be a | |
1185 button-press-event), | |
1186 second arg defines if the data should be treated as a buffer or | |
1187 a filename transfer (set to nil for buffer transfer), | |
1188 and the third argument is a list of data strings. | |
1189 WARNING: can only handle plain/text and file: transfers! | |
1190 */ | |
1191 (event, dragtype, dragdata)) | |
1192 { | |
2367 | 1193 Extbyte *dnd_data; |
1194 XEvent x_event; | |
1195 Bytecount dnd_len; | |
1196 Widget wid; | |
1197 int num_items; | |
1198 | |
1199 dnd_data = start_drag_internal_1 (event, dragdata, Qdt_dnd_encoding, | |
1200 &x_event, 1, | |
1201 &wid, &dnd_len, &num_items); | |
1202 | |
1203 dnd_convert_cb_rec[0].callback = x_cde_convert_callback; | |
1204 dnd_convert_cb_rec[0].closure = (XtPointer) dnd_data; | |
1205 dnd_convert_cb_rec[1].callback = NULL; | |
1206 dnd_convert_cb_rec[1].closure = NULL; | |
1207 | |
1208 dnd_destroy_cb_rec[0].callback = x_cde_destroy_callback; | |
1209 dnd_destroy_cb_rec[0].closure = (XtPointer) dnd_data; | |
1210 dnd_destroy_cb_rec[1].callback = NULL; | |
1211 dnd_destroy_cb_rec[1].closure = NULL; | |
1212 | |
1213 CurrentDragWidget = | |
1214 DtDndDragStart (wid, &x_event, | |
1215 (NILP (dragtype) ? DtDND_BUFFER_TRANSFER : | |
1216 DtDND_FILENAME_TRANSFER), | |
1217 num_items, | |
1218 XmDROP_COPY, | |
1219 dnd_convert_cb_rec, | |
1220 dnd_destroy_cb_rec, | |
1221 NULL, 0); | |
1222 | |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
1223 xfree (dnd_data); |
2367 | 1224 |
1225 return num_items ? Qt : Qnil; | |
428 | 1226 } |
1227 | |
1228 static void | |
1229 x_cde_transfer_callback (Widget widget, XtPointer clientData, | |
1230 XtPointer callData) | |
1231 { | |
2367 | 1232 int ii, enqueue = 1; |
428 | 1233 Lisp_Object frame = Qnil; |
1234 Lisp_Object l_type = Qnil; | |
1235 Lisp_Object l_data = Qnil; | |
1236 DtDndTransferCallbackStruct *transferInfo = NULL; | |
1237 struct gcpro gcpro1, gcpro2, gcpro3; | |
1238 | |
1239 /* | |
1240 this needs to be changed to the new protocol: | |
1241 - we need the button, modifier and pointer states to create a | |
1242 correct misc_user_event | |
1243 - the data must be converted to the new format (URL/MIME) | |
1244 */ | |
1245 /* return; */ | |
1246 | |
1247 transferInfo = (DtDndTransferCallbackStruct *) callData; | |
1248 if (transferInfo == NULL) | |
1249 return; | |
1250 | |
1251 GCPRO3 (frame, l_type, l_data); | |
1252 | |
771 | 1253 frame = wrap_frame ((struct frame *) clientData); |
428 | 1254 |
1255 if (transferInfo->dropData->protocol == DtDND_FILENAME_TRANSFER) | |
1256 { | |
1257 l_type = Qdragdrop_URL; | |
1258 | |
1259 for (ii = 0; ii < transferInfo->dropData->numItems; ii++) | |
1260 { | |
2367 | 1261 Ibyte *fileint; |
1262 Ibyte *hurl; | |
1263 | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
1264 fileint = |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
1265 EXTERNAL_TO_ITEXT (transferInfo->dropData->data.files[ii], |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
1266 Qfile_name); |
2367 | 1267 |
1268 hurl = dnd_url_hexify_string (fileint, "file:"); | |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
1269 l_data = Fcons (build_istring (hurl), l_data); |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
1270 xfree (hurl); |
428 | 1271 } |
1272 } | |
1273 else if (transferInfo->dropData->protocol == DtDND_BUFFER_TRANSFER) | |
1274 { | |
2367 | 1275 int speccount = specpdl_depth (); |
1276 | |
1277 /* !!#### Problem: all buffers a treated as text/plain!!! | |
1278 Not appropriate for intl text. Note that there is a function | |
1279 DtDtsBufferToDataType(), but I don't know what the possible | |
1280 return values are. | |
1281 Solution (?): Also support DtDND_TEXT_TRANSFER (compound text) | |
428 | 1282 perhaps implementation of the Motif protocol |
1283 (which is the base of CDE) will clear this */ | |
1284 l_type = Qdragdrop_MIME; | |
2367 | 1285 record_unwind_protect (abort_current_drag, Qnil); |
428 | 1286 drag_not_done = 1; |
1287 for (ii = 0; ii < transferInfo->dropData->numItems; ii++) | |
1288 { | |
1289 /* let us forget this name thing for now... */ | |
1290 /* filePath = transferInfo->dropData->data.buffers[ii].name; | |
1291 path = (filePath == NULL) ? Qnil | |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
1292 : build_extstring (filePath, Q???); */ |
428 | 1293 /* what, if the data is no text, and how can I tell it? */ |
2367 | 1294 l_data = |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4790
diff
changeset
|
1295 Fcons (list3 (list1 (build_ascstring ("text/plain")), |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4790
diff
changeset
|
1296 build_ascstring ("8bit"), |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
1297 make_extstring |
2367 | 1298 (transferInfo->dropData->data.buffers[ii].bp, |
1299 transferInfo->dropData->data.buffers[ii].size, | |
1300 /* !!#### what goes here? */ | |
1301 Qdt_dnd_encoding)), | |
1302 l_data); | |
428 | 1303 } |
1304 drag_not_done = 0; | |
771 | 1305 unbind_to (speccount); |
428 | 1306 } |
1307 else /* the other cases: NOOP_TRANSFER */ | |
2367 | 1308 enqueue = 0; |
428 | 1309 |
1310 /* The Problem: no button and mods from CDE... */ | |
1311 if (enqueue) | |
2367 | 1312 enqueue_misc_user_event_pos (frame, Qdragdrop_drop_dispatch, |
1313 Fcons (l_type, l_data), | |
1314 0 /* this is the button */, | |
1315 0 /* these are the mods */, | |
1316 transferInfo->x, | |
1317 transferInfo->y); | |
428 | 1318 |
1319 UNGCPRO; | |
1320 return; | |
1321 } | |
1322 #endif /* HAVE_CDE */ | |
1323 | |
1324 | |
1325 /************************************************************************/ | |
1326 /* widget creation */ | |
1327 /************************************************************************/ | |
1328 | |
1329 /* The widget hierarchy is | |
1330 | |
1331 argv[0] shell container FRAME-NAME | |
1332 ApplicationShell EmacsShell EmacsManager EmacsFrame | |
1333 | |
1334 We accept geometry specs in this order: | |
1335 | |
1336 *FRAME-NAME.geometry | |
1337 *EmacsFrame.geometry | |
1338 Emacs.geometry | |
1339 | |
1340 Other possibilities for widget hierarchies might be | |
1341 | |
1342 argv[0] frame container FRAME-NAME | |
1343 ApplicationShell EmacsShell EmacsManager EmacsFrame | |
1344 or | |
1345 argv[0] FRAME-NAME container FRAME-NAME | |
1346 ApplicationShell EmacsShell EmacsManager EmacsFrame | |
1347 or | |
1348 argv[0] FRAME-NAME container emacsTextPane | |
1349 ApplicationShell EmacsShell EmacsManager EmacsFrame | |
1350 | |
1351 #ifdef EXTERNAL_WIDGET | |
1352 The ExternalShell widget is simply a replacement for the Shell widget | |
1353 which is able to deal with using an externally-supplied window instead | |
1354 of always creating its own. | |
1355 #endif | |
1356 | |
1357 */ | |
1358 | |
1359 #ifdef EXTERNAL_WIDGET | |
1360 | |
1361 static int | |
1362 is_valid_window (Window w, struct device *d) | |
1363 { | |
1364 XWindowAttributes xwa; | |
1365 Display *dpy = DEVICE_X_DISPLAY (d); | |
1366 | |
1367 expect_x_error (dpy); | |
1368 XGetWindowAttributes (dpy, w, &xwa); | |
1369 return !x_error_occurred_p (dpy); | |
1370 } | |
1371 | |
1372 #endif /* EXTERNAL_WIDGET */ | |
1373 | |
1374 /* This sends a synthetic mouse-motion event to the frame, if the mouse | |
1375 is over the frame. This ensures that the cursor gets set properly | |
1376 before the user moves the mouse for the first time. */ | |
1377 | |
1378 static void | |
2286 | 1379 x_send_synthetic_mouse_event (struct frame *UNUSED (f)) |
428 | 1380 { |
1381 /* #### write this function. */ | |
1382 } | |
1383 | |
1384 static int | |
1385 first_x_frame_p (struct frame *f) | |
1386 { | |
1387 Lisp_Object rest = DEVICE_FRAME_LIST (XDEVICE (f->device)); | |
1388 while (!NILP (rest) && | |
1389 (f == XFRAME (XCAR (rest)) || | |
1390 !FRAME_X_P (XFRAME (XCAR (rest))))) | |
1391 rest = XCDR (rest); | |
1392 return NILP (rest); | |
1393 } | |
1394 | |
1395 /* Figure out what size the EmacsFrame widget should initially be, | |
1396 and set it. Should be called after the default font has been | |
1397 determined but before the widget has been realized. */ | |
1398 | |
1399 static void | |
1400 x_initialize_frame_size (struct frame *f) | |
1401 { | |
1402 /* Geometry of the AppShell */ | |
1403 int app_flags = 0; | |
1404 int app_x = 0; | |
1405 int app_y = 0; | |
1406 unsigned int app_w = 0; | |
1407 unsigned int app_h = 0; | |
1408 | |
1409 /* Geometry of the EmacsFrame */ | |
1410 int frame_flags = 0; | |
1411 int frame_x = 0; | |
1412 int frame_y = 0; | |
1413 unsigned int frame_w = 0; | |
1414 unsigned int frame_h = 0; | |
1415 | |
1416 /* Hairily merged geometry */ | |
1417 int x = 0; | |
1418 int y = 0; | |
1419 unsigned int w = 80; | |
1420 unsigned int h = 40; | |
1421 int flags = 0; | |
1422 | |
2367 | 1423 Ascbyte *geom = 0, *ew_geom = 0; |
428 | 1424 Boolean iconic_p = False, ew_iconic_p = False; |
1425 | |
1426 Widget wmshell = FRAME_X_SHELL_WIDGET (f); | |
1427 /* #### This may not be an ApplicationShell any more, with the 'popup | |
1428 frame property. */ | |
1429 Widget app_shell = XtParent (wmshell); | |
1430 Widget ew = FRAME_X_TEXT_WIDGET (f); | |
1431 | |
2747 | 1432 /* set the position of the frame's root window now. When the |
1433 frame was created, the position was initialized to (0,0). */ | |
428 | 1434 { |
1435 struct window *win = XWINDOW (f->root_window); | |
1436 | |
442 | 1437 WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f) |
1438 + FRAME_LEFT_GUTTER_BOUNDS (f); | |
1439 WINDOW_TOP (win) = FRAME_TOP_BORDER_END (f) | |
1440 + FRAME_TOP_GUTTER_BOUNDS (f); | |
428 | 1441 |
1442 if (!NILP (f->minibuffer_window)) | |
1443 { | |
1444 win = XWINDOW (f->minibuffer_window); | |
442 | 1445 WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f) |
1446 + FRAME_LEFT_GUTTER_BOUNDS (f); | |
428 | 1447 } |
1448 } | |
1449 | |
1450 #ifdef EXTERNAL_WIDGET | |
1451 /* If we're an external widget, then the size of the frame is predetermined | |
1452 (by the client) and is not our decision to make. */ | |
1453 if (FRAME_X_EXTERNAL_WINDOW_P (f)) | |
1454 return; | |
1455 #endif | |
1456 | |
1457 #if 0 | |
1458 /* #### this junk has not been tested; therefore it's | |
1459 probably wrong. Doesn't really matter at this point because | |
1460 currently all frames are either top-level or external widgets. */ | |
1461 | |
1462 /* If we're not our own top-level window, then we shouldn't go messing around | |
1463 with top-level shells or "Emacs.geometry" or any such stuff. Therefore, | |
1464 we do as follows to determine the size of the frame: | |
1465 | |
1466 1) If a value for the frame's "geometry" resource was specified, then | |
1467 use it. (This specifies a size in characters.) | |
1468 2) Else, if the "width" and "height" resources were specified, then | |
1469 leave them alone. (This is a value in pixels. Sorry, we can't break | |
1470 Xt conventions here.) | |
1471 3) Else, assume a size of 64x12. (This is somewhat arbitrary, but | |
1472 it's unlikely that a size of 80x40 is desirable because we're probably | |
1473 inside of a dialog box.) | |
1474 | |
1475 Set the widget's x, y, height, and width as determined. Don't set the | |
1476 top-level container widget, because we don't necessarily know what it | |
1477 is. (Assume it is smart and pays attention to our values.) | |
1478 */ | |
1479 | |
1480 if (!FRAME_X_TOP_LEVEL_FRAME_P (f)) | |
1481 { | |
1482 Xt_GET_VALUE (ew, XtNgeometry, &ew_geom); | |
1483 if (ew_geom) | |
1484 frame_flags = XParseGeometry (ew_geom, | |
1485 &frame_x, &frame_y, | |
1486 &frame_w, &frame_h); | |
1487 if (! (frame_flags & (WidthValue | HeightValue))) | |
1488 { | |
1489 Arg al[2]; | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1490 Xt_SET_ARG (al [0], XtNwidth, &frame_w); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1491 Xt_SET_ARG (al [1], XtNheight, &frame_h); |
428 | 1492 XtGetValues (ew, al, 2); |
1493 if (!frame_w && !frame_h) | |
1494 { | |
1495 frame_w = 64; | |
1496 frame_h = 12; | |
1497 frame_flags |= WidthValue | HeightValue; | |
1498 } | |
1499 } | |
1500 if (frame_flags & (WidthValue | HeightValue)) | |
1501 EmacsFrameSetCharSize (ew, frame_w, frame_h); | |
1502 if (frame_flags & (XValue | YValue)) | |
1503 { | |
1504 Arg al[2]; | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1505 Xt_SET_ARG (al [0], XtNwidth, &frame_w); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1506 Xt_SET_ARG (al [1], XtNheight, &frame_h); |
428 | 1507 XtGetValues (ew, al, 2); |
1508 | |
1509 if (frame_flags & XNegative) | |
1510 frame_x += frame_w; | |
1511 if (frame_flags & YNegative) | |
1512 frame_y += frame_h; | |
1513 | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1514 Xt_SET_ARG (al [0], XtNx, frame_x); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1515 Xt_SET_ARG (al [1], XtNy, frame_y); |
428 | 1516 XtSetValues (ew, al, 2); |
1517 } | |
1518 return; | |
1519 } | |
1520 #endif | |
1521 | |
1522 /* OK, we're a top-level shell. */ | |
1523 | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
1524 assert (XtIsWMShell (wmshell)); |
428 | 1525 |
1526 /* If the EmacsFrame doesn't have a geometry but the shell does, | |
1527 treat that as the geometry of the frame. | |
1528 (Is this bogus? I'm not sure.) */ | |
1529 | |
1530 Xt_GET_VALUE (ew, XtNgeometry, &ew_geom); | |
1531 if (!ew_geom) | |
1532 { | |
1533 Xt_GET_VALUE (wmshell, XtNgeometry, &geom); | |
1534 if (geom) | |
1535 { | |
1536 ew_geom = geom; | |
1537 Xt_SET_VALUE (ew, XtNgeometry, ew_geom); | |
1538 } | |
1539 } | |
1540 | |
1541 /* If the Shell is iconic, then the EmacsFrame is iconic. | |
1542 (Is this bogus? I'm not sure.) */ | |
1543 Xt_GET_VALUE (ew, XtNiconic, &ew_iconic_p); | |
1544 if (!ew_iconic_p) | |
1545 { | |
1546 Xt_GET_VALUE (wmshell, XtNiconic, &iconic_p); | |
1547 if (iconic_p) | |
1548 { | |
1549 ew_iconic_p = iconic_p; | |
1550 Xt_SET_VALUE (ew, XtNiconic, iconic_p); | |
1551 } | |
1552 } | |
1553 | |
1554 Xt_GET_VALUE (app_shell, XtNgeometry, &geom); | |
1555 if (geom) | |
1556 app_flags = XParseGeometry (geom, &app_x, &app_y, &app_w, &app_h); | |
1557 | |
1558 if (ew_geom) | |
1559 frame_flags = XParseGeometry (ew_geom, | |
1560 &frame_x, &frame_y, | |
1561 &frame_w, &frame_h); | |
1562 | |
1563 if (first_x_frame_p (f)) | |
1564 { | |
1565 /* If this is the first frame created: | |
1566 ==================================== | |
1567 | |
1568 - Use the ApplicationShell's size/position, if specified. | |
1569 (This is "Emacs.geometry", or the "-geometry" command line arg.) | |
1570 - Else use the EmacsFrame's size/position. | |
1571 (This is "*FRAME-NAME.geometry") | |
1572 | |
1573 - If the AppShell is iconic, the frame should be iconic. | |
1574 | |
1575 AppShell comes first so that -geometry always applies to the first | |
1576 frame created, even if there is an "every frame" entry in the | |
1577 resource database. | |
1578 */ | |
1579 if (app_flags & (XValue | YValue)) | |
1580 { | |
1581 x = app_x; y = app_y; | |
1582 flags |= (app_flags & (XValue | YValue | XNegative | YNegative)); | |
1583 } | |
1584 else if (frame_flags & (XValue | YValue)) | |
1585 { | |
1586 x = frame_x; y = frame_y; | |
1587 flags |= (frame_flags & (XValue | YValue | XNegative | YNegative)); | |
1588 } | |
1589 | |
1590 if (app_flags & (WidthValue | HeightValue)) | |
1591 { | |
1592 w = app_w; h = app_h; | |
1593 flags |= (app_flags & (WidthValue | HeightValue)); | |
1594 } | |
1595 else if (frame_flags & (WidthValue | HeightValue)) | |
1596 { | |
1597 w = frame_w; h = frame_h; | |
1598 flags |= (frame_flags & (WidthValue | HeightValue)); | |
1599 } | |
1600 | |
1601 /* If the AppShell is iconic, then the EmacsFrame is iconic. */ | |
1602 if (!ew_iconic_p) | |
1603 { | |
1604 Xt_GET_VALUE (app_shell, XtNiconic, &iconic_p); | |
1605 if (iconic_p) | |
1606 { | |
1607 ew_iconic_p = iconic_p; | |
1608 Xt_SET_VALUE (ew, XtNiconic, iconic_p); | |
1609 } | |
1610 } | |
1611 } | |
1612 else | |
1613 { | |
1614 /* If this is not the first frame created: | |
1615 ======================================== | |
1616 | |
1617 - use the EmacsFrame's size/position if specified | |
1618 - Otherwise, use the ApplicationShell's size, but not position. | |
1619 | |
1620 So that means that one can specify the position of the first frame | |
1621 with "Emacs.geometry" or `-geometry'; but can only specify the | |
1622 position of subsequent frames with "*FRAME-NAME.geometry". | |
1623 | |
1624 AppShell comes second so that -geometry does not apply to subsequent | |
1625 frames when there is an "every frame" entry in the resource db, | |
1626 but does apply to the first frame. | |
1627 */ | |
1628 if (frame_flags & (XValue | YValue)) | |
1629 { | |
1630 x = frame_x; y = frame_y; | |
1631 flags |= (frame_flags & (XValue | YValue | XNegative | YNegative)); | |
1632 } | |
1633 | |
1634 if (frame_flags & (WidthValue | HeightValue)) | |
1635 { | |
1636 w = frame_w; h = frame_h; | |
1637 flags |= (frame_flags & (WidthValue | HeightValue)); | |
1638 } | |
1639 else if (app_flags & (WidthValue | HeightValue)) | |
1640 { | |
1641 w = app_w; | |
1642 h = app_h; | |
1643 flags |= (app_flags & (WidthValue | HeightValue)); | |
1644 } | |
1645 } | |
1646 | |
1647 x_set_initial_frame_size (f, flags, x, y, w, h); | |
1648 } | |
1649 | |
1650 static void | |
1651 x_get_layout_sizes (struct frame *f, Dimension *topbreadth) | |
1652 { | |
1653 int i; | |
1654 | |
1655 /* compute height of all top-area widgets */ | |
1656 for (i=0, *topbreadth = 0; i<FRAME_X_NUM_TOP_WIDGETS (f); i++) | |
1657 { | |
1658 Widget wid = FRAME_X_TOP_WIDGETS (f)[i]; | |
1659 if (wid && XtIsManaged (wid)) | |
1660 *topbreadth += wid->core.height + 2*wid->core.border_width; | |
1661 } | |
1662 } | |
1663 | |
1664 static void | |
2286 | 1665 x_layout_widgets (Widget UNUSED (w), XtPointer client_data, |
1666 XtPointer call_data) | |
428 | 1667 { |
1668 struct frame *f = (struct frame *) client_data; | |
1669 EmacsManagerResizeStruct *emst = (EmacsManagerResizeStruct *) call_data; | |
1670 Dimension width = emst->width; | |
1671 Dimension height = emst->height; | |
1672 Widget text = FRAME_X_TEXT_WIDGET (f); | |
1673 Dimension textbord = text->core.border_width; | |
1674 Dimension topbreadth; | |
1675 Position text_x = 0, text_y = 0; | |
1676 int i; | |
1677 | |
1678 x_get_layout_sizes (f, &topbreadth); | |
1679 | |
1680 /* first the menubar and psheets ... */ | |
1681 for (i=0; i<FRAME_X_NUM_TOP_WIDGETS (f); i++) | |
1682 { | |
1683 Widget wid = FRAME_X_TOP_WIDGETS (f)[i]; | |
1684 if (wid && XtIsManaged (wid)) | |
1685 { | |
1686 Dimension bord = wid->core.border_width; | |
1687 XtConfigureWidget (wid, 0, text_y, | |
1688 width - 2*bord, wid->core.height, | |
1689 bord); | |
1690 text_y += wid->core.height + 2*bord; | |
1691 } | |
1692 } | |
1693 | |
1694 #ifdef HAVE_SCROLLBARS | |
1695 f->scrollbar_y_offset = topbreadth + textbord; | |
1696 #endif | |
1697 | |
1698 /* finally the text area */ | |
1699 XtConfigureWidget (text, text_x, text_y, | |
1700 width - 2*textbord, | |
1701 height - text_y - 2*textbord, | |
1702 textbord); | |
1703 } | |
1704 | |
1705 static void | |
2286 | 1706 x_do_query_geometry (Widget UNUSED (w), XtPointer client_data, |
1707 XtPointer call_data) | |
428 | 1708 { |
1709 struct frame *f = (struct frame *) client_data; | |
1710 EmacsManagerQueryGeometryStruct *emst = | |
1711 (EmacsManagerQueryGeometryStruct *) call_data; | |
1712 Widget text = FRAME_X_TEXT_WIDGET (f); | |
1713 Dimension textbord = text->core.border_width; | |
1714 Dimension topbreadth; | |
1715 XtWidgetGeometry req, repl; | |
1716 int mask = emst->request_mode & (CWWidth | CWHeight); | |
1717 | |
1718 x_get_layout_sizes (f, &topbreadth); | |
1719 | |
1720 /* Strip away menubar from suggested size, and ask the text widget | |
1721 what size it wants to be. */ | |
1722 req.request_mode = mask; | |
1723 if (mask & CWWidth) | |
1724 req.width = emst->proposed_width - 2*textbord; | |
1725 if (mask & CWHeight) | |
1726 req.height = emst->proposed_height - topbreadth - 2*textbord; | |
1727 XtQueryGeometry (text, &req, &repl); | |
1728 | |
1729 /* Now add the menubar back again */ | |
1730 emst->proposed_width = repl.width + 2*textbord; | |
1731 emst->proposed_height = repl.height + topbreadth + 2*textbord; | |
1732 } | |
1733 | |
1734 /* Creates the widgets for a frame. | |
1735 lisp_window_id is a Lisp description of an X window or Xt | |
1736 widget to parse. | |
2747 | 1737 parent is a frame to use as the parent. |
1738 overridep if non-nil says to set the override-redirect setting. | |
428 | 1739 |
1740 This function does not create or map the windows. (That is | |
1741 done by x_popup_frame().) | |
1742 */ | |
1743 static void | |
1744 x_create_widgets (struct frame *f, Lisp_Object lisp_window_id, | |
2747 | 1745 Lisp_Object parent, Lisp_Object overridep) |
428 | 1746 { |
1747 struct device *d = XDEVICE (f->device); | |
1748 Visual *visual = DEVICE_X_VISUAL (d); | |
1749 int depth = DEVICE_X_DEPTH (d); | |
1750 Colormap cmap = DEVICE_X_COLORMAP (d); | |
1751 #ifdef EXTERNAL_WIDGET | |
1752 Window window_id = 0; | |
1753 #endif | |
2367 | 1754 const Extbyte *name; |
1755 Arg al[25]; | |
428 | 1756 int ac = 0; |
1757 Widget text, container, shell; | |
1758 Widget parentwid = 0; | |
1759 #ifdef HAVE_MENUBARS | |
1760 int menubar_visible; | |
1761 Widget menubar; | |
1762 #endif | |
1763 | |
1764 if (STRINGP (f->name)) | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
1765 name = LISP_STRING_TO_EXTERNAL (f->name, Qctext); |
428 | 1766 else |
1767 name = "emacs"; | |
1768 | |
1769 /* The widget hierarchy is | |
1770 | |
1771 argv[0] shell pane FRAME-NAME | |
1772 ApplicationShell EmacsShell EmacsManager EmacsFrame | |
1773 | |
1774 (the type of the shell is ExternalShell if this frame is running | |
1775 in another client's window) | |
1776 | |
1777 However the EmacsShell widget has WM_CLASS of FRAME-NAME/Emacs. | |
1778 Normally such shells have name/class shellname/appclass, which in this | |
1779 case would be "shell/Emacs" instead of "frame-name/Emacs". We could | |
1780 also get around this by naming the shell "frame-name", but that would | |
1781 be confusing because the text area (the EmacsFrame widget inferior of | |
1782 the shell) is also called that. So we just set the WM_CLASS property. | |
1783 */ | |
1784 | |
1785 #ifndef EXTERNAL_WIDGET | |
1786 if (!NILP (lisp_window_id)) | |
2367 | 1787 signal_error |
1788 (Qunimplemented, | |
1789 "support for external widgets was not enabled at compile-time", | |
1790 Qunbound); | |
428 | 1791 #else |
1792 if (!NILP (lisp_window_id)) | |
1793 { | |
2367 | 1794 Ibyte *string; |
428 | 1795 |
1796 CHECK_STRING (lisp_window_id); | |
2367 | 1797 string = XSTRING_DATA (lisp_window_id); |
428 | 1798 if (string[0] == '0' && (string[1] == 'x' || string[1] == 'X')) |
2367 | 1799 qxesscanf_ascii_1 (string + 2, "%lxu", &window_id); |
428 | 1800 #if 0 |
1801 else if (string[0] == 'w') | |
1802 { | |
2367 | 1803 qxesscanf_ascii (string + 1, "%x", &parent_widget); |
428 | 1804 if (parent_widget) |
1805 window_id = XtWindow (parent_widget); | |
1806 } | |
1807 #endif | |
1808 else | |
2367 | 1809 qxesscanf_ascii_1 (string, "%lu", &window_id); |
428 | 1810 if (!is_valid_window (window_id, d)) |
563 | 1811 signal_ferror (Qinvalid_argument, "Invalid window %lu", |
1812 (unsigned long) window_id); | |
428 | 1813 FRAME_X_EXTERNAL_WINDOW_P (f) = 1; |
1814 } else | |
1815 #endif /* EXTERNAL_WIDGET */ | |
1816 FRAME_X_TOP_LEVEL_FRAME_P (f) = 1; | |
1817 | |
1818 ac = 0; | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1819 Xt_SET_ARG (al[ac], XtNallowShellResize, True); ac++; |
428 | 1820 #ifdef LWLIB_USES_MOTIF |
1821 /* Motif sucks beans. Without this in here, it will delete the window | |
1822 out from under us when it receives a WM_DESTROY_WINDOW message | |
1823 from the WM. */ | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1824 Xt_SET_ARG (al[ac], XmNdeleteResponse, XmDO_NOTHING); ac++; |
428 | 1825 #endif |
1826 | |
1827 #ifdef EXTERNAL_WIDGET | |
1828 if (window_id) | |
1829 { | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1830 Xt_SET_ARG (al[ac], XtNwindow, window_id); ac++; |
428 | 1831 } |
1832 else | |
1833 #endif /* EXTERNAL_WIDGET */ | |
1834 { | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1835 Xt_SET_ARG (al[ac], XtNinput, True); ac++; |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1836 Xt_SET_ARG (al[ac], XtNminWidthCells, 10); ac++; |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1837 Xt_SET_ARG (al[ac], XtNminHeightCells, 1); ac++; |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1838 Xt_SET_ARG (al[ac], XtNvisual, visual); ac++; |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1839 Xt_SET_ARG (al[ac], XtNdepth, depth); ac++; |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1840 Xt_SET_ARG (al[ac], XtNcolormap, cmap); ac++; |
428 | 1841 } |
1842 | |
2747 | 1843 if (!NILP (overridep)) |
1844 { | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1845 Xt_SET_ARG (al[ac], XtNoverrideRedirect, True); ac++; |
2747 | 1846 } |
1847 | |
1848 /* #### maybe we should check for FRAMEP instead? */ | |
428 | 1849 if (!NILP (parent)) |
1850 { | |
1851 parentwid = FRAME_X_SHELL_WIDGET (XFRAME (parent)); | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1852 Xt_SET_ARG (al[ac], XtNtransientFor, parentwid); ac++; |
428 | 1853 } |
1854 | |
1855 shell = XtCreatePopupShell ("shell", | |
1856 ( | |
1857 #ifdef EXTERNAL_WIDGET | |
1858 window_id ? externalShellWidgetClass : | |
1859 #endif | |
1860 parentwid ? transientEmacsShellWidgetClass : | |
1861 topLevelEmacsShellWidgetClass | |
1862 ), | |
1863 parentwid ? parentwid : | |
1864 DEVICE_XT_APP_SHELL (d), | |
1865 al, ac); | |
1866 FRAME_X_SHELL_WIDGET (f) = shell; | |
1867 maybe_set_frame_title_format (shell); | |
1868 | |
1869 /* Create the manager widget */ | |
1870 ac = 0; | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1871 Xt_SET_ARG (al[ac], XtNvisual, visual); ac++; |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1872 Xt_SET_ARG (al[ac], XtNdepth, depth); ac++; |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1873 Xt_SET_ARG (al[ac], XtNcolormap, cmap); ac++; |
428 | 1874 |
1875 container = XtCreateWidget ("container", | |
1876 emacsManagerWidgetClass, shell, al, ac); | |
1877 FRAME_X_CONTAINER_WIDGET (f) = container; | |
1878 XtAddCallback (container, XtNresizeCallback, x_layout_widgets, | |
1879 (XtPointer) f); | |
1880 XtAddCallback (container, XtNqueryGeometryCallback, x_do_query_geometry, | |
1881 (XtPointer) f); | |
1882 | |
1883 /* Create the text area */ | |
1884 ac = 0; | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1885 Xt_SET_ARG (al[ac], XtNvisual, visual); ac++; |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1886 Xt_SET_ARG (al[ac], XtNdepth, depth); ac++; |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1887 Xt_SET_ARG (al[ac], XtNcolormap, cmap); ac++; |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1888 Xt_SET_ARG (al[ac], XtNborderWidth, 0); ac++; /* should this be settable? */ |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
1889 Xt_SET_ARG (al[ac], XtNemacsFrame, f); ac++; |
428 | 1890 text = XtCreateWidget (name, emacsFrameClass, container, al, ac); |
1891 FRAME_X_TEXT_WIDGET (f) = text; | |
1892 | |
1893 #ifdef HAVE_MENUBARS | |
1894 /* Create the initial menubar widget. */ | |
1895 menubar_visible = x_initialize_frame_menubar (f); | |
1896 FRAME_X_TOP_WIDGETS (f)[0] = menubar = FRAME_X_MENUBAR_WIDGET (f); | |
1897 FRAME_X_NUM_TOP_WIDGETS (f) = 1; | |
1898 | |
1899 if (menubar_visible) | |
1900 XtManageChild (menubar); | |
1901 #endif /* HAVE_MENUBARS */ | |
1902 XtManageChild (text); | |
1903 XtManageChild (container); | |
1904 } | |
1905 | |
1906 /* We used to call XtPopup() in x_popup_frame, but that doesn't give | |
1907 you control over whether the widget is initially mapped or not | |
1908 because XtPopup() makes an unconditional call to XMapRaised(). | |
1909 Boy, those Xt designers were clever. | |
1910 | |
1911 When we first removed it we only kept the XtRealizeWidget call in | |
1912 XtPopup. For everything except HP's that was enough. For HP's, | |
1913 though, the failure to call the popup callbacks resulted in XEmacs | |
1914 not accepting any input. Bizarre but true. Stupid but true. | |
1915 | |
1916 So, in case there are any other gotchas floating out there along | |
1917 the same lines I've duplicated the majority of XtPopup here. It | |
1918 assumes no grabs and that the widget is not already popped up, both | |
1919 valid assumptions for the one place this is called from. */ | |
1920 static void | |
1921 xemacs_XtPopup (Widget widget) | |
1922 { | |
1923 ShellWidget shell_widget = (ShellWidget) widget; | |
1924 XtGrabKind call_data = XtGrabNone; | |
1925 | |
2367 | 1926 XtCallCallbacks (widget, XtNpopupCallback, (XtPointer) &call_data); |
428 | 1927 |
1928 shell_widget->shell.popped_up = TRUE; | |
1929 shell_widget->shell.grab_kind = XtGrabNone; | |
1930 shell_widget->shell.spring_loaded = False; | |
1931 | |
1932 if (shell_widget->shell.create_popup_child_proc != NULL) | |
2367 | 1933 (*(shell_widget->shell.create_popup_child_proc)) (widget); |
428 | 1934 |
1935 /* The XtSetValues below are not in XtPopup menu. We just want to | |
1936 make absolutely sure... */ | |
1937 Xt_SET_VALUE (widget, XtNmappedWhenManaged, False); | |
1938 XtRealizeWidget (widget); | |
1939 Xt_SET_VALUE (widget, XtNmappedWhenManaged, True); | |
1940 } | |
1941 | |
1942 /* create the windows for the specified frame and display them. | |
1943 Note that the widgets have already been created, and any | |
1944 necessary geometry calculations have already been done. */ | |
1945 static void | |
1946 x_popup_frame (struct frame *f) | |
1947 { | |
1948 Widget shell_widget = FRAME_X_SHELL_WIDGET (f); | |
1949 Widget frame_widget = FRAME_X_TEXT_WIDGET (f); | |
1950 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
1951 | |
1952 /* Before mapping the window, make sure that the WMShell's notion of | |
1953 whether it should be iconified is synchronized with the EmacsFrame's | |
1954 notion. | |
1955 */ | |
1956 if (FRAME_X_TOP_LEVEL_FRAME_P (f)) | |
1957 x_wm_set_shell_iconic_p (shell_widget, | |
1958 ((EmacsFrame) frame_widget) | |
1959 ->emacs_frame.iconic); | |
1960 | |
1961 xemacs_XtPopup (shell_widget); | |
1962 | |
1963 if (!((EmacsFrame) frame_widget)->emacs_frame.initially_unmapped) | |
1964 XtMapWidget (shell_widget); | |
1965 else | |
1966 { | |
1967 /* We may have set f->visible to 1 in x_init_frame(), so undo | |
1968 that now. */ | |
1969 FRAME_X_TOTALLY_VISIBLE_P (f) = 0; | |
1970 f->visible = 0; | |
1971 } | |
1972 | |
1973 #ifdef EXTERNAL_WIDGET | |
1974 if (FRAME_X_EXTERNAL_WINDOW_P (f)) | |
1975 ExternalShellReady (shell_widget, XtWindow (frame_widget), KeyPressMask); | |
1976 else | |
1977 #endif | |
1978 if (FRAME_X_TOP_LEVEL_FRAME_P (f)) | |
1979 { | |
1980 /* tell the window manager about us. */ | |
1981 x_wm_store_class_hints (shell_widget, XtName (frame_widget)); | |
1982 | |
1983 #ifndef HAVE_WMCOMMAND | |
1984 x_wm_maybe_store_wm_command (f); | |
1985 #endif /* HAVE_WMCOMMAND */ | |
1986 | |
1987 x_wm_hack_wm_protocols (shell_widget); | |
1988 } | |
1989 | |
1990 #ifdef HAVE_XIM | |
1991 XIM_init_frame (f); | |
1992 #endif /* HAVE_XIM */ | |
1993 | |
1994 /* Allow XEmacs to respond to EditRes requests. See the O'Reilly Xt */ | |
1995 /* Intrinsics Programming Manual, Motif Edition, Aug 1993, Sect 14.14, */ | |
1996 /* pp. 483-493. */ | |
1997 XtAddEventHandler (shell_widget, /* the shell widget in question */ | |
1998 (EventMask) NoEventMask,/* OR with existing mask */ | |
1999 True, /* called on non-maskable events? */ | |
2000 (XtEventHandler) _XEditResCheckMessages, /* the handler */ | |
2001 NULL); | |
2002 | |
2003 #ifdef HAVE_CDE | |
2004 { | |
2005 XtCallbackRec dnd_transfer_cb_rec[2]; | |
2006 | |
2007 dnd_transfer_cb_rec[0].callback = x_cde_transfer_callback; | |
2008 dnd_transfer_cb_rec[0].closure = (XtPointer) f; | |
2009 dnd_transfer_cb_rec[1].callback = NULL; | |
2010 dnd_transfer_cb_rec[1].closure = NULL; | |
2011 | |
2012 DtDndVaDropRegister (FRAME_X_TEXT_WIDGET (f), | |
2013 DtDND_FILENAME_TRANSFER | DtDND_BUFFER_TRANSFER, | |
2014 XmDROP_COPY, dnd_transfer_cb_rec, | |
2015 DtNtextIsBuffer, True, | |
2016 DtNregisterChildren, True, | |
2017 DtNpreserveRegistration, False, | |
2018 NULL); | |
2019 } | |
2020 #endif /* HAVE_CDE */ | |
2021 | |
2022 /* Do a stupid property change to force the server to generate a | |
2023 propertyNotify event so that the event_stream server timestamp will | |
2024 be initialized to something relevant to the time we created the window. | |
2025 */ | |
2026 XChangeProperty (XtDisplay (frame_widget), XtWindow (frame_widget), | |
2027 DEVICE_XATOM_WM_PROTOCOLS (d), XA_ATOM, 32, PropModeAppend, | |
2367 | 2028 (Rawbyte *) NULL, 0); |
428 | 2029 |
2030 x_send_synthetic_mouse_event (f); | |
2031 } | |
2032 | |
2033 static void | |
2034 allocate_x_frame_struct (struct frame *f) | |
2035 { | |
2036 /* zero out all slots. */ | |
3092 | 2037 #ifdef NEW_GC |
2038 f->frame_data = alloc_lrecord_type (struct x_frame, &lrecord_x_frame); | |
2039 #else /* not NEW_GC */ | |
428 | 2040 f->frame_data = xnew_and_zero (struct x_frame); |
3092 | 2041 #endif /* not NEW_GC */ |
428 | 2042 |
2043 /* yeah, except the lisp ones */ | |
1346 | 2044 FRAME_X_LAST_MENUBAR_BUFFER (f) = Qnil; |
428 | 2045 FRAME_X_ICON_PIXMAP (f) = Qnil; |
2046 FRAME_X_ICON_PIXMAP_MASK (f) = Qnil; | |
2047 } | |
2048 | |
2049 | |
2050 /************************************************************************/ | |
2051 /* Lisp functions */ | |
2052 /************************************************************************/ | |
2053 | |
2054 static void | |
771 | 2055 x_init_frame_1 (struct frame *f, Lisp_Object props, |
2286 | 2056 int UNUSED (frame_name_is_defaulted)) |
428 | 2057 { |
2058 /* This function can GC */ | |
2059 Lisp_Object device = FRAME_DEVICE (f); | |
2060 Lisp_Object lisp_window_id = Fplist_get (props, Qwindow_id, Qnil); | |
2061 Lisp_Object popup = Fplist_get (props, Qpopup, Qnil); | |
2747 | 2062 Lisp_Object overridep = Fplist_get (props, Qoverride_redirect, Qnil); |
428 | 2063 |
2064 if (!NILP (popup)) | |
2065 { | |
2066 if (EQ (popup, Qt)) | |
2067 popup = Fselected_frame (device); | |
2068 CHECK_LIVE_FRAME (popup); | |
2069 if (!EQ (device, FRAME_DEVICE (XFRAME (popup)))) | |
563 | 2070 invalid_argument_2 ("Parent must be on same device as frame", |
2071 device, popup); | |
428 | 2072 } |
2073 | |
2074 /* | |
2075 * Previously we set this only if NILP (DEVICE_SELECTED_FRAME (d)) | |
2076 * to make sure that messages were displayed as soon as possible | |
2077 * if we're creating the first frame on a device. But it is | |
2078 * better to just set this all the time, so that when a new frame | |
2079 * is created that covers the selected frame, echo area status | |
2080 * messages can still be seen. f->visible is reset later if the | |
2081 * initially-unmapped property is found to be non-nil in the | |
2082 * frame properties. | |
2083 */ | |
2084 f->visible = 1; | |
2085 | |
2086 allocate_x_frame_struct (f); | |
2747 | 2087 x_create_widgets (f, lisp_window_id, popup, overridep); |
428 | 2088 } |
2089 | |
2090 static void | |
2286 | 2091 x_init_frame_2 (struct frame *f, Lisp_Object UNUSED (props)) |
428 | 2092 { |
2093 /* Set up the values of the widget/frame. A case could be made for putting | |
2094 this inside of the widget's initialize method. */ | |
2095 | |
2096 update_frame_face_values (f); | |
2097 x_initialize_frame_size (f); | |
2098 /* Kyle: | |
2099 * update_frame_title() can't be done here, because some of the | |
2100 * modeline specs depend on the frame's device having a selected | |
2101 * frame, and that may not have been set up yet. The redisplay | |
2102 * will update the frame title anyway, so nothing is lost. | |
2103 * JV: | |
2104 * It turns out it gives problems with FVWMs name based mapping. | |
2105 * We'll just need to be careful in the modeline specs. | |
2106 */ | |
2107 update_frame_title (f); | |
4593
3623446b34bc
Set icon resource on frame early enough for openbox to find it.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4528
diff
changeset
|
2108 /* Henry S. Thompson: |
3623446b34bc
Set icon resource on frame early enough for openbox to find it.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4528
diff
changeset
|
2109 * Must set icon resource before mapping frame, or some WMs may |
3623446b34bc
Set icon resource on frame early enough for openbox to find it.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4528
diff
changeset
|
2110 * lose the icon (openbox). See <f5bhc3efb17@hildegard.inf.ed.ac.uk>. |
3623446b34bc
Set icon resource on frame early enough for openbox to find it.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4528
diff
changeset
|
2111 * SJT: |
3623446b34bc
Set icon resource on frame early enough for openbox to find it.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4528
diff
changeset
|
2112 * This probably means that the frame-icon library won't work with |
4594 | 2113 * that WM. Late breaking news: it *does* work, so possibly the |
2114 * problem at initialization is due to a race condition. | |
4593
3623446b34bc
Set icon resource on frame early enough for openbox to find it.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4528
diff
changeset
|
2115 */ |
3623446b34bc
Set icon resource on frame early enough for openbox to find it.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4528
diff
changeset
|
2116 update_frame_icon (f); |
428 | 2117 } |
2118 | |
2119 static void | |
2120 x_init_frame_3 (struct frame *f) | |
2121 { | |
2122 /* Pop up the frame. */ | |
2123 | |
2124 x_popup_frame (f); | |
2125 } | |
2126 | |
2127 static void | |
2128 x_mark_frame (struct frame *f) | |
2129 { | |
1346 | 2130 mark_object (FRAME_X_LAST_MENUBAR_BUFFER (f)); |
428 | 2131 mark_object (FRAME_X_ICON_PIXMAP (f)); |
2132 mark_object (FRAME_X_ICON_PIXMAP_MASK (f)); | |
2133 } | |
2134 | |
2135 static void | |
2136 x_set_frame_icon (struct frame *f) | |
2137 { | |
2138 Pixmap x_pixmap, x_mask; | |
2139 | |
2140 if (IMAGE_INSTANCEP (f->icon) | |
2141 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (f->icon))) | |
2142 { | |
2143 x_pixmap = XIMAGE_INSTANCE_X_PIXMAP (f->icon); | |
2144 x_mask = XIMAGE_INSTANCE_X_MASK (f->icon); | |
2145 } | |
2146 else | |
2147 { | |
2148 x_pixmap = 0; | |
2149 x_mask = 0; | |
2150 } | |
2151 | |
2152 /* Store the X data into the widget. */ | |
2153 { | |
2367 | 2154 Arg al[2]; |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2155 Xt_SET_ARG (al[0], XtNiconPixmap, x_pixmap); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2156 Xt_SET_ARG (al[1], XtNiconMask, x_mask); |
428 | 2157 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2); |
2158 } | |
2159 } | |
2160 | |
2161 static void | |
2162 x_set_frame_pointer (struct frame *f) | |
2163 { | |
2164 XDefineCursor (XtDisplay (FRAME_X_TEXT_WIDGET (f)), | |
2165 XtWindow (FRAME_X_TEXT_WIDGET (f)), | |
2166 XIMAGE_INSTANCE_X_CURSOR (f->pointer)); | |
2167 XSync (XtDisplay (FRAME_X_TEXT_WIDGET (f)), 0); | |
2168 } | |
2169 | |
2170 static Lisp_Object | |
2171 x_get_frame_parent (struct frame *f) | |
2172 { | |
2173 Widget parentwid = 0; | |
2174 | |
2175 Xt_GET_VALUE (FRAME_X_SHELL_WIDGET (f), XtNtransientFor, &parentwid); | |
2176 /* find the frame whose wid is parentwid */ | |
2177 if (parentwid) | |
2178 { | |
2179 Lisp_Object frmcons; | |
2180 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f))) | |
2181 { | |
2182 Lisp_Object frame = XCAR (frmcons); | |
2183 if (FRAME_X_SHELL_WIDGET (XFRAME (frame)) == parentwid) | |
2184 return frame; | |
2185 } | |
2186 } | |
2187 return Qnil; | |
2188 } | |
2189 | |
2190 DEFUN ("x-window-id", Fx_window_id, 0, 1, 0, /* | |
2191 Get the ID of the X11 window. | |
2192 This gives us a chance to manipulate the Emacs window from within a | |
2193 different program. Since the ID is an unsigned long, we return it as | |
2194 a string. | |
2195 */ | |
2196 (frame)) | |
2197 { | |
867 | 2198 Ibyte str[255]; |
428 | 2199 struct frame *f = decode_x_frame (frame); |
2200 | |
771 | 2201 qxesprintf (str, "%lu", XtWindow (FRAME_X_TEXT_WIDGET (f))); |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
2202 return build_istring (str); |
428 | 2203 } |
2204 | |
2205 | |
2206 /************************************************************************/ | |
2207 /* manipulating the X window */ | |
2208 /************************************************************************/ | |
2209 | |
2210 static void | |
2211 x_set_frame_position (struct frame *f, int xoff, int yoff) | |
2212 { | |
2213 Widget w = FRAME_X_SHELL_WIDGET (f); | |
2214 Display *dpy = XtDisplay (w); | |
2215 Dimension frame_w = DisplayWidth (dpy, DefaultScreen (dpy)); | |
2216 Dimension frame_h = DisplayHeight (dpy, DefaultScreen (dpy)); | |
2217 Dimension shell_w, shell_h, shell_bord; | |
2218 int win_gravity; | |
2367 | 2219 Arg al[3]; |
2220 | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2221 Xt_SET_ARG (al[0], XtNwidth, &shell_w); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2222 Xt_SET_ARG (al[1], XtNheight, &shell_h); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2223 Xt_SET_ARG (al[2], XtNborderWidth, &shell_bord); |
428 | 2224 XtGetValues (w, al, 3); |
2225 | |
2226 win_gravity = | |
2227 xoff >= 0 && yoff >= 0 ? NorthWestGravity : | |
2228 xoff >= 0 ? SouthWestGravity : | |
2229 yoff >= 0 ? NorthEastGravity : | |
2230 SouthEastGravity; | |
2231 if (xoff < 0) | |
2232 xoff += frame_w - shell_w - 2*shell_bord; | |
2233 if (yoff < 0) | |
2234 yoff += frame_h - shell_h - 2*shell_bord; | |
2235 | |
2236 /* Update the hints so that, if this window is currently iconified, it will | |
2237 come back at the right place. We can't look at s->visible to determine | |
2238 whether it is iconified because it might not be up-to-date yet (the queue | |
2239 might not be processed). */ | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2240 Xt_SET_ARG (al[0], XtNwinGravity, win_gravity); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2241 Xt_SET_ARG (al[1], XtNx, xoff); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2242 Xt_SET_ARG (al[2], XtNy, yoff); |
428 | 2243 XtSetValues (w, al, 3); |
2244 | |
2245 /* Sometimes you will find that | |
2246 | |
2247 (set-frame-position (selected-frame) -50 -50) | |
2248 | |
2249 doesn't put the frame where you expect it to: i.e. it's closer to | |
2250 the lower-right corner than it should be, and it appears that the | |
2251 size of the WM decorations was not taken into account. This is | |
2252 *not* a problem with this function. Both mwm and twm have bugs | |
2253 in handling this situation. (mwm ignores the window gravity and | |
2254 always assumes NorthWest, except the first time you map the | |
2255 window; twm gets things almost right, but forgets to account for | |
2256 the border width of the top-level window.) This function does | |
2257 what it's supposed to according to the ICCCM, and I'm not about | |
2258 to hack around window-manager bugs. */ | |
2259 | |
2260 #if 0 | |
2261 /* This is not necessary under either mwm or twm */ | |
2262 x_wm_mark_shell_position_user_specified (w); | |
2263 #endif | |
2264 } | |
2265 | |
2266 /* Call this to change the size of frame S's x-window. */ | |
2267 | |
2268 static void | |
2269 x_set_frame_size (struct frame *f, int cols, int rows) | |
2270 { | |
2271 EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), cols, rows); | |
3381 | 2272 |
2273 if (!wedge_metacity) /* cf. EmacsFrameResize */ | |
2274 { | |
2275 /* Kick the manager so that it knows we've changed size. */ | |
2276 XtWidgetGeometry req, repl; | |
2277 req.request_mode = 0; | |
2278 XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl); | |
2279 EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), | |
2280 repl.width, repl.height); | |
2281 } | |
2282 | |
428 | 2283 #if 0 |
2284 /* this is not correct. x_set_frame_size() is called from | |
2285 Fset_frame_size(), which may or may not have been called | |
2286 by the user (e.g. update_EmacsFrame() calls it when the font | |
2287 changes). For now, don't bother with getting this right. */ | |
2288 x_wm_mark_shell_size_user_specified (FRAME_X_SHELL_WIDGET (f)); | |
2289 #endif | |
2290 } | |
2291 | |
2292 static void | |
2293 x_set_mouse_position (struct window *w, int x, int y) | |
2294 { | |
2295 struct frame *f = XFRAME (w->frame); | |
2296 | |
2297 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); | |
2298 XWarpPointer (display, None, XtWindow (FRAME_X_TEXT_WIDGET (f)), | |
2299 0, 0, 0, 0, w->pixel_left + x, w->pixel_top + y); | |
2300 } | |
2301 | |
2302 static int | |
2303 x_get_mouse_position (struct device *d, Lisp_Object *frame, int *x, int *y) | |
2304 { | |
2305 Display *display = DEVICE_X_DISPLAY (d); | |
2306 Window child_window; | |
2307 Window root_window; | |
2308 Window win; | |
2309 int root_x, root_y; | |
2310 int win_x, win_y; | |
2311 unsigned int keys_and_buttons; | |
2312 struct frame *f; | |
2313 | |
2314 if (XQueryPointer (display, RootWindow (display, DefaultScreen (display)), | |
2315 &root_window, &child_window, &root_x, &root_y, | |
2316 &win_x, &win_y, &keys_and_buttons) == False) | |
2317 return 0; | |
2318 | |
2319 if (child_window == None) | |
2320 return 0; /* not over any window. */ | |
2321 | |
2322 while (1) | |
2323 { | |
2324 win = child_window; | |
2325 if (XTranslateCoordinates (display, root_window, win, root_x, root_y, | |
2326 &win_x, &win_y, &child_window) == False) | |
2327 /* Huh? */ | |
2328 return 0; | |
2329 | |
2330 if (child_window == None) | |
2331 break; | |
2332 } | |
2333 | |
2334 /* At this point, win is the innermost window containing the pointer | |
2335 and win_x and win_y are the coordinates of that window. */ | |
2336 f = x_any_window_to_frame (d, win); | |
2337 if (!f) | |
2338 return 0; | |
793 | 2339 *frame = wrap_frame (f); |
428 | 2340 |
2341 if (XTranslateCoordinates (display, win, | |
2342 XtWindow (FRAME_X_TEXT_WIDGET (f)), | |
2343 win_x, win_y, x, y, &child_window) == False) | |
2344 /* Huh? */ | |
2345 return 0; | |
2346 | |
2347 return 1; | |
2348 } | |
2349 | |
2268 | 2350 static DECLARE_DOESNT_RETURN (x_cant_notify_wm_error (void)); |
2351 | |
2352 static DOESNT_RETURN | |
2353 x_cant_notify_wm_error () | |
428 | 2354 { |
563 | 2355 signal_error (Qgui_error, "Can't notify window manager of iconification", Qunbound); |
428 | 2356 } |
2357 | |
2358 /* Raise frame F. */ | |
2359 static void | |
2360 x_raise_frame_1 (struct frame *f, int force) | |
2361 { | |
2362 if (FRAME_VISIBLE_P (f) || force) | |
2363 { | |
2364 Widget bottom_dialog; | |
2365 XWindowChanges xwc; | |
2366 unsigned int flags; | |
2367 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); | |
2368 Window emacs_window = XtWindow (FRAME_X_SHELL_WIDGET (f)); | |
2369 | |
2370 /* first raises all the dialog boxes, then put emacs just below the | |
2371 * bottom most dialog box */ | |
2372 bottom_dialog = lw_raise_all_pop_up_widgets (); | |
2373 if (bottom_dialog && XtWindow (bottom_dialog)) | |
2374 { | |
2375 xwc.sibling = XtWindow (bottom_dialog); | |
2376 xwc.stack_mode = Below; | |
2377 flags = CWSibling | CWStackMode; | |
2378 } | |
2379 else | |
2380 { | |
2381 xwc.stack_mode = Above; | |
2382 flags = CWStackMode; | |
2383 } | |
2384 | |
2385 if (!XReconfigureWMWindow (display, emacs_window, | |
2386 DefaultScreen (display), | |
2387 flags, &xwc)) | |
2388 x_cant_notify_wm_error (); | |
2389 } | |
2390 } | |
2391 | |
2392 static void | |
2393 x_raise_frame (struct frame *f) | |
2394 { | |
2395 x_raise_frame_1 (f, 1); | |
2396 } | |
2397 | |
2398 /* Lower frame F. */ | |
2399 static void | |
2400 x_lower_frame (struct frame *f) | |
2401 { | |
2402 if (FRAME_VISIBLE_P (f)) | |
2403 { | |
2404 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); | |
2405 XWindowChanges xwc; | |
2406 unsigned int flags = CWStackMode; | |
2407 | |
2408 xwc.stack_mode = Below; | |
2409 if (!XReconfigureWMWindow (display, XtWindow (FRAME_X_SHELL_WIDGET (f)), | |
2410 DefaultScreen (display), flags, &xwc)) | |
2411 x_cant_notify_wm_error (); | |
2412 } | |
2413 } | |
2414 | |
442 | 2415 static void |
2416 x_enable_frame (struct frame *f) | |
2417 { | |
2418 XtSetSensitive (FRAME_X_SHELL_WIDGET (f), True); | |
2419 } | |
2420 | |
2421 static void | |
2422 x_disable_frame (struct frame *f) | |
2423 { | |
2424 XtSetSensitive (FRAME_X_SHELL_WIDGET (f), False); | |
2425 } | |
2426 | |
428 | 2427 /* Change from withdrawn state to mapped state. */ |
2428 static void | |
2429 x_make_frame_visible (struct frame *f) | |
2430 { | |
2431 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); | |
2432 | |
2433 if (!FRAME_VISIBLE_P(f)) | |
2434 XMapRaised (display, XtWindow (FRAME_X_SHELL_WIDGET (f))); | |
2435 else | |
2436 x_raise_frame_1 (f, 0); | |
2437 } | |
2438 | |
2439 /* Change from mapped state to withdrawn state. */ | |
2440 static void | |
2441 x_make_frame_invisible (struct frame *f) | |
2442 { | |
2443 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); | |
2444 | |
2445 if (!FRAME_VISIBLE_P(f)) | |
2446 return; | |
2447 | |
2448 if (!XWithdrawWindow (display, | |
2449 XtWindow (FRAME_X_SHELL_WIDGET (f)), | |
2450 DefaultScreen (display))) | |
2451 x_cant_notify_wm_error (); | |
2452 } | |
2453 | |
2454 static int | |
2455 x_frame_visible_p (struct frame *f) | |
2456 { | |
2457 #if 0 | |
593 | 2458 |
2459 /* #### Ben suggests using x_frame_window_state (f) == NormalState. */ | |
2460 | |
428 | 2461 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); |
2462 XWindowAttributes xwa; | |
2463 int result; | |
2464 | |
2465 /* JV: | |
2466 This is bad, very bad :-( | |
2467 It is not compatible with our tristate visible and | |
2468 it should never ever change the visibility for us, this leads to | |
2469 the frame-freeze problem under fvwm because with the pager | |
2470 | |
2471 Mappedness != Viewability != Visibility != Emacs f->visible | |
2472 | |
2473 This first unequalness is the reason for the frame freezing problem | |
2474 under fvwm (it happens when the frame is another fvwm-page) | |
2475 | |
2476 The second unequalness happen when it is on the same fvwm-page | |
2477 but in an invisible part of the visible screen. | |
2478 | |
2479 For now we just return the XEmacs internal value --- which might not be up | |
2480 to date. Is that a problem? ---. Otherwise we should | |
2481 use async visibility like in standard Emacs. | |
2482 */ | |
2483 | |
2484 if (!XGetWindowAttributes (display, | |
2485 XtWindow (FRAME_X_SHELL_WIDGET (f)), | |
2486 &xwa)) | |
2487 result = 0; | |
2488 else | |
2489 result = xwa.map_state == IsViewable; | |
2490 /* In this implementation it should at least be != IsUnmapped | |
2491 JV */ | |
2492 | |
2493 f->visible = result; | |
2494 return result; | |
2495 #endif /* 0 */ | |
2496 | |
2497 return f->visible; | |
2498 } | |
2499 | |
2500 static int | |
2501 x_frame_totally_visible_p (struct frame *f) | |
2502 { | |
2503 return FRAME_X_TOTALLY_VISIBLE_P (f); | |
2504 } | |
2505 | |
2506 /* Change window state from mapped to iconified. */ | |
2507 static void | |
2508 x_iconify_frame (struct frame *f) | |
2509 { | |
2510 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); | |
2511 | |
2512 if (!XIconifyWindow (display, | |
2513 XtWindow (FRAME_X_SHELL_WIDGET (f)), | |
2514 DefaultScreen (display))) | |
2515 x_cant_notify_wm_error (); | |
2516 | |
2517 f->iconified = 1; | |
2518 } | |
2519 | |
2520 /* Sets the X focus to frame f. */ | |
2521 static void | |
2522 x_focus_on_frame (struct frame *f) | |
2523 { | |
2524 XWindowAttributes xwa; | |
2525 Widget shell_widget; | |
2526 int viewable = 0; | |
2527 | |
2528 assert (FRAME_X_P (f)); | |
2529 | |
2530 shell_widget = FRAME_X_SHELL_WIDGET (f); | |
2531 if (!XtWindow (shell_widget)) | |
2532 return; | |
2533 | |
2534 #ifdef EXTERNAL_WIDGET | |
2535 if (FRAME_X_EXTERNAL_WINDOW_P (f)) | |
2536 ExternalShellSetFocus (shell_widget); | |
2537 #endif /* EXTERNAL_WIDGET */ | |
2538 | |
2539 /* Do the ICCCM focus change if the window is still visible. | |
2540 The s->visible flag might not be up-to-date, because we might | |
2541 not have processed magic events recently. So make a server | |
2542 round-trip to find out whether it's really mapped right now. | |
2543 We grab the server to do this, because that's the only way to | |
2544 eliminate the race condition. | |
2545 */ | |
2546 XGrabServer (XtDisplay (shell_widget)); | |
2547 if (XGetWindowAttributes (XtDisplay (shell_widget), | |
2548 XtWindow (shell_widget), | |
2549 &xwa)) | |
2550 /* JV: it is bad to change the visibility like this, so we don't for the | |
2551 moment, at least change_frame_visibility should be called | |
2552 Note also that under fvwm a frame can be Viewable (and thus Mapped) | |
2553 but still X-invisible | |
2554 f->visible = xwa.map_state == IsViewable; */ | |
2555 viewable = xwa.map_state == IsViewable; | |
2556 | |
2557 | |
2558 if (viewable) | |
2559 { | |
2560 Window focus; | |
2561 int revert_to; | |
2562 XGetInputFocus (XtDisplay (shell_widget), &focus, &revert_to); | |
2563 /* Don't explicitly set the focus on this window unless the focus | |
2564 was on some other window (not PointerRoot). Note that, even when | |
2565 running a point-to-type window manager like *twm, there is always | |
2566 a focus window; the window manager maintains that based on the | |
2567 mouse position. If you set the "NoTitleFocus" option in these | |
2568 window managers, then the server itself maintains the focus via | |
2569 PointerRoot, and changing that to focus on the window would make | |
2570 the window grab the focus. Very bad. | |
2571 */ | |
2572 if (focus != PointerRoot) | |
2573 { | |
2574 XSetInputFocus (XtDisplay (shell_widget), | |
2575 XtWindow (shell_widget), | |
2576 RevertToParent, | |
4706 | 2577 CurrentTime); |
428 | 2578 XFlush (XtDisplay (shell_widget)); |
2579 } | |
2580 } | |
2581 XUngrabServer (XtDisplay (shell_widget)); | |
2582 XFlush (XtDisplay (shell_widget)); /* hey, I'd like to DEBUG this... */ | |
2583 } | |
2584 | |
450 | 2585 /* Destroy the X window of frame F. */ |
428 | 2586 static void |
2587 x_delete_frame (struct frame *f) | |
2588 { | |
2589 Display *dpy; | |
2590 | |
2591 #ifndef HAVE_WMCOMMAND | |
2592 if (FRAME_X_TOP_LEVEL_FRAME_P (f)) | |
2593 x_wm_maybe_move_wm_command (f); | |
2594 #endif /* HAVE_WMCOMMAND */ | |
2595 | |
2596 #ifdef HAVE_CDE | |
2597 DtDndDropUnregister (FRAME_X_TEXT_WIDGET (f)); | |
2598 #endif /* HAVE_CDE */ | |
2599 | |
4916
a6c778975d7d
split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents:
4790
diff
changeset
|
2600 #ifdef HAVE_XFT |
3094 | 2601 /* If we have an XftDraw structure, we need to free it here. |
2602 We can't ever have an XftDraw without a Display, so we are safe | |
2603 to free it in here, and we avoid too much playing around with the | |
2604 malloc checking hooks this way. */ | |
2605 if (FRAME_X_XFTDRAW (f)) | |
2606 { | |
2607 XftDrawDestroy (FRAME_X_XFTDRAW (f)); | |
2608 FRAME_X_XFTDRAW (f) = NULL; | |
2609 } | |
2610 #endif | |
2611 | |
2612 | |
428 | 2613 assert (FRAME_X_SHELL_WIDGET (f) != 0); |
2614 dpy = XtDisplay (FRAME_X_SHELL_WIDGET (f)); | |
2615 | |
2616 #ifdef EXTERNAL_WIDGET | |
1024 | 2617 expect_x_error (dpy); |
428 | 2618 /* for obscure reasons having (I think) to do with the internal |
2619 window-to-widget hierarchy maintained by Xt, we have to call | |
2620 XtUnrealizeWidget() here. Xt can really suck. */ | |
2621 if (f->being_deleted) | |
2622 XtUnrealizeWidget (FRAME_X_SHELL_WIDGET (f)); | |
2623 XtDestroyWidget (FRAME_X_SHELL_WIDGET (f)); | |
1024 | 2624 x_error_occurred_p (dpy); |
428 | 2625 #else |
2626 XtDestroyWidget (FRAME_X_SHELL_WIDGET (f)); | |
2627 /* make sure the windows are really gone! */ | |
440 | 2628 /* #### Is this REALLY necessary? */ |
428 | 2629 XFlush (dpy); |
2630 #endif /* EXTERNAL_WIDGET */ | |
2631 | |
2632 FRAME_X_SHELL_WIDGET (f) = 0; | |
2633 | |
2634 if (FRAME_X_GEOM_FREE_ME_PLEASE (f)) | |
2635 { | |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
2636 xfree (FRAME_X_GEOM_FREE_ME_PLEASE (f)); |
428 | 2637 FRAME_X_GEOM_FREE_ME_PLEASE (f) = 0; |
2638 } | |
2639 | |
2640 if (f->frame_data) | |
2641 { | |
4117 | 2642 #ifndef NEW_GC |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4969
diff
changeset
|
2643 xfree (f->frame_data); |
3092 | 2644 #endif /* not NEW_GC */ |
428 | 2645 f->frame_data = 0; |
2646 } | |
2647 } | |
2648 | |
2649 static void | |
2367 | 2650 x_update_frame_external_traits (struct frame *frm, Lisp_Object name) |
428 | 2651 { |
2652 Arg al[10]; | |
2653 int ac = 0; | |
793 | 2654 Lisp_Object frame = wrap_frame (frm); |
2655 | |
428 | 2656 |
2657 if (EQ (name, Qforeground)) | |
2658 { | |
2659 Lisp_Object color = FACE_FOREGROUND (Vdefault_face, frame); | |
2660 XColor fgc; | |
2661 | |
2662 if (!EQ (color, Vthe_null_color_instance)) | |
2663 { | |
2664 fgc = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (color)); | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2665 Xt_SET_ARG (al[ac], XtNforeground, (void *) fgc.pixel); ac++; |
428 | 2666 } |
2667 } | |
2668 else if (EQ (name, Qbackground)) | |
2669 { | |
2670 Lisp_Object color = FACE_BACKGROUND (Vdefault_face, frame); | |
2671 XColor bgc; | |
2672 | |
2673 if (!EQ (color, Vthe_null_color_instance)) | |
2674 { | |
2675 bgc = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (color)); | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2676 Xt_SET_ARG (al[ac], XtNbackground, (void *) bgc.pixel); ac++; |
428 | 2677 } |
2678 | |
2679 /* Really crappy way to force the modeline shadows to be | |
2680 redrawn. But effective. */ | |
2681 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (frm); | |
2682 MARK_FRAME_CHANGED (frm); | |
2683 } | |
2684 else if (EQ (name, Qfont)) | |
2685 { | |
2686 Lisp_Object font = FACE_FONT (Vdefault_face, frame, Vcharset_ascii); | |
2687 | |
3676 | 2688 /* It may be that instantiating the font has deleted the frame (will |
2689 happen if the user has specified a charset registry for ASCII that | |
2690 isn't available on the server, and our fallback of iso8859-1 isn't | |
2691 available; something vanishingly rare.) In that case, return from | |
2692 this function without further manipulation of the dead frame. */ | |
2693 | |
2694 if (!FRAME_LIVE_P(frm)) | |
2695 { | |
2696 return; | |
2697 } | |
2698 | |
3094 | 2699 /* #### what to do about Xft? I don't think the font is actually used |
2700 to compute cell size for computing frame pixel dimensions (see call | |
2701 to EmacsFrameRecomputeCellSize() below); where is it used? -- sjt | |
2702 What does XtSetValues() do if that resource isn't present? */ | |
428 | 2703 if (!EQ (font, Vthe_null_font_instance)) |
1746 | 2704 { |
3094 | 2705 if (0) |
2706 ; | |
4916
a6c778975d7d
split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents:
4790
diff
changeset
|
2707 #ifdef HAVE_XFT |
3094 | 2708 else if (FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))) |
2709 { | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2710 Xt_SET_ARG (al[ac], XtNxftFont, |
3094 | 2711 (void *) FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))); |
2712 ac++; | |
2713 } | |
2714 #endif | |
2715 else if (FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font))) | |
2716 { | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2717 Xt_SET_ARG (al[ac], XtNfont, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
2718 (void *) FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font))); |
3094 | 2719 ac++; |
2720 } | |
1746 | 2721 } |
428 | 2722 } |
2723 else | |
2500 | 2724 ABORT (); |
428 | 2725 |
2726 XtSetValues (FRAME_X_TEXT_WIDGET (frm), al, ac); | |
2727 | |
2728 #ifdef HAVE_TOOLBARS | |
2729 /* Setting the background clears the entire frame area | |
2730 including the toolbar so we force an immediate redraw of | |
2731 it. */ | |
2732 if (EQ (name, Qbackground)) | |
2733 MAYBE_DEVMETH (XDEVICE (frm->device), redraw_frame_toolbars, (frm)); | |
2734 #endif /* HAVE_TOOLBARS */ | |
2735 | |
2736 /* Set window manager resize increment hints according to | |
2737 the new character size */ | |
2738 if (EQ (name, Qfont)) | |
2739 EmacsFrameRecomputeCellSize (FRAME_X_TEXT_WIDGET (frm)); | |
2740 } | |
2741 | |
2742 | |
2743 /************************************************************************/ | |
2744 /* initialization */ | |
2745 /************************************************************************/ | |
2746 | |
2747 void | |
2748 syms_of_frame_x (void) | |
2749 { | |
3092 | 2750 #ifdef NEW_GC |
2751 INIT_LRECORD_IMPLEMENTATION (x_frame); | |
2752 #endif /* NEW_GC */ | |
2753 | |
2747 | 2754 DEFSYMBOL (Qoverride_redirect); |
563 | 2755 DEFSYMBOL (Qx_resource_name); |
428 | 2756 |
2757 DEFSUBR (Fx_window_id); | |
2758 #ifdef HAVE_CDE | |
2759 DEFSUBR (Fcde_start_drag_internal); | |
2760 #endif | |
2761 } | |
2762 | |
2763 void | |
2764 console_type_create_frame_x (void) | |
2765 { | |
2766 /* frame methods */ | |
2767 CONSOLE_HAS_METHOD (x, init_frame_1); | |
2768 CONSOLE_HAS_METHOD (x, init_frame_2); | |
2769 CONSOLE_HAS_METHOD (x, init_frame_3); | |
2770 CONSOLE_HAS_METHOD (x, mark_frame); | |
2771 CONSOLE_HAS_METHOD (x, focus_on_frame); | |
2772 CONSOLE_HAS_METHOD (x, delete_frame); | |
2773 CONSOLE_HAS_METHOD (x, get_mouse_position); | |
2774 CONSOLE_HAS_METHOD (x, set_mouse_position); | |
2775 CONSOLE_HAS_METHOD (x, raise_frame); | |
2776 CONSOLE_HAS_METHOD (x, lower_frame); | |
442 | 2777 CONSOLE_HAS_METHOD (x, enable_frame); |
2778 CONSOLE_HAS_METHOD (x, disable_frame); | |
428 | 2779 CONSOLE_HAS_METHOD (x, make_frame_visible); |
2780 CONSOLE_HAS_METHOD (x, make_frame_invisible); | |
2781 CONSOLE_HAS_METHOD (x, iconify_frame); | |
2782 CONSOLE_HAS_METHOD (x, set_frame_size); | |
2783 CONSOLE_HAS_METHOD (x, set_frame_position); | |
2784 CONSOLE_HAS_METHOD (x, frame_property); | |
2785 CONSOLE_HAS_METHOD (x, internal_frame_property_p); | |
2786 CONSOLE_HAS_METHOD (x, frame_properties); | |
2787 CONSOLE_HAS_METHOD (x, set_frame_properties); | |
867 | 2788 CONSOLE_HAS_METHOD (x, set_title_from_ibyte); |
2789 CONSOLE_HAS_METHOD (x, set_icon_name_from_ibyte); | |
428 | 2790 CONSOLE_HAS_METHOD (x, frame_visible_p); |
2791 CONSOLE_HAS_METHOD (x, frame_totally_visible_p); | |
2792 CONSOLE_HAS_METHOD (x, frame_iconified_p); | |
2793 CONSOLE_HAS_METHOD (x, set_frame_pointer); | |
2794 CONSOLE_HAS_METHOD (x, set_frame_icon); | |
2795 CONSOLE_HAS_METHOD (x, get_frame_parent); | |
2796 CONSOLE_HAS_METHOD (x, update_frame_external_traits); | |
2797 } | |
2798 | |
2799 void | |
2800 vars_of_frame_x (void) | |
2801 { | |
2802 #ifdef EXTERNAL_WIDGET | |
2803 Fprovide (intern ("external-widget")); | |
2804 #endif | |
2805 | |
2806 /* this call uses only safe functions from emacs.c */ | |
2807 init_x_prop_symbols (); | |
2808 | |
2809 DEFVAR_LISP ("default-x-frame-plist", &Vdefault_x_frame_plist /* | |
2810 Plist of default frame-creation properties for X frames. | |
2811 These override what is specified in the resource database and in | |
2812 `default-frame-plist', but are overridden by the arguments to the | |
2813 particular call to `make-frame'. | |
2814 | |
2815 Note: In many cases, properties of a frame are available as specifiers | |
2816 instead of through the frame-properties mechanism. | |
2817 | |
2818 Here is a list of recognized frame properties, other than those | |
2819 documented in `set-frame-properties' (they can be queried and | |
2820 set at any time, except as otherwise noted): | |
2821 | |
2822 window-id The X window ID corresponding to the | |
2823 frame. May be set only at startup, and | |
2824 only if external widget support was | |
2825 compiled in; doing so causes the frame | |
2826 to be created as an "external widget" | |
2827 in another program that uses an existing | |
2828 window in the program rather than creating | |
2829 a new one. | |
2830 initially-unmapped If non-nil, the frame will not be visible | |
2831 when it is created. In this case, you | |
2832 need to call `make-frame-visible' to make | |
2833 the frame appear. | |
2834 popup If non-nil, it should be a frame, and this | |
2835 frame will be created as a "popup" frame | |
2836 whose parent is the given frame. This | |
2837 will make the window manager treat the | |
2838 frame as a dialog box, which may entail | |
2839 doing different things (e.g. not asking | |
2840 for positioning, and not iconifying | |
2841 separate from its parent). | |
2747 | 2842 override-redirect If non-nil, the frame will not be subject to |
2843 window-manager control. In particular, it | |
2844 will lack decorations, for more attractive | |
2845 appearance of balloon help, aka tooltips. | |
428 | 2846 inter-line-space Not currently implemented. |
2847 toolbar-shadow-thickness Thickness of toolbar shadows. | |
2848 background-toolbar-color Color of toolbar background. | |
2849 bottom-toolbar-shadow-color Color of bottom shadows on toolbars. | |
2850 (*Not* specific to the bottom-toolbar.) | |
2851 top-toolbar-shadow-color Color of top shadows on toolbars. | |
2852 (*Not* specific to the top-toolbar.) | |
2853 internal-border-width Width of internal border around text area. | |
2854 border-width Width of external border around text area. | |
2855 top Y position (in pixels) of the upper-left | |
2856 outermost corner of the frame (i.e. the | |
2857 upper-left of the window-manager | |
2858 decorations). | |
2859 left X position (in pixels) of the upper-left | |
2860 outermost corner of the frame (i.e. the | |
2861 upper-left of the window-manager | |
2862 decorations). | |
2863 border-color Color of external border around text area. | |
2864 cursor-color Color of text cursor. | |
2865 | |
2866 See also `default-frame-plist', which specifies properties which apply | |
2867 to all frames, not just X frames. | |
2868 */ ); | |
2869 Vdefault_x_frame_plist = Qnil; | |
2870 | |
2871 x_console_methods->device_specific_frame_props = &Vdefault_x_frame_plist; | |
2872 } |