home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / Programming / Source / winterp-1.13 / src-server / w_libXm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-04  |  24.0 KB  |  628 lines

  1. /* -*-C-*-
  2. ********************************************************************************
  3. *
  4. * File:         w_libXm.c
  5. * RCS:          $Header: w_libXm.c,v 1.5 91/03/25 04:17:21 mayer Exp $
  6. * Description:  Random XLISP Primitives and Methods for the Motif toolkit.
  7. * Author:       Niels Mayer, HPLabs
  8. * Created:      Fri Nov 24 00:36:30 1989
  9. * Modified:     Thu Oct  3 20:49:33 1991 (Niels Mayer) mayer@hplnpm
  10. * Language:     C
  11. * Package:      N/A
  12. * Status:       X11r5 contrib tape release
  13. *
  14. * WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  15. * XLISP version 2.1, Copyright (c) 1989, by David Betz.
  16. *
  17. * Permission to use, copy, modify, distribute, and sell this software and its
  18. * documentation for any purpose is hereby granted without fee, provided that
  19. * the above copyright notice appear in all copies and that both that
  20. * copyright notice and this permission notice appear in supporting
  21. * documentation, and that the name of Hewlett-Packard and David Betz not be
  22. * used in advertising or publicity pertaining to distribution of the software
  23. * without specific, written prior permission.  Hewlett-Packard and David Betz
  24. * make no representations about the suitability of this software for any
  25. * purpose. It is provided "as is" without express or implied warranty.
  26. *
  27. * HEWLETT-PACKARD AND DAVID BETZ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
  28. * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  29. * IN NO EVENT SHALL HEWLETT-PACKARD NOR DAVID BETZ BE LIABLE FOR ANY SPECIAL,
  30. * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  31. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  32. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  33. * PERFORMANCE OF THIS SOFTWARE.
  34. *
  35. * See ./winterp/COPYRIGHT for information on contacting the authors.
  36. * Please send modifications, improvements and bugfixes to mayer@hplabs.hp.com
  37. * Post XLISP-specific questions/information to the newsgroup comp.lang.lisp.x
  38. **
  39. ********************************************************************************
  40. */
  41. static char rcs_identity[] = "@(#)$Header: w_libXm.c,v 1.5 91/03/25 04:17:21 mayer Exp $";
  42.  
  43. #include <stdio.h>
  44. #include <Xm/Xm.h>
  45. #include <X11/cursorfont.h>    /* defines XC_num_glyphs */
  46. #include "winterp.h"
  47. #include "user_prefs.h"
  48. #include "xlisp/xlisp.h"
  49.  
  50. #ifdef WINTERP_MOTIF_11
  51. /*
  52.  * <limits.h> defines machine dependent limits on sizes of numbers, if your
  53.  * machine doesn't have this, then your compiler doesn't conform to standards
  54.  * XPG2, XPG3, POSIX.1, FIPS 151-1 and you should complain to the manufacturer.
  55.  * 
  56.  * If for some reason your system isn't standards-conforming, you may work
  57.  * around this problem by using the following definitions (assuming 32 bit machine):
  58.  * 
  59.  * #define INT_MAX 2147483647
  60.  */
  61. #include <limits.h>
  62. #endif                /* WINTERP_MOTIF_11 */
  63.  
  64. extern Widget Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(); /* w_classes.c */
  65.  
  66.  
  67. /*****************************************************************************
  68.  * (send <widget> :UPDATE_DISPLAY)
  69.  *
  70.  * (see XmUpdateDisplay(3X))
  71.  * This function is useful for refreshing winterp's
  72.  * Xwindows displays while inside a callback. Since the X display won't get
  73.  * refreshed until you hit the XtNextEvent/XtDispatchEvent loop you cannot
  74.  * normally change the display inside a callback. Thus, this function is
  75.  * expecally useful for forcing a status message to be seen before a long
  76.  * computation occurs within a callback, timeout, or workproc.
  77.  ****************************************************************************/
  78. LVAL Widget_Class_Method_UPDATE_DISPLAY()
  79. {
  80.   LVAL self;
  81.   Widget widget_id;
  82.  
  83.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  84.   xllastarg();
  85.  
  86.   XmUpdateDisplay(widget_id);
  87.   return (self);
  88. }
  89.  
  90.  
  91. /******************************************************************************
  92.  * (send <widget> :ADD_TAB_GROUP)
  93.  * ==> returns <widget>
  94.  *
  95.  * This method adds <widget> to the list of tab groups associated with a 
  96.  * particular widget hierarchy.
  97.  *
  98.  * void XmAddTabGroup(tabGroup)
  99.  *      Widget tabGroup;
  100.  ******************************************************************************/
  101. LVAL Widget_Class_Method_ADD_TAB_GROUP()
  102. {
  103.   LVAL self;
  104.   Widget widget_id;
  105.  
  106.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  107.   xllastarg();
  108.  
  109.   XmAddTabGroup(widget_id);
  110.   return (self);
  111. }
  112.  
  113.  
  114. /******************************************************************************
  115.  * (send <widget> :REMOVE_TAB_GROUP)
  116.  * ==> returns <widget>
  117.  *
  118.  * This method removes <widget> from the list of tab groups associated with a 
  119.  * particular widget hierarchy.
  120.  *
  121.  * void XmRemoveTabGroup (tabGroup)
  122.  *      Widget tabGroup;
  123.  ******************************************************************************/
  124. LVAL Widget_Class_Method_REMOVE_TAB_GROUP()
  125. {
  126.   LVAL self;
  127.   Widget widget_id;
  128.  
  129.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  130.   xllastarg();
  131.  
  132.   XmRemoveTabGroup(widget_id);
  133.   return (self);
  134. }
  135.  
  136. /******************************************************************************
  137.  * (send <widget> :IS_PRIMITIVE)
  138.  * ==> returns T if <widget> is a motif primitive widget, else NIL.
  139.  *
  140.  * #define XmIsPrimitive(w)    XtIsSubclass(w, xmPrimitiveWidgetClass)
  141.  ******************************************************************************/
  142. LVAL Widget_Class_Method_IS_PRIMITIVE()
  143. {
  144.   extern LVAL true;
  145.   LVAL self;
  146.   Widget widget_id;
  147.  
  148.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  149.   xllastarg();
  150.  
  151.   return (XmIsPrimitive(widget_id) ? true : NIL);
  152. }
  153.  
  154.  
  155. /******************************************************************************
  156.  * (send <widget> :IS_GADGET)
  157.  * ==> returns T if <widget> is a motif gadget, else NIL.
  158.  *
  159.  * #define XmIsGadget(w)    XtIsSubclass(w, xmGadgetClass)
  160.  ******************************************************************************/
  161. LVAL Widget_Class_Method_IS_GADGET()
  162. {
  163.   extern LVAL true;
  164.   LVAL self;
  165.   Widget widget_id;
  166.  
  167.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  168.   xllastarg();
  169.  
  170.   return (XmIsGadget(widget_id) ? true : NIL);
  171. }
  172.  
  173.  
  174. /******************************************************************************
  175.  * (send <widget> :IS_MANAGER)
  176.  * ==> returns T if <widget> is a motif manager widget, else NIL.
  177.  *
  178.  * #define XmIsManager(w)    XtIsSubclass(w, xmManagerWidgetClass)
  179.  ******************************************************************************/
  180. LVAL Widget_Class_Method_IS_MANAGER()
  181. {
  182.   extern LVAL true;
  183.   LVAL self;
  184.   Widget widget_id;
  185.  
  186.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  187.   xllastarg();
  188.  
  189.   return (XmIsManager(widget_id) ? true : NIL);
  190. }
  191.  
  192.  
  193. #ifdef WINTERP_MOTIF_11
  194. /******************************************************************************
  195.  * (XM_GET_COLORS <background-pixel>)
  196.  * returns an array <background> <foreground> <top_shadow> <bot_shadow> <select>
  197.  * pixels.
  198. ******************************************************************************/
  199. LVAL Wxm_Prim_XM_GET_COLORS()
  200. {
  201.   extern Screen* screen;    /* global in winterp.c */
  202.   extern Colormap colormap;    /* global in winterp.c */
  203.   Pixel foreground, top_shadow, bottom_shadow, select;
  204.   LVAL result, background = xlga_pixel();
  205.   xllastarg();
  206.  
  207.   XmGetColors(screen, colormap, get_pixel(background), &foreground, &top_shadow, &bottom_shadow, &select);
  208.  
  209.   xlsave1(result);
  210.   result = newvector(5);
  211.   setelement(result, 0, cv_pixel(background));
  212.   setelement(result, 1, cv_pixel(foreground));
  213.   setelement(result, 2, cv_pixel(top_shadow));
  214.   setelement(result, 3, cv_pixel(bottom_shadow));
  215.   setelement(result, 4, cv_pixel(select));
  216.  
  217.   xlpop();
  218.   return (result);
  219. }
  220. #endif
  221.  
  222.  
  223. #ifdef WINTERP_MOTIF_11
  224. /******************************************************************************
  225.  * (XM_SET_FONT_UNITS <horiz-val> <vert-val>)
  226.  *     ==> Returns NIL.
  227.  *
  228.  * <horiz-val> and <vert-val> are nonngegative FIXNUMS
  229.  *
  230.  * Note: when WINTERP allows for multiple displays, this function will
  231.  * end up changing arg sequences to accomodate a <display> arg.
  232.  *
  233.  *-----------------------------------------------------------------------------
  234.  *           void XmSetFontUnits (display, h_value, v_value)
  235.  *                Display   * display;
  236.  *                int       h_value;
  237.  *                int       v_value;
  238.  ******************************************************************************/
  239. LVAL Wxm_Prim_XM_SET_FONT_UNITS()
  240. {
  241.   extern Display* display;    /* winterp.c */
  242.   LVAL lval_h_value = xlgafixnum();
  243.   LVAL lval_v_value = xlgafixnum();
  244.   long h_value = (long) getfixnum(lval_h_value);
  245.   long v_value = (long) getfixnum(lval_v_value);
  246.   xllastarg();
  247.  
  248.   if ((h_value < 0L) || (h_value > (long) INT_MAX))
  249.     xlerror("Font unit specification out of range", lval_h_value);
  250.   if ((v_value < 0L) || (v_value > (long) INT_MAX))
  251.     xlerror("Font unit specification out of range", lval_v_value);
  252.  
  253.   XmSetFontUnits(display, (int) h_value, (int) v_value);
  254.  
  255.   return (NIL);
  256. }
  257. #endif                /* WINTERP_MOTIF_11 */
  258.  
  259.  
  260. #ifdef WINTERP_MOTIF_11
  261. /******************************************************************************
  262.  * (XM_TRACKING_LOCATE <widget> <fontcursor-FIXNUM> [<confine-to-p>]
  263.  *    ==> Returns a WIDGETOBJ or NIL if the window of the buttonpress is
  264.  *        not a widget.
  265.  *
  266.  * "XmTrackingLocate provides a modal interface for selection of
  267.  * a component.  It is intended to support context help.  The
  268.  * function grabs the pointer and returns the widget in which a
  269.  * button press occurs." (taken from XmTrackingLocate.3X man-page).
  270.  * 
  271.  * <widget> is the widget "to use as the basis of the modal interaction
  272.  *
  273.  * <fontcursor-FIXNUM> specifies the shape of the cursor for this interaction.
  274.  * the value of this FIXNUM specifies a font whose name/value is defined in
  275.  * /usr/include/X11/cursorfont.h.
  276.  *
  277.  * If the last arg supplied, <confine-to-p>, is non-NIL, then the interaction
  278.  * will be confined to <widget>. If this arg is not supplied, <confine-to-p>
  279.  * is treated as NIL.
  280.  *----------------------------------------------------------------------------
  281.  * Widget XmTrackingLocate (widget, cursor, confine_to)
  282.  *      Widget    widget;
  283.  *      Cursor    cursor;
  284.  *      Boolean   confine_to;
  285.  ******************************************************************************/
  286. LVAL Wxm_Prim_XM_TRACKING_LOCATE()
  287. {
  288.   extern LVAL Wcls_WidgetID_To_WIDGETOBJ(); /* w_classes.c */
  289.   LVAL lval_widget;
  290.   Widget widget_id;
  291.   Cursor cursor;
  292.   LVAL lval_fontcursor_shape;
  293.   long fontcursor_shape;
  294.   Boolean confineto_p;
  295.  
  296.   /* get <widget> */
  297.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&lval_widget);
  298.  
  299.   /* get <fontcursor-FIXNUM> */
  300.   lval_fontcursor_shape = xlgafixnum();
  301.   
  302.   /* get optional [<confine-to-p>] */
  303.   if (moreargs())
  304.     confineto_p = nextarg() ? TRUE : FALSE;
  305.   else
  306.     confineto_p = FALSE;
  307.     
  308.   xllastarg();
  309.  
  310.   /* convert <fontcursor-FIXNUM> to a cursor */
  311.   fontcursor_shape = (long) getfixnum(lval_fontcursor_shape);
  312.   if ((fontcursor_shape & 1L) != 0) /* <fontcursor-FIXNUM> can't be an odd number ... */
  313.     xlerror("Font-Cursor fixnum must be an even number", lval_fontcursor_shape);
  314.   if ((fontcursor_shape < 0L) || (fontcursor_shape > (long) (XC_num_glyphs - 2)))
  315.     xlerror("Font-Cursor fixnum out of range", lval_fontcursor_shape);
  316.   cursor = XCreateFontCursor(XtDisplayOfObject(widget_id),
  317.                  (unsigned int) fontcursor_shape);
  318.  
  319.   return (Wcls_WidgetID_To_WIDGETOBJ(XmTrackingLocate(widget_id, cursor, confineto_p)));
  320. }
  321. #endif                /* WINTERP_MOTIF_11 */
  322.  
  323.  
  324. #ifdef WINTERP_MOTIF_11
  325. /******************************************************************************
  326.  * (XM_CONVERT_UNITS <widget> <orientation> <from_unit_type> <from_value> <to_unit_type>)
  327.  *     ==> Returns the converted value, a FIXNUM.
  328.  *
  329.  * "XmConvertUnits - a function that converts a value in one unit type to
  330.  *  another unit type." (quoted from XmConvertUnits.3X manual page).
  331.  *
  332.  * <widget> is a WIDGETOBJ -- "Specifies the widget for which the data is to be
  333.  * converted."
  334.  *
  335.  * <orientation> is a keyword symbol, either :HORIZONTAL or :VERTICAL
  336.  * "Specifies whether the converter uses the horizontal or vertical screen
  337.  *  resolution when performing the conversions."
  338.  *
  339.  * <from_unit_type> and <to_unit_type> are keyword symbols, either
  340.  * :PIXELS, :100TH_MILLIMETERS, :1000TH_INCHES, :100TH_POINTS, :100TH_FONT_UNITS
  341.  *
  342.  * <from_value> is a FIXNUM.
  343.  *
  344.  * Note that functions XmCvtFromHorizontalPixels(), XmCvtFromVerticalPixels(),
  345.  * XmCvtToHorizontalPixels(), XmCvtToVerticalPixels() have not been interfaced
  346.  * since their functionality can be achieved through XmConvertUnits().
  347.  *
  348.  *----------------------------------------------------------------------------
  349.  * int XmConvertUnits (widget, orientation, from_unit_type,
  350.  *                     from_value, to_unit_type)
  351.  *    Widget    widget;
  352.  *    int       orientation;
  353.  *    int       from_unit_type;
  354.  *    int       from_value;
  355.  *    int       to_unit_type;
  356.  ******************************************************************************/
  357. static LVAL k_VERTICAL, k_HORIZONTAL, k_PIXELS, k_100TH_MILLIMETERS,
  358.   k_1000TH_INCHES, k_100TH_POINTS, k_100TH_FONT_UNITS; /* init'd in Wxm_Init() */
  359. LVAL Wxm_Prim_XM_CONVERT_UNITS()
  360. {
  361.   LVAL lval_widget;
  362.   Widget widget_id;
  363.   LVAL lval_orientation, lval_from_unit_type, lval_to_unit_type;
  364.   int orientation, from_unit_type, to_unit_type, from_value;
  365.  
  366.   /* get <widget> */
  367.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&lval_widget);
  368.  
  369.   /* get  <orientation> */
  370.   lval_orientation = xlgetarg();
  371.   if (lval_orientation == k_VERTICAL)
  372.     orientation = XmVERTICAL;
  373.   else if (lval_orientation == k_HORIZONTAL)
  374.     orientation = XmHORIZONTAL;
  375.   else
  376.     xlerror("Invalid orientation value, expected :VERTICAL or :HORIZONTAL",
  377.         lval_orientation);
  378.  
  379.   /* get <from_unit_type> */
  380.   lval_from_unit_type = xlgetarg();
  381.   if (lval_from_unit_type == k_PIXELS)
  382.     from_unit_type = XmPIXELS;
  383.   else if (lval_from_unit_type == k_100TH_MILLIMETERS)
  384.     from_unit_type = Xm100TH_MILLIMETERS;
  385.   else if (lval_from_unit_type == k_1000TH_INCHES)
  386.     from_unit_type = Xm1000TH_INCHES;
  387.   else if (lval_from_unit_type == k_100TH_POINTS)
  388.     from_unit_type = Xm100TH_POINTS;
  389.   else if (lval_from_unit_type == k_100TH_FONT_UNITS)
  390.     from_unit_type = Xm100TH_FONT_UNITS;
  391.   else 
  392.     xlerror("Invalid <from_unit_type> keyword, expected one of [:PIXELS, :100TH_MILLIMETERS, :1000TH_INCHES, :100TH_POINTS, :100TH_FONT_UNITS].",
  393.         lval_from_unit_type);
  394.  
  395.   /* get <from_value> */
  396.   from_value = (long) getfixnum(xlgafixnum());
  397.  
  398.   /* get <to_unit_type> */
  399.   lval_to_unit_type = xlgetarg();
  400.   if (lval_to_unit_type == k_PIXELS)
  401.     to_unit_type = XmPIXELS;
  402.   else if (lval_to_unit_type == k_100TH_MILLIMETERS)
  403.     to_unit_type = Xm100TH_MILLIMETERS;
  404.   else if (lval_to_unit_type == k_1000TH_INCHES)
  405.     to_unit_type = Xm1000TH_INCHES;
  406.   else if (lval_to_unit_type == k_100TH_POINTS)
  407.     to_unit_type = Xm100TH_POINTS;
  408.   else if (lval_to_unit_type == k_100TH_FONT_UNITS)
  409.     to_unit_type = Xm100TH_FONT_UNITS;
  410.   else 
  411.     xlerror("Invalid <to_unit_type> keyword, expected one of [:PIXELS, :100TH_MILLIMETERS, :1000TH_INCHES, :100TH_POINTS, :100TH_FONT_UNITS].",
  412.         lval_to_unit_type);
  413.  
  414.   xllastarg();
  415.  
  416.   return (cvfixnum((FIXTYPE) XmConvertUnits(widget_id,
  417.                         orientation,
  418.                         from_unit_type,
  419.                         from_value,
  420.                         to_unit_type)));
  421. }
  422. #endif                /* WINTERP_MOTIF_11 */
  423.  
  424.  
  425. #ifdef WINTERP_MOTIF_11
  426. /******************************************************************************
  427.  * (send <widget> :PROCESS_TRAVERSAL <direction>)
  428.  *    ==> "Returns T if the setting succeeded.  Returns NIL if the
  429.  *           keyboard focus policy is not :EXPLICIT, if there are no
  430.  *           traversable items, or if the call to the routine has invalid
  431.  *           parameters."
  432.  *
  433.  * "a function that determines which component receives keyboard events
  434.  *  when a widget has the focus." (from XmProcessTraversal.3X manual page)
  435.  *
  436.  * <direction> is a keyword symbol, one of the following:
  437.  * :TRAVERSE_CURRENT
  438.  *    "Finds the hierarchy and the tab group that contain widget.
  439.  *     If this tab group is not the active tab group, makes it the
  440.  *     active tab group.  If widget is an item in the active tab
  441.  *     group, makes it the active item.  If widget is the active
  442.  *     tab group, makes the first traversable item in the tab group
  443.  *     the active item."
  444.  * :TRAVERSE_DOWN
  445.  *     "Finds the hierarchy that contains widget.  Finds the active
  446.  *     item in the active tab group and makes the item below it the
  447.  *     active item.  If there is no item below, wraps."
  448.  * :TRAVERSE_HOME
  449.  *     "Finds the hierarchy that contains widget.  Finds the active item
  450.  *     in the active tab group and makes the first traversable item in
  451.  *     the tab group the active item."
  452.  * :TRAVERSE_LEFT
  453.  *      "Finds the hierarchy that contains widget.  Finds the active item
  454.  *     in the active tab group and makes the item to the left the active
  455.  *     item.  If there is no item to the left, wraps."
  456.  * :TRAVERSE_NEXT
  457.  *      "Finds the hierarchy that contains widget.  Finds the active item
  458.  *      in the active tab group and makes the next item the active item."
  459.  * :TRAVERSE_NEXT_TAB_GROUP
  460.  *      "Finds the hierarchy that contains widget.  Finds the active tab
  461.  *      group (if any) and makes the next tab group the active tab group
  462.  *    in the hierarchy."
  463.  * :TRAVERSE_PREV
  464.  *      "Finds the hierarchy that contains widget.  Finds the active item
  465.  *      in the active tab group and makes the previous item the active item."
  466.  * :TRAVERSE_PREV_TAB_GROUP
  467.  *      "Finds the hierarchy that contains widget.  Finds the active tab
  468.  *      group (if any) and makes the previous tab group the active tab
  469.  *      group in the hierarchy.
  470.  * :TRAVERSE_RIGHT
  471.  *     "Finds the hierarchy that contains widget.  Finds the active item
  472.  *     in the active tab group and makes the item to the right the active
  473.  *     item.  If there is no item to the right, wraps."
  474.  * :TRAVERSE_UP
  475.  *     "Finds the hierarchy that contains widget. Finds the active item
  476.  *    in the active tab group and makes the item above it the active item.
  477.  *      If there is no item above, wraps."
  478.  *----------------------------------------------------------------------------
  479.  *          Boolean XmProcessTraversal (widget, direction)
  480.  *               Widget    widget;
  481.  *               int       direction;
  482.  ******************************************************************************/
  483. static LVAL k_TRAVERSE_CURRENT, k_TRAVERSE_NEXT, k_TRAVERSE_PREV, k_TRAVERSE_HOME,
  484.   k_TRAVERSE_NEXT_TAB_GROUP, k_TRAVERSE_PREV_TAB_GROUP, k_TRAVERSE_UP, k_TRAVERSE_DOWN,
  485.   k_TRAVERSE_LEFT, k_TRAVERSE_RIGHT; /* init'd in Wxm_Init() */
  486. LVAL Widget_Class_Method_PROCESS_TRAVERSAL()
  487. {
  488.   extern LVAL true;
  489.   LVAL self;
  490.   Widget widget_id;
  491.   int direction;
  492.   LVAL lval_direction;
  493.  
  494.   /* get <widget> */
  495.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  496.  
  497.   /* get <direction> */
  498.   lval_direction = xlgetarg();
  499.   if (lval_direction == k_TRAVERSE_CURRENT)
  500.     direction = XmTRAVERSE_CURRENT;
  501.   else if (lval_direction == k_TRAVERSE_NEXT)
  502.     direction = XmTRAVERSE_NEXT;
  503.   else if (lval_direction == k_TRAVERSE_PREV)
  504.     direction = XmTRAVERSE_PREV;
  505.   else if (lval_direction == k_TRAVERSE_HOME)
  506.     direction = XmTRAVERSE_HOME;
  507.   else if (lval_direction == k_TRAVERSE_NEXT_TAB_GROUP)
  508.     direction = XmTRAVERSE_NEXT_TAB_GROUP;
  509.   else if (lval_direction == k_TRAVERSE_PREV_TAB_GROUP)
  510.     direction = XmTRAVERSE_PREV_TAB_GROUP;
  511.   else if (lval_direction == k_TRAVERSE_UP)
  512.     direction = XmTRAVERSE_UP;
  513.   else if (lval_direction == k_TRAVERSE_DOWN)
  514.     direction = XmTRAVERSE_DOWN;
  515.   else if (lval_direction == k_TRAVERSE_LEFT)
  516.     direction = XmTRAVERSE_LEFT;
  517.   else if (lval_direction == k_TRAVERSE_RIGHT)
  518.     direction = XmTRAVERSE_RIGHT;
  519.   else 
  520.     xlerror("Invalid traversal direction keyword, expected one of [:TRAVERSE_CURRENT, :TRAVERSE_NEXT, :TRAVERSE_PREV, :TRAVERSE_HOME, :TRAVERSE_NEXT_TAB_GROUP, :TRAVERSE_PREV_TAB_GROUP, :TRAVERSE_UP, :TRAVERSE_DOWN, :TRAVERSE_LEFT, :TRAVERSE_RIGHT].",
  521.         lval_direction);
  522.  
  523.   xllastarg();
  524.  
  525.   return (XmProcessTraversal(widget_id, direction) ? true : NIL);
  526. }
  527. #endif                /* WINTERP_MOTIF_11 */
  528.  
  529.  
  530. /******************************************************************************
  531.  * (XM_SET_MENU_CURSOR <fontcursor>)
  532.  *    ==> Returns NIL.
  533.  *
  534.  *  "XmSetMenuCursor programmatically modifies the menu cursor for a client;
  535.  *  after the cursor has been created by the client, this function registers
  536.  *  the cursor with the menu system.  After calling this function, the
  537.  *  specified cursor is displayed whenever this client displays a Motif
  538.  *  menu on the indicated display.  The client can then specify different
  539.  *  cursors on different displays." (from XmSetMenuCursor.3X manual page).
  540.  *
  541.  * <fontcursor>> specifies the shape of the cursor for this interaction.
  542.  * The value of this FIXNUM specifies a font whose name/value is defined in
  543.  * /usr/include/X11/cursorfont.h.
  544.  *
  545.  * Note: when WINTERP allows for multiple displays, this function will
  546.  * end up changing arg sequences to accomodate a <display> arg.
  547.  *----------------------------------------------------------------------------
  548.  *           void XmSetMenuCursor (display, cursorId)
  549.  *                Display   * display;
  550.  *                Cursor    cursorId;
  551.  ******************************************************************************/
  552. LVAL Wxm_Prim_XM_SET_MENU_CURSOR()
  553. {
  554.   extern Display* display;    /* from winterp.c -- this'll have to change when WINTERP gets updated for multi-display. */
  555.   Cursor cursor;
  556.   LVAL lval_fontcursor_shape;
  557.   long fontcursor_shape;
  558.  
  559.   /* get <fontcursor> */
  560.   lval_fontcursor_shape = xlgafixnum();
  561.   
  562.   xllastarg();
  563.  
  564.   /* convert <fontcursor> to a cursor */
  565.   fontcursor_shape = (long) getfixnum(lval_fontcursor_shape);
  566.   if ((fontcursor_shape & 1L) != 0) /* <fontcursor-FIXNUM> can't be an odd number ... */
  567.     xlerror("Font-Cursor fixnum must be an even number", lval_fontcursor_shape);
  568.   if ((fontcursor_shape < 0L) || (fontcursor_shape > (long) (XC_num_glyphs - 2)))
  569.     xlerror("Font-Cursor fixnum out of range", lval_fontcursor_shape);
  570.   cursor = XCreateFontCursor(display, (unsigned int) fontcursor_shape);
  571.  
  572.   XmSetMenuCursor(display, cursor);
  573.   return (NIL);
  574. }
  575.  
  576.  
  577. #ifdef THE_FOLLOWING_CODE_IS_COMMENTED_OUT /* punt because XmGetDestination() missing in HP's UEDK Motif 1.1, it's there in OSFMotif 1.1 */
  578. /******************************************************************************
  579.  * (XM_GET_DESTINATION)
  580.  *     ==> Returns a WIDGETOBJ, "the widget to be used as the current
  581.  *        destination for quick paste and certain clipboard operations."
  582.  *        Returns NIL if "there is no current destination".
  583.  *
  584.  * See XmGetDestination.3X manual page for details.
  585.  *-----------------------------------------------------------------------------
  586.  *           Widget XmGetDestination (display)
  587.  *                Display   *display;
  588.  ******************************************************************************/
  589. LVAL Wxm_Prim_XM_GET_DESTINATION()
  590. {
  591.   extern LVAL Wcls_WidgetID_To_WIDGETOBJ(); /* w_classes.c */
  592.   extern Display* display;    /* winterp.c */
  593.   xllastarg();
  594.   return (Wcls_WidgetID_To_WIDGETOBJ(XmGetDestination(display)));
  595. }
  596. #endif                /* THE_FOLLOWING_CODE_IS_COMMENTED_OUT */
  597.  
  598.  
  599. /******************************************************************************
  600.  *
  601.  ******************************************************************************/
  602. Wxm_Init()
  603. {
  604. #ifdef WINTERP_MOTIF_11
  605.   /* these are used by Wxm_Prim_XM_CONVERT_UNITS(), which is Motif 1.1 only */
  606.   k_VERTICAL        = xlenter(":VERTICAL");
  607.   k_HORIZONTAL        = xlenter(":HORIZONTAL");
  608.   k_PIXELS        = xlenter(":PIXELS");
  609.   k_100TH_MILLIMETERS    = xlenter(":100TH_MILLIMETERS");
  610.   k_1000TH_INCHES    = xlenter(":1000TH_INCHES");
  611.   k_100TH_POINTS    = xlenter(":100TH_POINTS");
  612.   k_100TH_FONT_UNITS    = xlenter(":100TH_FONT_UNITS");
  613.  
  614.   /* these are used by Widget_Class_Method_PROCESS_TRAVERSAL(), which is Motif 1.1 only */
  615.   k_TRAVERSE_CURRENT    = xlenter(":TRAVERSE_CURRENT");
  616.   k_TRAVERSE_NEXT    = xlenter(":TRAVERSE_NEXT");
  617.   k_TRAVERSE_PREV    = xlenter(":TRAVERSE_PREV");
  618.   k_TRAVERSE_HOME    = xlenter(":TRAVERSE_HOME");
  619.   k_TRAVERSE_NEXT_TAB_GROUP = xlenter(":TRAVERSE_NEXT_TAB_GROUP");
  620.   k_TRAVERSE_PREV_TAB_GROUP = xlenter(":TRAVERSE_PREV_TAB_GROUP");
  621.   k_TRAVERSE_UP        = xlenter(":TRAVERSE_UP");
  622.   k_TRAVERSE_DOWN    = xlenter(":TRAVERSE_DOWN");
  623.   k_TRAVERSE_LEFT    = xlenter(":TRAVERSE_LEFT");
  624.   k_TRAVERSE_RIGHT    = xlenter(":TRAVERSE_RIGHT");
  625. #endif                /* WINTERP_MOTIF_11 */
  626. }
  627.