# HG changeset patch # User Paul Reilly # Date 779737025 0 # Node ID 04ad11fb0a0ffeef0632109e5965bfe901600d4d # Parent 0166e4ab659a88bc5afc5cb2398794cd191f5aa6 entered into RCS diff -r 0166e4ab659a -r 04ad11fb0a0f lwlib/lwlib-Xaw.c --- a/lwlib/lwlib-Xaw.c Fri Sep 16 17:37:03 1994 +0000 +++ b/lwlib/lwlib-Xaw.c Fri Sep 16 17:37:05 1994 +0000 @@ -222,6 +222,8 @@ { int x, y, w, h; Widget topmost = instance->parent; + Arg args[2]; + w = shell->core.width; h = shell->core.height; while (topmost->core.parent && XtIsRealized (topmost->core.parent)) @@ -230,7 +232,12 @@ else x = topmost->core.x + ((topmost->core.width - w) / 2); if (topmost->core.height < h) y = topmost->core.y; else y = topmost->core.y + ((topmost->core.height - h) / 2); - XtMoveWidget (shell, x, y); + /* Using XtMoveWidget caused the widget to come + out in the wrong place with vtwm. + Question of virtual vs real coords, perhaps. */ + XtSetArg (args[0], XtNx, x); + XtSetArg (args[1], XtNy, y); + XtSetValues (shell, args, 2); } /* Finally, pop it up. */ @@ -617,9 +624,24 @@ #endif } +static Widget +xaw_create_main (instance) + widget_instance *instance; +{ + Arg al[1]; + int ac; + + /* Create a vertical Paned to hold menubar */ + ac = 0; + XtSetArg (al[ac], XtNborderWidth, 0); ac++; + return XtCreateWidget (instance->info->name, panedWidgetClass, + instance->parent, al, ac); +} + widget_creation_entry xaw_creation_table [] = { {"scrollbar", xaw_create_scrollbar}, + {"main", xaw_create_main}, {NULL, NULL} }; diff -r 0166e4ab659a -r 04ad11fb0a0f lwlib/lwlib.c --- a/lwlib/lwlib.c Fri Sep 16 17:37:03 1994 +0000 +++ b/lwlib/lwlib.c Fri Sep 16 17:37:05 1994 +0000 @@ -53,6 +53,10 @@ ERROR! no more than one of USE_MOTIF and USE_OLIT may be defined. #endif +#ifndef max +#define max(x, y) ((x) > (y) ? (x) : (y)) +#endif + /* List of all widgets managed by the library. */ static widget_info* all_widget_info = NULL; @@ -397,14 +401,6 @@ return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2; } -static int -max (i1, i2) - int i1; - int i2; -{ - return i1 > i2 ? i1 : i2; -} - #if 0 # define EXPLAIN(name, oc, nc, desc, a1, a2) \ @@ -1299,3 +1295,83 @@ } } } + +/* This hack exists because Lucid/Athena need to execute the strange + function below to support geometry management. */ +void +lw_refigure_widget (w, doit) + Widget w; + Boolean doit; +{ +#if defined (XAW) + XawPanedSetRefigureMode (w, doit); +#endif +#if defined (USE_MOTIF) + if (doit) + XtUnmanageChild (w); + else + XtManageChild (w); +#endif +} + +/* Toolkit independent way of determining if an event window is in the + menubar. */ +Boolean +lw_window_is_in_menubar (win, menubar_widget) + Window win; + Widget menubar_widget; +{ + return menubar_widget +#if defined (USE_LUCID) + && XtWindow (menubar_widget) == win; +#endif +#if defined (USE_MOTIF) + && XtWindowToWidget (XtDisplay (menubar_widget), win) + && (XtParent (XtWindowToWidget (XtDisplay (menubar_widget), win)) + == menubar_widget); +#endif +} + +/* Motif hack to set the main window areas. */ +void +lw_set_main_areas (parent, menubar, work_area) + Widget parent; + Widget menubar; + Widget work_area; +{ +#if defined (USE_MOTIF) + XmMainWindowSetAreas (parent, + menubar, /* menubar (maybe 0) */ + 0, /* command area (psheets) */ + 0, /* horizontal scroll */ + 0, /* vertical scroll */ + work_area); /* work area */ +#endif +} + +/* Manage resizing for Motif. This disables resizing when the menubar + is about to be modified. */ +void +lw_allow_resizing (w, flag) + Widget w; + Boolean flag; +{ +#if defined (USE_MOTIF) + if (flag) + { + /* Enable the edit widget for resizing. */ + Arg al[1]; + + XtSetArg (al[0], XtNallowShellResize, 0); + XtSetValues (w, al, 1); + } + else + { + /* Disable the edit widget from resizing. */ + Arg al[1]; + + XtSetArg (al[0], XtNallowShellResize, 0); + XtSetValues (w, al, 1); + } +#endif +}