annotate src/EmacsShell-sub.c @ 5915:1af53d35dd53

Avoid allocation in #'integer-length; add #'logcount. lisp/ChangeLog addition: 2015-05-29 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (side-effect-free-fns): Add #'integer-length, #'logcount here. * cl-extra.el: * cl-extra.el (integer-length): Update this to avoid allocating memory. * cl-extra.el (logcount): New. Return the number of one bits in INTEGER, if non-negative. Function from Common Lisp. tests/ChangeLog addition: 2015-05-29 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Test #'integer-length, #'logcount in this file.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 29 May 2015 17:06:24 +0100
parents 308d34e9f07d
children
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
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4528
diff changeset
6 XEmacs is free software: you can redistribute it and/or modify it
428
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
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4528
diff changeset
8 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4528
diff changeset
9 option) any later version.
428
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
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4528
diff changeset
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 /* Synched up with: Not in FSF. */
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 /* Written by Ben Wing, May, 1994. */
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 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 It is rather unfortunate that we have to do this. Blame those
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 short-sighted people who designed the monstrosities known as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 Xt and ICCCM.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
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 This widget is not actually Emacs-specific; perhaps there could
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 be a better name than "EmacsShell". What it does is work around
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 a limitation in Xt in correctly dealing with the window-manager
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 size hints with applications that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 (a) dynamically change their window size
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 (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
37
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 and
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 (c) cannot predict in advance exactly what size their shell will be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 (This is the more common situation, when you have a number
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 of widgets, each with their own size ideas)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 This widget assumes that your program contains a fixed "base size"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 plus some number of cells (e.g. character cells). The WMShell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 resources "widthInc" and "heightInc" specify the size of a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 character cell, and the window manager will report the app's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 size in cells rather than in pixels.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 If you use this widget, do not use the WMShell resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 "baseWidth", "baseHeight", "minWidth", or "minHeight".
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 Instead, use "widthCells" and "heightCells" to specify the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 current size in cells (you must keep this up-to-date),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 and "minWidthCells" and "minHeightCells" to specify the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 minimum size in cells.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 Every time that the program issues a size command, the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 "baseWidth", "baseHeight", "minWidth", and "minHeight" fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 of the WM_NORMAL_HINTS property will be updated to stay in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 line with the resource values specified above. The calculations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 are done once the desired shell size is known but before the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 window-manager size-change request is issued. (We must do it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 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
64 will request, and after the request the deed has already
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 been done.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 After you change the "baseWidth", "baseHeight", "minWidth",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 or "minHeight" resources, you need to call
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 EmacsShellUpdateSizeHints() to manually update the size
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 hints, except in the following two circumstances:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 (a) you are about to make a geometry request.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 (b) you are changing only "baseWidth" and "baseHeight"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 from within a resize procedure. (In this case,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 the size hints are already correct.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 */
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 #include <config.h>
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 <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 #include <stdlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 #include <X11/StringDefs.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 #include "xintrinsicp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 #include <X11/Shell.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 #include <X11/ShellP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 #include <X11/Vendor.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 #include <X11/VendorP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 #include "EmacsShellP.h"
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
90 #include "../lwlib/xt-wrappers.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 1294
diff changeset
92 #define ABORT abort
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 1294
diff changeset
93
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 #if defined (DEFINE_TOP_LEVEL_EMACS_SHELL)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 #define EMACS_SHELL_WIDGET TopLevelEmacsShellWidget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 #define SUPERCLASS_WIDGET_CLASS topLevelShellWidgetClass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 #define SUPERCLASS_CLASS_REC topLevelShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 #define EMACS_SHELL_REC TopLevelEmacsShellRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 #define EMACS_SHELL_CLASS_REC topLevelEmacsShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #define EMACS_SHELL_CLASS_REC_TYPE TopLevelEmacsShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 #define EMACS_SHELL_CLASS_NAME "TopLevelEmacsShell"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 #define EMACS_SHELL_WIDGET_CLASS topLevelEmacsShellWidgetClass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 #define EMACS_SHELL_UPDATE_SIZE_HINTS TopLevelEmacsShellUpdateSizeHints
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 #elif defined (DEFINE_TRANSIENT_EMACS_SHELL)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #define EMACS_SHELL_WIDGET TransientEmacsShellWidget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 #define SUPERCLASS_WIDGET_CLASS transientShellWidgetClass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 #define SUPERCLASS_CLASS_REC transientShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 #define EMACS_SHELL_REC TransientEmacsShellRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 #define EMACS_SHELL_CLASS_REC transientEmacsShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 #define EMACS_SHELL_CLASS_REC_TYPE TransientEmacsShellClassRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 #define EMACS_SHELL_CLASS_NAME "TransientEmacsShell"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 #define EMACS_SHELL_WIDGET_CLASS transientEmacsShellWidgetClass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 #define EMACS_SHELL_UPDATE_SIZE_HINTS TransientEmacsShellUpdateSizeHints
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 Error. Must define either DEFINE_TOP_LEVEL_EMACS_SHELL or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 DEFINE_TRANSIENT_EMACS_SHELL.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 typedef struct {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 XtPointer next_extension;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 XrmQuark record_type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 long version;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 Cardinal record_size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 } GenericClassExtRec;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 static XtGeometryResult RootGeometryManager (Widget gw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 XtWidgetGeometry *request, XtWidgetGeometry *reply);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 static void ChangeManaged (Widget w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 /* snarfed from Shell.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 #define BIGSIZE ((Dimension)32767)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 static XtResource resources[] = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 #define offset(field) XtOffset(EMACS_SHELL_WIDGET, emacs_shell.field)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 #define coreoffset(field) XtOffset(EMACS_SHELL_WIDGET, core.field)
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
136 #define res(name,_class,member,size) \
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
137 { (String) name, (String) _class, XtRInt, sizeof (int), \
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
138 offset (member), XtRImmediate, (XtPointer)0 }
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
139 #define motifres(name,member) \
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
140 { (String) name, XtCPosition, XtRPosition, sizeof (Position), \
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
141 coreoffset (member), XtRImmediate, (XtPointer)BIGSIZE }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 /* *** BOGOSITY^10! *** The Motif VendorShell fucks around with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 the default values for X and Y, for no obvious reason. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 causes Shell to indicate that the defaults of (0,0) were
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 program-specified, instead of letting the WM do what it wants. */
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
147 motifres (XtNx, x),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
148 motifres (XtNy, y),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 #endif
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
150 res (XtNwidthCells, XtCWidthCells, width_cells, 0),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
151 res (XtNheightCells, XtCHeightCells, height_cells, 0),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
152 res (XtNminWidthCells, XtCMinWidthCells, min_width_cells, 0),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
153 res (XtNminHeightCells, XtCMinHeightCells, min_height_cells, 0),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
154 #undef offset
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
155 #undef coreoffset
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
156 #undef res
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
157 #undef motifres
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 };
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 static CompositeClassExtensionRec compositeClassExtRec = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 XtCompositeExtensionVersion,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
164 sizeof (CompositeClassExtensionRec),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 };
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 static ShellClassExtensionRec shellClassExtRec = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 XtShellExtensionVersion,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
172 sizeof (ShellClassExtensionRec),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 RootGeometryManager
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 };
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 EMACS_SHELL_CLASS_REC_TYPE EMACS_SHELL_CLASS_REC = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 { /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 * core_class fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 /* superclass */ (WidgetClass) &SUPERCLASS_CLASS_REC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 /* class_name */ (String) EMACS_SHELL_CLASS_NAME,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
182 /* size */ sizeof (EMACS_SHELL_REC),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 /* Class Initializer */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 /* class_part_initialize*/ NULL, /* XtInheritClassPartInitialize, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 /* Class init'ed ? */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 /* initialize */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 /* initialize_notify */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 /* realize */ XtInheritRealize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 /* actions */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 /* num_actions */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 /* resources */ resources,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 /* resource_count */ XtNumber (resources),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 /* xrm_class */ NULLQUARK,
1294
8c5cf108f035 [xemacs-hg @ 2003-02-14 07:38:22 by stephent]
stephent
parents: 440
diff changeset
194 /* compress_motion */ TRUE,
8c5cf108f035 [xemacs-hg @ 2003-02-14 07:38:22 by stephent]
stephent
parents: 440
diff changeset
195 /* compress_exposure */ XtExposeCompressMaximal | XtExposeNoRegion,
8c5cf108f035 [xemacs-hg @ 2003-02-14 07:38:22 by stephent]
stephent
parents: 440
diff changeset
196 /* compress_enterleave*/ TRUE,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 /* visible_interest */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 /* destroy */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 /* resize */ XtInheritResize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 /* expose */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 /* set_values */ NULL, /* XtInheritSetValues, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 /* set_values_hook */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 /* set_values_almost */ XtInheritSetValuesAlmost,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 /* get_values_hook */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 /* accept_focus */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 /* intrinsics version */ XtVersion,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 /* callback offsets */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 /* tm_table */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 /* query_geometry */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 /* display_accelerator*/ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 },{ /* Composite */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 /* geometry_manager */ XtInheritGeometryManager,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 /* change_managed */ ChangeManaged,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 /* insert_child */ XtInheritInsertChild,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 /* delete_child */ XtInheritDeleteChild,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 /* extension */ (XtPointer)&compositeClassExtRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 },{ /* Shell */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 /* extension */ (XtPointer)&shellClassExtRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 },{ /* WMShell */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 },{ /* VendorShell */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 },{ /* TopLevelShell or TransientShell */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 /* both have exactly one XtPointer here. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 },{ /* EmacsShell */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 }
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 WidgetClass EMACS_SHELL_WIDGET_CLASS = (WidgetClass) &EMACS_SHELL_CLASS_REC;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 update_size_hints_internal (EMACS_SHELL_WIDGET w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 int width, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 int base_width, base_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 int cell_width, cell_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 Arg al [10];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 /* time to update them thar size hints */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 cell_width = w->wm.size_hints.width_inc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 cell_height = w->wm.size_hints.height_inc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 base_width = width - cell_width * w->emacs_shell.width_cells;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 base_height = height - cell_height * w->emacs_shell.height_cells;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 #ifdef DEBUG_GEOMETRY_MANAGEMENT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 /* Very useful info when debugging geometry management problems.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 When it's guaranteed that no more such problems exist, take
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 this stuff out. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 printf ("update_size_hints_internal:\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 printf (" actual pixel size: %d %d\n", width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 printf (" cell size in pixels: %d %d\n", cell_width, cell_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 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
255 w->emacs_shell.height_cells);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 printf (" base size set to: %d %d\n", base_width, base_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 fflush (stdout);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 #endif
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
259 Xt_SET_ARG(al [0], XtNbaseWidth, base_width);
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
260 Xt_SET_ARG(al [1], XtNbaseHeight, base_height);
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
261 Xt_SET_ARG(al [2], XtNminWidth, base_width +
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
262 cell_width * w->emacs_shell.min_width_cells);
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
263 Xt_SET_ARG(al [3], XtNminHeight, base_height +
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
264 cell_height * w->emacs_shell.min_height_cells);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 XtSetValues ((Widget) w, al, 4);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 }
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 static XtGeometryResult
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 SuperClassRootGeometryManager (Widget gw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 XtWidgetGeometry *request,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 XtWidgetGeometry *reply)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 ShellWidgetClass swc = (ShellWidgetClass) SUPERCLASS_WIDGET_CLASS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 ShellClassExtensionRec *scer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 GenericClassExtRec *gcer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 /* find the shell extension record that specifies the
3381
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 2500
diff changeset
278 root geometry manager method
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 2500
diff changeset
279 #### We could use XtGetClassExtension here. */
428
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
3381
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 2500
diff changeset
288 /* #### The R11.6.4 Xt specification says if we don't find NULLQUARK here,
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 2500
diff changeset
289 we should assume root_geometry_manager = XtInheritRootGeometryManager.
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 2500
diff changeset
290 Is that actually callable? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 if (!gcer)
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 1294
diff changeset
292 ABORT ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 /* call it to actually make the geometry request */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 scer = (ShellClassExtensionRec *) gcer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 return (scer->root_geometry_manager)(gw, request, reply);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 static XtGeometryResult
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 RootGeometryManager (Widget gw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 XtWidgetGeometry *request,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 XtWidgetGeometry *reply)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 EMACS_SHELL_WIDGET w = (EMACS_SHELL_WIDGET) gw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 /* OK since this file is not dumped */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 static int reentrant = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 XtGeometryResult result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 if (reentrant)
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 1294
diff changeset
310 ABORT ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 reentrant++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 #ifdef DEBUG_GEOMETRY_MANAGEMENT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 printf ("root_geometry_manager:\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 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
316 if (request->request_mode & CWWidth)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 printf ("width requested;");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 if (request->request_mode & CWHeight)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 printf ("height requested;");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 printf ("\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 printf (" requested shell size: %d %d\n", request->width, request->height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 /* update the size hints */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 update_size_hints_internal (w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 request->request_mode & CWWidth ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 request->width : w->core.width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 request->request_mode & CWHeight ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 request->height : w->core.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 result = SuperClassRootGeometryManager (gw, request, reply);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 #ifdef DEBUG_GEOMETRY_MANAGEMENT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 printf (" result: %s\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 result == XtGeometryYes ? "XtGeometryYes" :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 result == XtGeometryNo ? "XtGeometryNo" :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 result == XtGeometryAlmost ? "XtGeometryAlmost" :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 "XtGeometryDone");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 if (reply->request_mode & CWWidth)
3385
6830a3f39553 [xemacs-hg @ 2006-05-08 07:35:23 by stephent]
stephent
parents: 3381
diff changeset
339 printf ("width returned was %d%s",
6830a3f39553 [xemacs-hg @ 2006-05-08 07:35:23 by stephent]
stephent
parents: 3381
diff changeset
340 reply->width,
6830a3f39553 [xemacs-hg @ 2006-05-08 07:35:23 by stephent]
stephent
parents: 3381
diff changeset
341 reply->request_mode & CWHeight ? "; " : ".\n");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 if (reply->request_mode & CWHeight)
3385
6830a3f39553 [xemacs-hg @ 2006-05-08 07:35:23 by stephent]
stephent
parents: 3381
diff changeset
343 printf ("height returned was %d.\n", reply->height);
6830a3f39553 [xemacs-hg @ 2006-05-08 07:35:23 by stephent]
stephent
parents: 3381
diff changeset
344 /* #### does this also need to depend on the result?
6830a3f39553 [xemacs-hg @ 2006-05-08 07:35:23 by stephent]
stephent
parents: 3381
diff changeset
345 With XtGeometryYes there doesn't seem to be a useful reply object. */
6830a3f39553 [xemacs-hg @ 2006-05-08 07:35:23 by stephent]
stephent
parents: 3381
diff changeset
346 printf (" resulting shell size: %d %d\n",
6830a3f39553 [xemacs-hg @ 2006-05-08 07:35:23 by stephent]
stephent
parents: 3381
diff changeset
347 reply->request_mode & CWWidth ? reply->width : w->core.width,
6830a3f39553 [xemacs-hg @ 2006-05-08 07:35:23 by stephent]
stephent
parents: 3381
diff changeset
348 reply->request_mode & CWHeight ? reply->height : w->core.height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 printf ("----------\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 fflush (stdout);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 reentrant--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 return result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 ChangeManaged (Widget wid)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 EMACS_SHELL_WIDGET w = (EMACS_SHELL_WIDGET) wid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 /* If not realized, then we're being called from XtRealizeWidget().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 RootGeometryManager() has not yet been called, and thus our
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 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
364 will mess up geometry specifications with negative positional
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 offsets. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 if (!XtIsRealized (wid))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 Widget child = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 Cardinal i;
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 /* the managed child indicates what our size is */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 for (i = 0; i < w->composite.num_children; i++) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 if (XtIsManaged(w->composite.children[i])) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 child = w->composite.children[i];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 }
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 update_size_hints_internal (w, child->core.width, child->core.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 }
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 /* call the real ChangeManaged */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 (((ShellWidgetClass) SUPERCLASS_WIDGET_CLASS)->
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 composite_class.change_managed)(wid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 /******************* external entry points *********************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 EMACS_SHELL_UPDATE_SIZE_HINTS (Widget gw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 EMACS_SHELL_WIDGET w = (EMACS_SHELL_WIDGET) gw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 update_size_hints_internal (w, w->core.width, w->core.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 }