]> git.eshelyaron.com Git - emacs.git/commitdiff
entered into RCS
authorPaul Reilly <pmr@pajato.com>
Fri, 16 Sep 1994 17:37:05 +0000 (17:37 +0000)
committerPaul Reilly <pmr@pajato.com>
Fri, 16 Sep 1994 17:37:05 +0000 (17:37 +0000)
lwlib/lwlib-Xaw.c
lwlib/lwlib.c

index 19294e7b0bba55db83c0efa1fabdbfba6d6d4522..9a659bb1a00631c71ce32cea0067e83c7ded1562 100644 (file)
@@ -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}
 };
index 57edebcd085f5ab443c0cd5e46f84319116d4ed7..4ac186e586eba1e5b7ac885cb0cf4456ac83c575 100644 (file)
@@ -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
+}