annotate src/EmacsShell-sub.c @ 853:2b6fa2618f76

[xemacs-hg @ 2002-05-28 08:44:22 by ben] merge my stderr-proc ws make-docfile.c: Fix places where we forget to check for EOF. code-init.el: Don't use CRLF conversion by default on process output. CMD.EXE and friends work both ways but Cygwin programs don't like the CRs. code-process.el, multicast.el, process.el: Removed. Improvements to call-process-internal: -- allows a buffer to be specified for input and stderr output -- use it on all systems -- implement C-g as documented -- clean up and comment call-process-region uses new call-process facilities; no temp file. remove duplicate funs in process.el. comment exactly how coding systems work and fix various problems. open-multicast-group now does similar coding-system frobbing to open-network-stream. dumped-lisp.el, faces.el, msw-faces.el: Fix some hidden errors due to code not being defined at the right time. xemacs.mak: Add -DSTRICT. ================================================================ ALLOW SEPARATION OF STDOUT AND STDERR IN PROCESSES ================================================================ Standard output and standard error can be processed separately in a process. Each can have its own buffer, its own mark in that buffer, and its filter function. You can specify a separate buffer for stderr in `start-process' to get things started, or use the new primitives: set-process-stderr-buffer process-stderr-buffer process-stderr-mark set-process-stderr-filter process-stderr-filter Also, process-send-region takes a 4th optional arg, a buffer. Currently always uses a pipe() under Unix to read the error output. (#### Would a PTY be better?) sysdep.h, sysproc.h, unexfreebsd.c, unexsunos4.c, nt.c, emacs.c, callproc.c, symsinit.h, sysdep.c, Makefile.in.in, process-unix.c: Delete callproc.c. Move child_setup() to process-unix.c. wait_for_termination() now only needed on a few really old systems. console-msw.h, event-Xt.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.h, process-nt.c, process-unix.c, process.c, process.h, procimpl.h: Rewrite the process methods to handle a separate channel for error input. Create Lstreams for reading in the error channel. Many process methods need change. In general the changes are fairly clear as they involve duplicating what's used for reading the normal stdout and changing for stderr -- although tedious, as such changes are required throughout the entire process code. Rewrote the code that reads process output to do two loops, one for stdout and one for stderr. gpmevent.c, tooltalk.c: set_process_filter takes an argument for stderr. ================================================================ NEW ERROR-TRAPPING MECHANISM ================================================================ Totally rewrite error trapping code to be unified and support more features. Basic function is call_trapping_problems(), which lets you specify, by means of flags, what sorts of problems you want trapped. these can include -- quit -- errors -- throws past the function -- creation of "display objects" (e.g. buffers) -- deletion of already-existing "display objects" (e.g. buffers) -- modification of already-existing buffers -- entering the debugger -- gc -- errors->warnings (ala suspended errors) etc. All other error funs rewritten in terms of this one. Various older mechanisms removed or rewritten. window.c, insdel.c, console.c, buffer.c, device.c, frame.c: When creating a display object, added call to note_object_created(), for use with trapping_problems mechanism. When deleting, call check_allowed_operation() and note_object deleted(). The trapping-problems code records the objects created since the call-trapping-problems began. Those objects can be deleted, but none others (i.e. previously existing ones). bytecode.c, cmdloop.c: internal_catch takes another arg. eval.c: Add long comments describing the "five lists" used to maintain state (backtrace, gcpro, specbind, etc.) in the Lisp engine. backtrace.h, eval.c: Implement trapping-problems mechanism, eliminate old mechanisms or redo in terms of new one. frame.c, gutter.c: Flush out the concept of "critical display section", defined by the in_display() var. Use an internal_bind() to get it reset, rather than just doing it at end, because there may be a non-local exit. event-msw.c, event-stream.c, console-msw.h, device.c, dialog-msw.c, frame.c, frame.h, intl.c, toolbar.c, menubar-msw.c, redisplay.c, alloc.c, menubar-x.c: Make use of new trapping-errors stuff and rewrite code based on old mechanisms. glyphs-widget.c, redisplay.h: Protect calling Lisp in redisplay. insdel.c: Protect hooks against deleting existing buffers. frame-msw.c: Use EQ, not EQUAL in hash tables whose keys are just numbers. Otherwise we run into stickiness in redisplay because internal_equal() can QUIT. ================================================================ SIGNAL, C-G CHANGES ================================================================ Here we change the way that C-g interacts with event reading. The idea is that a C-g occurring while we're reading a user event should be read as C-g, but elsewhere should be a QUIT. The former code did all sorts of bizarreness -- requiring that no QUIT occurs anywhere in event-reading code (impossible to enforce given the stuff called or Lisp code invoked), and having some weird system involving enqueue/dequeue of a C-g and interaction with Vquit_flag -- and it didn't work. Now, we simply enclose all code where we want C-g read as an event with {begin/end}_dont_check_for_quit(). This completely turns off the mechanism that checks (and may remove or alter) C-g in the read-ahead queues, so we just get the C-g normal. Signal.c documents this very carefully. cmdloop.c: Correct use of dont_check_for_quit to new scheme, remove old out-of-date comments. event-stream.c: Fix C-g handling to actually work. device-x.c: Disable quit checking when err out. signal.c: Cleanup. Add large descriptive comment. process-unix.c, process-nt.c, sysdep.c: Use QUIT instead of REALLY_QUIT. It's not necessary to use REALLY_QUIT and just confuses the issue. lisp.h: Comment quit handlers. ================================================================ CONS CHANGES ================================================================ free_cons() now takes a Lisp_Object not the result of XCONS(). car and cdr have been renamed so that they don't get used directly; go through XCAR(), XCDR() instead. alloc.c, dired.c, editfns.c, emodules.c, fns.c, glyphs-msw.c, glyphs-x.c, glyphs.c, keymap.c, minibuf.c, search.c, eval.c, lread.c, lisp.h: Correct free_cons calling convention: now takes Lisp_Object, not Lisp_Cons chartab.c: Eliminate direct use of ->car, ->cdr, should be black box. callint.c: Rewrote using EXTERNAL_LIST_LOOP to avoid use of Lisp_Cons. ================================================================ USE INTERNAL-BIND-* ================================================================ eval.c: Cleanups of these funs. alloc.c, fileio.c, undo.c, specifier.c, text.c, profile.c, lread.c, redisplay.c, menubar-x.c, macros.c: Rewrote to use internal_bind_int() and internal_bind_lisp_object() in place of whatever varied and cumbersome mechanisms were formerly there. ================================================================ SPECBIND SANITY ================================================================ backtrace.h: - Improved comments backtrace.h, bytecode.c, eval.c: Add new mechanism check_specbind_stack_sanity() for sanity checking code each time the catchlist or specbind stack change. Removed older prototype of same mechanism. ================================================================ MISC ================================================================ lisp.h, insdel.c, window.c, device.c, console.c, buffer.c: Fleshed out authorship. device-msw.c: Correct bad Unicode-ization. print.c: Be more careful when not initialized or in fatal error handling. search.c: Eliminate running_asynch_code, an FSF holdover. alloc.c: Added comments about gc-cons-threshold. dialog-x.c: Use begin_gc_forbidden() around code to build up a widget value tree, like in menubar-x.c. gui.c: Use Qunbound not Qnil as the default for gethash. lisp-disunion.h, lisp-union.h: Added warnings on use of VOID_TO_LISP(). lisp.h: Use ERROR_CHECK_STRUCTURES to turn on ERROR_CHECK_TRAPPING_PROBLEMS and ERROR_CHECK_TYPECHECK lisp.h: Add assert_with_message. lisp.h: Add macros for gcproing entire arrays. (You could do this before but it required manual twiddling the gcpro structure.) lisp.h: Add prototypes for new functions defined elsewhere.
author ben
date Tue, 28 May 2002 08:45:36 +0000
parents 8de8e3f6228a
children 8c5cf108f035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Emacs shell widget -- define the two widgets.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /* Written by Ben Wing, May, 1994. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 It is rather unfortunate that we have to do this. Blame those
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 short-sighted people who designed the monstrosities known as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 Xt and ICCCM.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 This widget is not actually Emacs-specific; perhaps there could
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 be a better name than "EmacsShell". What it does is work around
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 a limitation in Xt in correctly dealing with the window-manager
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 size hints with applications that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 (a) dynamically change their window size
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 (b) have a cell size (width-inc and height-inc) other than 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 (c) cannot predict in advance exactly what size their shell will be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 (This is the more common situation, when you have a number
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 of widgets, each with their own size ideas)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 This widget assumes that your program contains a fixed "base size"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 plus some number of cells (e.g. character cells). The WMShell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 resources "widthInc" and "heightInc" specify the size of a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 character cell, and the window manager will report the app's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 size in cells rather than in pixels.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 If you use this widget, do not use the WMShell resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 "baseWidth", "baseHeight", "minWidth", or "minHeight".
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 Instead, use "widthCells" and "heightCells" to specify the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 current size in cells (you must keep this up-to-date),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 and "minWidthCells" and "minHeightCells" to specify the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 minimum size in cells.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 Every time that the program issues a size command, the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 "baseWidth", "baseHeight", "minWidth", and "minHeight" fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 of the WM_NORMAL_HINTS property will be updated to stay in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 line with the resource values specified above. The calculations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 are done once the desired shell size is known but before the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 window-manager size-change request is issued. (We must do it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 at this time because before then we don't know what size we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 will request, and after the request the deed has already
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 been done.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 After you change the "baseWidth", "baseHeight", "minWidth",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 or "minHeight" resources, you need to call
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 EmacsShellUpdateSizeHints() to manually update the size
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 hints, except in the following two circumstances:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 (a) you are about to make a geometry request.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 (b) you are changing only "baseWidth" and "baseHeight"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 from within a resize procedure. (In this case,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 the size hints are already correct.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 #include <stdlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 #include <X11/StringDefs.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 #include "xintrinsicp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 #include <X11/Shell.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 #include <X11/ShellP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 #include <X11/Vendor.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 #include <X11/VendorP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 #include "EmacsShellP.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 #if defined (DEFINE_TOP_LEVEL_EMACS_SHELL)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 #define EMACS_SHELL_WIDGET TopLevelEmacsShellWidget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 #define SUPERCLASS_WIDGET_CLASS topLevelShellWidgetClass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 #define SUPERCLASS_CLASS_REC topLevelShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 #define EMACS_SHELL_REC TopLevelEmacsShellRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 #define EMACS_SHELL_CLASS_REC topLevelEmacsShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 #define EMACS_SHELL_CLASS_REC_TYPE TopLevelEmacsShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #define EMACS_SHELL_CLASS_NAME "TopLevelEmacsShell"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 #define EMACS_SHELL_WIDGET_CLASS topLevelEmacsShellWidgetClass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 #define EMACS_SHELL_UPDATE_SIZE_HINTS TopLevelEmacsShellUpdateSizeHints
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 #elif defined (DEFINE_TRANSIENT_EMACS_SHELL)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 #define EMACS_SHELL_WIDGET TransientEmacsShellWidget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #define SUPERCLASS_WIDGET_CLASS transientShellWidgetClass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 #define SUPERCLASS_CLASS_REC transientShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 #define EMACS_SHELL_REC TransientEmacsShellRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 #define EMACS_SHELL_CLASS_REC transientEmacsShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 #define EMACS_SHELL_CLASS_REC_TYPE TransientEmacsShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 #define EMACS_SHELL_CLASS_NAME "TransientEmacsShell"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 #define EMACS_SHELL_WIDGET_CLASS transientEmacsShellWidgetClass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 #define EMACS_SHELL_UPDATE_SIZE_HINTS TransientEmacsShellUpdateSizeHints
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 Error. Must define either DEFINE_TOP_LEVEL_EMACS_SHELL or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 DEFINE_TRANSIENT_EMACS_SHELL.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 typedef struct {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 XtPointer next_extension;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 XrmQuark record_type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 long version;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 Cardinal record_size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 } GenericClassExtRec;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 static XtGeometryResult RootGeometryManager (Widget gw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 XtWidgetGeometry *request, XtWidgetGeometry *reply);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 static void ChangeManaged (Widget w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 /* snarfed from Shell.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 #define BIGSIZE ((Dimension)32767)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 static XtResource resources[] = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 #define offset(field) XtOffset(EMACS_SHELL_WIDGET, emacs_shell.field)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 #define coreoffset(field) XtOffset(EMACS_SHELL_WIDGET, core.field)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 /* *** BOGOSITY^10! *** The Motif VendorShell fucks around with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 the default values for X and Y, for no obvious reason. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 causes Shell to indicate that the defaults of (0,0) were
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 program-specified, instead of letting the WM do what it wants. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
140 { XtNx, XtCPosition,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
141 XtRPosition, sizeof (Position),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
142 coreoffset (x), XtRImmediate, (XtPointer)BIGSIZE },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
143 { XtNy, XtCPosition,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
144 XtRPosition, sizeof (Position),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
145 coreoffset (y), XtRImmediate, (XtPointer)BIGSIZE },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
147 { XtNwidthCells, XtCWidthCells,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
148 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
149 offset (width_cells), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
150 { XtNheightCells, XtCHeightCells,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
151 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
152 offset (height_cells), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
153 { XtNminWidthCells, XtCMinWidthCells,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
154 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
155 offset (min_width_cells), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
156 { XtNminHeightCells, XtCMinHeightCells,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
157 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
158 offset (min_height_cells), XtRImmediate, (XtPointer)0 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 static CompositeClassExtensionRec compositeClassExtRec = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 XtCompositeExtensionVersion,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
165 sizeof (CompositeClassExtensionRec),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 static ShellClassExtensionRec shellClassExtRec = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 XtShellExtensionVersion,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
173 sizeof (ShellClassExtensionRec),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 RootGeometryManager
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 EMACS_SHELL_CLASS_REC_TYPE EMACS_SHELL_CLASS_REC = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 { /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 * core_class fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 /* superclass */ (WidgetClass) &SUPERCLASS_CLASS_REC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 /* class_name */ (String) EMACS_SHELL_CLASS_NAME,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
183 /* size */ sizeof (EMACS_SHELL_REC),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 /* Class Initializer */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 /* class_part_initialize*/ NULL, /* XtInheritClassPartInitialize, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 /* Class init'ed ? */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 /* initialize */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 /* initialize_notify */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 /* realize */ XtInheritRealize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 /* actions */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 /* num_actions */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 /* resources */ resources,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 /* resource_count */ XtNumber (resources),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 /* xrm_class */ NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 /* compress_motion */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 /* compress_exposure */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 /* compress_enterleave*/ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 /* visible_interest */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 /* destroy */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 /* resize */ XtInheritResize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 /* expose */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 /* set_values */ NULL, /* XtInheritSetValues, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 /* set_values_hook */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 /* set_values_almost */ XtInheritSetValuesAlmost,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 /* get_values_hook */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 /* accept_focus */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 /* intrinsics version */ XtVersion,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 /* callback offsets */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 /* tm_table */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 /* query_geometry */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 /* display_accelerator*/ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 },{ /* Composite */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 /* geometry_manager */ XtInheritGeometryManager,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 /* change_managed */ ChangeManaged,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 /* insert_child */ XtInheritInsertChild,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 /* delete_child */ XtInheritDeleteChild,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 /* extension */ (XtPointer)&compositeClassExtRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 },{ /* Shell */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 /* extension */ (XtPointer)&shellClassExtRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 },{ /* WMShell */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 },{ /* VendorShell */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 },{ /* TopLevelShell or TransientShell */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 /* both have exactly one XtPointer here. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 },{ /* EmacsShell */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 WidgetClass EMACS_SHELL_WIDGET_CLASS = (WidgetClass) &EMACS_SHELL_CLASS_REC;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 update_size_hints_internal (EMACS_SHELL_WIDGET w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 int width, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 int base_width, base_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 int cell_width, cell_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 Arg al [10];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 /* time to update them thar size hints */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 cell_width = w->wm.size_hints.width_inc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 cell_height = w->wm.size_hints.height_inc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 base_width = width - cell_width * w->emacs_shell.width_cells;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 base_height = height - cell_height * w->emacs_shell.height_cells;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 #ifdef DEBUG_GEOMETRY_MANAGEMENT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 /* Very useful info when debugging geometry management problems.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 When it's guaranteed that no more such problems exist, take
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 this stuff out. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 printf ("update_size_hints_internal:\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 printf (" actual pixel size: %d %d\n", width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 printf (" cell size in pixels: %d %d\n", cell_width, cell_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 printf (" text area size in cells: %d %d\n", w->emacs_shell.width_cells,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 w->emacs_shell.height_cells);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 printf (" base size set to: %d %d\n", base_width, base_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 fflush (stdout);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 XtSetArg(al [0], XtNbaseWidth, base_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 XtSetArg(al [1], XtNbaseHeight, base_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 XtSetArg(al [2], XtNminWidth, base_width +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 cell_width * w->emacs_shell.min_width_cells);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 XtSetArg(al [3], XtNminHeight, base_height +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 cell_height * w->emacs_shell.min_height_cells);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 XtSetValues ((Widget) w, al, 4);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 static XtGeometryResult
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 SuperClassRootGeometryManager (Widget gw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 XtWidgetGeometry *request,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 XtWidgetGeometry *reply)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 ShellWidgetClass swc = (ShellWidgetClass) SUPERCLASS_WIDGET_CLASS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 ShellClassExtensionRec *scer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 GenericClassExtRec *gcer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 /* find the shell extension record that specifies the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 root geometry manager method */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 for (gcer = (GenericClassExtRec *) swc->shell_class.extension;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 gcer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 gcer = (GenericClassExtRec *) gcer->next_extension)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 if (gcer->record_type == NULLQUARK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 if (!gcer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 /* call it to actually make the geometry request */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 scer = (ShellClassExtensionRec *) gcer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 return (scer->root_geometry_manager)(gw, request, reply);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 static XtGeometryResult
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 RootGeometryManager (Widget gw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 XtWidgetGeometry *request,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 XtWidgetGeometry *reply)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 EMACS_SHELL_WIDGET w = (EMACS_SHELL_WIDGET) gw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 /* OK since this file is not dumped */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 static int reentrant = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 XtGeometryResult result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 if (reentrant)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 reentrant++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 #ifdef DEBUG_GEOMETRY_MANAGEMENT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 printf ("root_geometry_manager:\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 printf (" current shell size: %d %d\n", w->core.width, w->core.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 if (request->request_mode & CWWidth)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 printf ("width requested;");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 if (request->request_mode & CWHeight)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 printf ("height requested;");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 printf ("\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 printf (" requested shell size: %d %d\n", request->width, request->height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 /* update the size hints */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 update_size_hints_internal (w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 request->request_mode & CWWidth ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 request->width : w->core.width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 request->request_mode & CWHeight ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 request->height : w->core.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 result = SuperClassRootGeometryManager (gw, request, reply);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 #ifdef DEBUG_GEOMETRY_MANAGEMENT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 printf (" result: %s\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 result == XtGeometryYes ? "XtGeometryYes" :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 result == XtGeometryNo ? "XtGeometryNo" :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 result == XtGeometryAlmost ? "XtGeometryAlmost" :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 "XtGeometryDone");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 if (reply->request_mode & CWWidth)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 printf ("width returned;");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 if (reply->request_mode & CWHeight)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 printf ("height returned;");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 printf ("\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 printf (" resulting shell size: %d %d\n", reply->width, reply->height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 printf ("----------\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 fflush (stdout);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 reentrant--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 return result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 ChangeManaged (Widget wid)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 EMACS_SHELL_WIDGET w = (EMACS_SHELL_WIDGET) wid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 /* If not realized, then we're being called from XtRealizeWidget().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 RootGeometryManager() has not yet been called, and thus our
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 base size is incorrect. We need to set it now or the Shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 will mess up geometry specifications with negative positional
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 offsets. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 if (!XtIsRealized (wid))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 Widget child = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 Cardinal i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 /* the managed child indicates what our size is */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 for (i = 0; i < w->composite.num_children; i++) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 if (XtIsManaged(w->composite.children[i])) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 child = w->composite.children[i];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 update_size_hints_internal (w, child->core.width, child->core.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 /* call the real ChangeManaged */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 (((ShellWidgetClass) SUPERCLASS_WIDGET_CLASS)->
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 composite_class.change_managed)(wid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 /******************* external entry points *********************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 EMACS_SHELL_UPDATE_SIZE_HINTS (Widget gw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 EMACS_SHELL_WIDGET w = (EMACS_SHELL_WIDGET) gw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 update_size_hints_internal (w, w->core.width, w->core.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 }