summaryrefslogtreecommitdiff
path: root/lwlib
diff options
context:
space:
mode:
authorPaul Reilly <pmr@pajato.com>1994-09-16 17:37:05 +0000
committerPaul Reilly <pmr@pajato.com>1994-09-16 17:37:05 +0000
commit25cad2df1c1d0e8bcfe9fc3f448266d297d431f7 (patch)
treeb2a05457ffc102377a925ac5b9113f0c6301f3bc /lwlib
parent5f66976685e22c338885d3aff6247d56779e206e (diff)
downloademacs-25cad2df1c1d0e8bcfe9fc3f448266d297d431f7.tar.gz
entered into RCS
Diffstat (limited to 'lwlib')
-rw-r--r--lwlib/lwlib-Xaw.c24
-rw-r--r--lwlib/lwlib.c92
2 files changed, 107 insertions, 9 deletions
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c
index 19294e7b0bb..9a659bb1a00 100644
--- a/lwlib/lwlib-Xaw.c
+++ b/lwlib/lwlib-Xaw.c
@@ -222,6 +222,8 @@ xaw_pop_instance (instance, up)
{
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 @@ xaw_pop_instance (instance, up)
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 @@ xaw_create_scrollbar (instance)
#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 --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index 57edebcd085..4ac186e586e 100644
--- a/lwlib/lwlib.c
+++ b/lwlib/lwlib.c
@@ -53,6 +53,10 @@ ERROR! At least one of USE_LUCID, USE_MOTIF or USE_OLIT must be defined.
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 @@ safe_strcmp (s1, s2)
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 @@ lw_show_busy (w, busy)
}
}
}
+
+/* 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
+}