Mercurial > hg > xemacs-beta
annotate src/EmacsShell-sub.c @ 5848:e2efee0f7703
hst confused
| author | Henry Thompson <ht@markup.co.uk> |
|---|---|
| date | Fri, 27 Feb 2015 17:43:50 +0000 |
| parents | 308d34e9f07d |
| children |
| rev | line source |
|---|---|
| 428 | 1 /* Emacs shell widget -- define the two widgets. |
| 2 Copyright (C) 1994, 1995 Sun Microsystems, Inc. | |
| 3 | |
| 4 This file is part of XEmacs. | |
| 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 | 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 | 10 |
| 11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 for more details. | |
| 15 | |
| 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 | 18 |
| 19 /* Synched up with: Not in FSF. */ | |
| 20 | |
| 21 /* Written by Ben Wing, May, 1994. */ | |
| 22 | |
| 23 /* | |
| 24 It is rather unfortunate that we have to do this. Blame those | |
| 25 short-sighted people who designed the monstrosities known as | |
| 26 Xt and ICCCM. | |
| 27 */ | |
| 28 | |
| 29 /* | |
| 30 This widget is not actually Emacs-specific; perhaps there could | |
| 31 be a better name than "EmacsShell". What it does is work around | |
| 32 a limitation in Xt in correctly dealing with the window-manager | |
| 33 size hints with applications that | |
| 34 | |
| 35 (a) dynamically change their window size | |
| 36 (b) have a cell size (width-inc and height-inc) other than 1 | |
| 37 | |
| 38 and | |
| 39 | |
| 40 (c) cannot predict in advance exactly what size their shell will be | |
| 41 (This is the more common situation, when you have a number | |
| 42 of widgets, each with their own size ideas) | |
| 43 | |
| 44 This widget assumes that your program contains a fixed "base size" | |
| 45 plus some number of cells (e.g. character cells). The WMShell | |
| 46 resources "widthInc" and "heightInc" specify the size of a | |
| 47 character cell, and the window manager will report the app's | |
| 48 size in cells rather than in pixels. | |
| 49 | |
| 50 If you use this widget, do not use the WMShell resources | |
| 51 "baseWidth", "baseHeight", "minWidth", or "minHeight". | |
| 52 Instead, use "widthCells" and "heightCells" to specify the | |
| 53 current size in cells (you must keep this up-to-date), | |
| 54 and "minWidthCells" and "minHeightCells" to specify the | |
| 55 minimum size in cells. | |
| 56 | |
| 57 Every time that the program issues a size command, the | |
| 58 "baseWidth", "baseHeight", "minWidth", and "minHeight" fields | |
| 59 of the WM_NORMAL_HINTS property will be updated to stay in | |
| 60 line with the resource values specified above. The calculations | |
| 61 are done once the desired shell size is known but before the | |
| 62 window-manager size-change request is issued. (We must do it | |
| 63 at this time because before then we don't know what size we | |
| 64 will request, and after the request the deed has already | |
| 65 been done.) | |
| 66 | |
| 67 After you change the "baseWidth", "baseHeight", "minWidth", | |
| 68 or "minHeight" resources, you need to call | |
| 69 EmacsShellUpdateSizeHints() to manually update the size | |
| 70 hints, except in the following two circumstances: | |
| 71 | |
| 72 (a) you are about to make a geometry request. | |
| 73 (b) you are changing only "baseWidth" and "baseHeight" | |
| 74 from within a resize procedure. (In this case, | |
| 75 the size hints are already correct.) | |
| 76 | |
| 77 */ | |
| 78 | |
| 79 #include <config.h> | |
| 80 | |
| 81 #include <stdio.h> | |
| 82 #include <stdlib.h> | |
| 83 #include <X11/StringDefs.h> | |
| 84 #include "xintrinsicp.h" | |
| 85 #include <X11/Shell.h> | |
| 86 #include <X11/ShellP.h> | |
| 87 #include <X11/Vendor.h> | |
| 88 #include <X11/VendorP.h> | |
| 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 | 91 |
| 2500 | 92 #define ABORT abort |
| 93 | |
| 428 | 94 #if defined (DEFINE_TOP_LEVEL_EMACS_SHELL) |
| 95 #define EMACS_SHELL_WIDGET TopLevelEmacsShellWidget | |
| 96 #define SUPERCLASS_WIDGET_CLASS topLevelShellWidgetClass | |
| 97 #define SUPERCLASS_CLASS_REC topLevelShellClassRec | |
| 98 #define EMACS_SHELL_REC TopLevelEmacsShellRec | |
| 99 #define EMACS_SHELL_CLASS_REC topLevelEmacsShellClassRec | |
| 100 #define EMACS_SHELL_CLASS_REC_TYPE TopLevelEmacsShellClassRec | |
| 101 #define EMACS_SHELL_CLASS_NAME "TopLevelEmacsShell" | |
| 102 #define EMACS_SHELL_WIDGET_CLASS topLevelEmacsShellWidgetClass | |
| 103 #define EMACS_SHELL_UPDATE_SIZE_HINTS TopLevelEmacsShellUpdateSizeHints | |
| 104 #elif defined (DEFINE_TRANSIENT_EMACS_SHELL) | |
| 105 #define EMACS_SHELL_WIDGET TransientEmacsShellWidget | |
| 106 #define SUPERCLASS_WIDGET_CLASS transientShellWidgetClass | |
| 107 #define SUPERCLASS_CLASS_REC transientShellClassRec | |
| 108 #define EMACS_SHELL_REC TransientEmacsShellRec | |
| 109 #define EMACS_SHELL_CLASS_REC transientEmacsShellClassRec | |
| 110 #define EMACS_SHELL_CLASS_REC_TYPE TransientEmacsShellClassRec | |
| 111 #define EMACS_SHELL_CLASS_NAME "TransientEmacsShell" | |
| 112 #define EMACS_SHELL_WIDGET_CLASS transientEmacsShellWidgetClass | |
| 113 #define EMACS_SHELL_UPDATE_SIZE_HINTS TransientEmacsShellUpdateSizeHints | |
| 114 #else | |
| 115 Error. Must define either DEFINE_TOP_LEVEL_EMACS_SHELL or | |
| 116 DEFINE_TRANSIENT_EMACS_SHELL. | |
| 117 #endif | |
| 118 | |
| 119 typedef struct { | |
| 120 XtPointer next_extension; | |
| 121 XrmQuark record_type; | |
| 122 long version; | |
| 123 Cardinal record_size; | |
| 124 } GenericClassExtRec; | |
| 125 | |
| 126 static XtGeometryResult RootGeometryManager (Widget gw, | |
| 127 XtWidgetGeometry *request, XtWidgetGeometry *reply); | |
| 128 static void ChangeManaged (Widget w); | |
| 129 | |
| 130 /* snarfed from Shell.c */ | |
| 131 #define BIGSIZE ((Dimension)32767) | |
| 132 | |
| 133 static XtResource resources[] = { | |
| 134 #define offset(field) XtOffset(EMACS_SHELL_WIDGET, emacs_shell.field) | |
| 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 | 142 #ifdef LWLIB_USES_MOTIF |
| 143 /* *** BOGOSITY^10! *** The Motif VendorShell fucks around with | |
| 144 the default values for X and Y, for no obvious reason. This | |
| 145 causes Shell to indicate that the defaults of (0,0) were | |
| 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 | 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 | 158 }; |
| 159 | |
| 160 static CompositeClassExtensionRec compositeClassExtRec = { | |
| 161 NULL, | |
| 162 NULLQUARK, | |
| 163 XtCompositeExtensionVersion, | |
| 440 | 164 sizeof (CompositeClassExtensionRec), |
| 428 | 165 TRUE, |
| 166 }; | |
| 167 | |
| 168 static ShellClassExtensionRec shellClassExtRec = { | |
| 169 NULL, | |
| 170 NULLQUARK, | |
| 171 XtShellExtensionVersion, | |
| 440 | 172 sizeof (ShellClassExtensionRec), |
| 428 | 173 RootGeometryManager |
| 174 }; | |
| 175 | |
| 176 EMACS_SHELL_CLASS_REC_TYPE EMACS_SHELL_CLASS_REC = { | |
| 177 { /* | |
| 178 * core_class fields | |
| 179 */ | |
| 180 /* superclass */ (WidgetClass) &SUPERCLASS_CLASS_REC, | |
| 181 /* class_name */ (String) EMACS_SHELL_CLASS_NAME, | |
| 440 | 182 /* size */ sizeof (EMACS_SHELL_REC), |
| 428 | 183 /* Class Initializer */ NULL, |
| 184 /* class_part_initialize*/ NULL, /* XtInheritClassPartInitialize, */ | |
| 185 /* Class init'ed ? */ FALSE, | |
| 186 /* initialize */ NULL, | |
| 187 /* initialize_notify */ NULL, | |
| 188 /* realize */ XtInheritRealize, | |
| 189 /* actions */ NULL, | |
| 190 /* num_actions */ 0, | |
| 191 /* resources */ resources, | |
| 192 /* resource_count */ XtNumber (resources), | |
| 193 /* xrm_class */ NULLQUARK, | |
| 1294 | 194 /* compress_motion */ TRUE, |
| 195 /* compress_exposure */ XtExposeCompressMaximal | XtExposeNoRegion, | |
| 196 /* compress_enterleave*/ TRUE, | |
| 428 | 197 /* visible_interest */ TRUE, |
| 198 /* destroy */ NULL, | |
| 199 /* resize */ XtInheritResize, | |
| 200 /* expose */ NULL, | |
| 201 /* set_values */ NULL, /* XtInheritSetValues, */ | |
| 202 /* set_values_hook */ NULL, | |
| 203 /* set_values_almost */ XtInheritSetValuesAlmost, | |
| 204 /* get_values_hook */ NULL, | |
| 205 /* accept_focus */ NULL, | |
| 206 /* intrinsics version */ XtVersion, | |
| 207 /* callback offsets */ NULL, | |
| 208 /* tm_table */ NULL, | |
| 209 /* query_geometry */ NULL, | |
| 210 /* display_accelerator*/ NULL, | |
| 211 /* extension */ NULL | |
| 212 },{ /* Composite */ | |
| 213 /* geometry_manager */ XtInheritGeometryManager, | |
| 214 /* change_managed */ ChangeManaged, | |
| 215 /* insert_child */ XtInheritInsertChild, | |
| 216 /* delete_child */ XtInheritDeleteChild, | |
| 217 /* extension */ (XtPointer)&compositeClassExtRec | |
| 218 },{ /* Shell */ | |
| 219 /* extension */ (XtPointer)&shellClassExtRec | |
| 220 },{ /* WMShell */ | |
| 221 /* extension */ NULL | |
| 222 },{ /* VendorShell */ | |
| 223 /* extension */ NULL | |
| 224 },{ /* TopLevelShell or TransientShell */ | |
| 225 /* both have exactly one XtPointer here. */ | |
| 226 /* extension */ NULL | |
| 227 },{ /* EmacsShell */ | |
| 228 0 | |
| 229 } | |
| 230 }; | |
| 231 | |
| 232 WidgetClass EMACS_SHELL_WIDGET_CLASS = (WidgetClass) &EMACS_SHELL_CLASS_REC; | |
| 233 | |
| 234 static void | |
| 235 update_size_hints_internal (EMACS_SHELL_WIDGET w, | |
| 236 int width, int height) | |
| 237 { | |
| 238 int base_width, base_height; | |
| 239 int cell_width, cell_height; | |
| 240 Arg al [10]; | |
| 241 | |
| 242 /* time to update them thar size hints */ | |
| 243 cell_width = w->wm.size_hints.width_inc; | |
| 244 cell_height = w->wm.size_hints.height_inc; | |
| 245 base_width = width - cell_width * w->emacs_shell.width_cells; | |
| 246 base_height = height - cell_height * w->emacs_shell.height_cells; | |
| 247 #ifdef DEBUG_GEOMETRY_MANAGEMENT | |
| 248 /* Very useful info when debugging geometry management problems. | |
| 249 When it's guaranteed that no more such problems exist, take | |
| 250 this stuff out. */ | |
| 251 printf ("update_size_hints_internal:\n"); | |
| 252 printf (" actual pixel size: %d %d\n", width, height); | |
| 253 printf (" cell size in pixels: %d %d\n", cell_width, cell_height); | |
| 254 printf (" text area size in cells: %d %d\n", w->emacs_shell.width_cells, | |
| 255 w->emacs_shell.height_cells); | |
| 256 printf (" base size set to: %d %d\n", base_width, base_height); | |
| 257 fflush (stdout); | |
| 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 | 265 XtSetValues ((Widget) w, al, 4); |
| 266 } | |
| 267 | |
| 268 static XtGeometryResult | |
| 269 SuperClassRootGeometryManager (Widget gw, | |
| 270 XtWidgetGeometry *request, | |
| 271 XtWidgetGeometry *reply) | |
| 272 { | |
| 273 ShellWidgetClass swc = (ShellWidgetClass) SUPERCLASS_WIDGET_CLASS; | |
| 274 ShellClassExtensionRec *scer; | |
| 275 GenericClassExtRec *gcer; | |
| 276 | |
| 277 /* find the shell extension record that specifies the | |
| 3381 | 278 root geometry manager method |
| 279 #### We could use XtGetClassExtension here. */ | |
| 428 | 280 for (gcer = (GenericClassExtRec *) swc->shell_class.extension; |
| 281 gcer; | |
| 282 gcer = (GenericClassExtRec *) gcer->next_extension) | |
| 283 { | |
| 284 if (gcer->record_type == NULLQUARK) | |
| 285 break; | |
| 286 } | |
| 287 | |
| 3381 | 288 /* #### The R11.6.4 Xt specification says if we don't find NULLQUARK here, |
| 289 we should assume root_geometry_manager = XtInheritRootGeometryManager. | |
| 290 Is that actually callable? */ | |
| 428 | 291 if (!gcer) |
| 2500 | 292 ABORT (); |
| 428 | 293 |
| 294 /* call it to actually make the geometry request */ | |
| 295 scer = (ShellClassExtensionRec *) gcer; | |
| 296 return (scer->root_geometry_manager)(gw, request, reply); | |
| 297 } | |
| 298 | |
| 299 static XtGeometryResult | |
| 300 RootGeometryManager (Widget gw, | |
| 301 XtWidgetGeometry *request, | |
| 302 XtWidgetGeometry *reply) | |
| 303 { | |
| 304 EMACS_SHELL_WIDGET w = (EMACS_SHELL_WIDGET) gw; | |
| 305 /* OK since this file is not dumped */ | |
| 306 static int reentrant = 0; | |
| 307 XtGeometryResult result; | |
| 308 | |
| 309 if (reentrant) | |
| 2500 | 310 ABORT (); |
| 428 | 311 reentrant++; |
| 312 | |
| 313 #ifdef DEBUG_GEOMETRY_MANAGEMENT | |
| 314 printf ("root_geometry_manager:\n"); | |
| 315 printf (" current shell size: %d %d\n", w->core.width, w->core.height); | |
| 316 if (request->request_mode & CWWidth) | |
| 317 printf ("width requested;"); | |
| 318 if (request->request_mode & CWHeight) | |
| 319 printf ("height requested;"); | |
| 320 printf ("\n"); | |
| 321 printf (" requested shell size: %d %d\n", request->width, request->height); | |
| 322 #endif | |
| 323 /* update the size hints */ | |
| 324 update_size_hints_internal (w, | |
| 325 request->request_mode & CWWidth ? | |
| 326 request->width : w->core.width, | |
| 327 request->request_mode & CWHeight ? | |
| 328 request->height : w->core.height); | |
| 329 | |
| 330 result = SuperClassRootGeometryManager (gw, request, reply); | |
| 331 | |
| 332 #ifdef DEBUG_GEOMETRY_MANAGEMENT | |
| 333 printf (" result: %s\n", | |
| 334 result == XtGeometryYes ? "XtGeometryYes" : | |
| 335 result == XtGeometryNo ? "XtGeometryNo" : | |
| 336 result == XtGeometryAlmost ? "XtGeometryAlmost" : | |
| 337 "XtGeometryDone"); | |
| 338 if (reply->request_mode & CWWidth) | |
| 3385 | 339 printf ("width returned was %d%s", |
| 340 reply->width, | |
| 341 reply->request_mode & CWHeight ? "; " : ".\n"); | |
| 428 | 342 if (reply->request_mode & CWHeight) |
| 3385 | 343 printf ("height returned was %d.\n", reply->height); |
| 344 /* #### does this also need to depend on the result? | |
| 345 With XtGeometryYes there doesn't seem to be a useful reply object. */ | |
| 346 printf (" resulting shell size: %d %d\n", | |
| 347 reply->request_mode & CWWidth ? reply->width : w->core.width, | |
| 348 reply->request_mode & CWHeight ? reply->height : w->core.height); | |
| 428 | 349 printf ("----------\n"); |
| 350 fflush (stdout); | |
| 351 #endif | |
| 352 reentrant--; | |
| 353 return result; | |
| 354 } | |
| 355 | |
| 356 static void | |
| 357 ChangeManaged (Widget wid) | |
| 358 { | |
| 359 EMACS_SHELL_WIDGET w = (EMACS_SHELL_WIDGET) wid; | |
| 360 | |
| 361 /* If not realized, then we're being called from XtRealizeWidget(). | |
| 362 RootGeometryManager() has not yet been called, and thus our | |
| 363 base size is incorrect. We need to set it now or the Shell | |
| 364 will mess up geometry specifications with negative positional | |
| 365 offsets. */ | |
| 366 if (!XtIsRealized (wid)) | |
| 367 { | |
| 368 Widget child = NULL; | |
| 369 Cardinal i; | |
| 370 | |
| 371 /* the managed child indicates what our size is */ | |
| 372 for (i = 0; i < w->composite.num_children; i++) { | |
| 373 if (XtIsManaged(w->composite.children[i])) { | |
| 374 child = w->composite.children[i]; | |
| 375 break; | |
| 376 } | |
| 377 } | |
| 378 | |
| 379 update_size_hints_internal (w, child->core.width, child->core.height); | |
| 380 } | |
| 381 | |
| 382 /* call the real ChangeManaged */ | |
| 383 (((ShellWidgetClass) SUPERCLASS_WIDGET_CLASS)-> | |
| 384 composite_class.change_managed)(wid); | |
| 385 } | |
| 386 | |
| 387 | |
| 388 /******************* external entry points *********************/ | |
| 389 | |
| 390 void | |
| 391 EMACS_SHELL_UPDATE_SIZE_HINTS (Widget gw) | |
| 392 { | |
| 393 EMACS_SHELL_WIDGET w = (EMACS_SHELL_WIDGET) gw; | |
| 394 update_size_hints_internal (w, w->core.width, w->core.height); | |
| 395 } |
