view lwlib/lwlib-Xlw.c @ 1314:15a91d7ae2d1

[xemacs-hg @ 2003-02-20 08:16:21 by ben] check in makefile fixes et al Makefile.in.in: Major surgery. Move all stuff related to building anything in the src/ directory into src/. Simplify the dependencies -- everything in src/ is dependent on the single entry `src' in MAKE_SUBDIRS. Remove weirdo targets like `all-elc[s]', dump-elc[s], etc. mule/mule-msw-init.el: Removed. Delete this file. mule/mule-win32-init.el: New file, with stuff from mule-msw-init.el -- not just for MS Windows native, boys and girls! bytecomp.el: Change code inserted to catch trying to load a Mule-only .elc file in a non-Mule XEmacs. Formerly you got the rather cryptic "The required feature `mule' cannot be provided". Now you get "Loading this file requires Mule support". finder.el: Remove dependency on which directory this function is invoked from. update-elc.el: Don't mess around with ../src/BYTECOMPILE_CHANGE. Now that Makefile.in.in and xemacs.mak are in sync, both of them use NEEDTODUMP and the other one isn't used. dumped-lisp.el: Rewrite in terms of `list' and `nconc' instead of assemble-list, so we can have arbitrary forms, not just `when-feature'. very-early-lisp.el: Nuke this file. finder-inf.el, packages.el, update-elc.el, update-elc-2.el, loadup.el, make-docfile.el: Eliminate references to very-early-lisp. msw-glyphs.el: Comment clarification. xemacs.mak: Add macros DO_TEMACS, DO_XEMACS, and a few others; this macro section is now completely in sync with src/Makefile.in.in. Copy check-features, load-shadows, and rebuilding finder-inf.el from src/Makefile.in.in. The main build/dump/recompile process is now synchronized with src/Makefile.in.in. Change `WARNING' to `NOTE' and `error checking' to `error-checking' TO avoid tripping faux warnings and errors in the VC++ IDE. Makefile.in.in: Major surgery. Move all stuff related to building anything in the src/ directory from top-level Makefile.in.in to here. Simplify the dependencies. Rearrange into logical subsections. Synchronize the main compile/dump/build-elcs section with xemacs.mak, which is already clean and in good working order. Remove weirdo targets like `all-elc[s]', dump-elc[s], etc. Add additional levels of macros \(e.g. DO_TEMACS, DO_XEMACS, TEMACS_BATCH, XEMACS_BATCH, XEMACS_BATCH_PACKAGES) to factor out duplicated stuff. Clean up handling of "HEAP_IN_DATA" (Cygwin) so it doesn't need to ignore the return value from dumping. Add .NO_PARALLEL since various aspects of building and dumping must be serialized but do not always have dependencies between them (this is impossible in some cases). Everything related to src/ now gets built in one pass in this directory by just running `make' (except the Makefiles themselves and config.h, paths.h, Emacs.ad.h, and other generated .h files). console.c: Update list of possibly valid console types. emacs.c: Rationalize the specifying and handling of the type of the first frame. This was originally prompted by a workspace in which I got GTK to compile under C++ and in the process fixed it so it could coexist with X in the same build -- hence, a combined TTY/X/MS-Windows/GTK build is now possible under Cygwin. (However, you can't simultaneously *display* more than one kind of device connection -- but getting that to work is not that difficult. Perhaps a project for a bored grad student. I (ben) would do it but don't see the use.) To make sense of this, I added new switches that can be used to specifically indicate the window system: -x [aka --use-x], -tty \[aka --use-tty], -msw [aka --use-ms-windows], -gtk [aka --use-gtk], and -gnome [aka --use-gnome, same as --use-gtk]. -nw continues as an alias for -tty. When none have been given, XEmacs checks for other parameters implying particular device types (-t -> tty, -display -> x [or should it have same treatment as DISPLAY below?]), and has ad-hoc logic afterwards: if env var DISPLAY is set, use x (or gtk? perhaps should check whether gnome is running), else MS Windows if it exsits, else TTY if it exists, else stream, and you must be running in batch mode. This also fixes an existing bug whereby compiling with no x, no mswin, no tty, when running non- interactively (e.g. to dump) I get "sorry, must have TTY support". emacs.c: Turn on Vstack_trace_on_error so that errors are debuggable even when occurring extremely early in reinitialization. emacs.c: Try to make sure that the user can see message output under Windows (i.e. it doesn't just disappear right away) regardless of when it occurs, e.g. in the middle of creating the first frame. emacs.c: Define new function `emacs-run-status', indicating whether XEmacs is noninteractive or interactive, whether raw, post-dump/pdump-load or run-temacs, whether we are dumping, whether pdump is in effect. event-stream.c: It's "mommas are fat", not "momas are fat". Fix other typo. event-stream.c: Conditionalize in_menu_callback check on HAVE_MENUBARS, because it won't exist on w/o menubar support, lisp.h: More hackery on RETURN_NOT_REACHED. Cygwin v3.2 DOES complain here if RETURN_NOT_REACHED() is blank, as it is for GCC 2.5+. So make it blank only for GCC 2.5 through 2.999999999999999. Declare Vstack_trace_on_error. profile.c: Need to include "profile.h" to fix warnings. sheap.c: Don't fatal() when need to rerun Make, just stderr_out() and exit(0). That way we can distinguish between a dumping failing expectedly (due to lack of stack space, triggering another dump) and unexpectedly, in which case, we want to stop building. (or go on, if -K is given) syntax.c, syntax.h: Use ints where they belong, and enum syntaxcode's where they belong, and fix warnings thereby. syntax.h: Fix crash caused by an edge condition in the syntax-cache macros. text.h: Spacing fixes. xmotif.h: New file, to get around shadowing warnings. EmacsManager.c, event-Xt.c, glyphs-x.c, gui-x.c, input-method-motif.c, xmmanagerp.h, xmprimitivep.h: Include xmotif.h. alloc.c: Conditionalize in_malloc on ERROR_CHECK_MALLOC. config.h.in, file-coding.h, fileio.c, getloadavg.c, select-x.c, signal.c, sysdep.c, sysfile.h, systime.h, text.c, unicode.c: Eliminate HAVE_WIN32_CODING_SYSTEMS, use WIN32_ANY instead. Replace defined (WIN32_NATIVE) || defined (CYGWIN) with WIN32_ANY. lisp.h: More futile attempts to walk and chew gum at the same time when dealing with subr's that don't return.
author ben
date Thu, 20 Feb 2003 08:16:21 +0000
parents c2569faae8ed
children 04bc9d2f42c7
line wrap: on
line source

/* The lwlib interface to "xlwmenu" menus.
   Copyright (C) 1992, 1994 Lucid, Inc.

This file is part of the Lucid Widget Library.

The Lucid Widget Library is free software; you can redistribute it and/or 
modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

The Lucid Widget Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with XEmacs; see the file COPYING.  If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.  */

#include <config.h>
#include <stdlib.h> /* for abort () */
#include <stdio.h> /* for abort () */
#include <limits.h>

#include "lwlib-Xlw.h"
#include "lwlib-utils.h"
#include <X11/StringDefs.h>
#include <X11/IntrinsicP.h>
#include <X11/ObjectP.h>
#include <X11/CompositeP.h>
#include <X11/Shell.h>
#ifdef HAVE_X_WIDGETS
#include "../src/EmacsManager.h"
#endif
#ifdef LWLIB_MENUBARS_LUCID
#include "xlwmenu.h"
#endif
#ifdef LWLIB_SCROLLBARS_LUCID
#include "xlwscrollbar.h"
#endif
#ifdef LWLIB_TABS_LUCID
#ifdef NEED_MOTIF
#include "lwlib-Xm.h"
#endif
#ifdef NEED_ATHENA
#include "lwlib-Xaw.h"
#endif
#include "../src/xmu.h"
#include "xlwtabs.h"
#endif



#ifdef LWLIB_MENUBARS_LUCID

/* Menu callbacks */

static void
pre_hook (Widget w, XtPointer client_data, XtPointer call_data)
{
  widget_instance* instance = (widget_instance*)client_data;
  widget_value* val;
  
  if (w->core.being_destroyed)
    return;

  val = lw_get_widget_value_for_widget (instance, w);
#if 0
  /* #### - this code used to (for some random back_asswards reason) pass
  the expression below in the call_data slot.  For incremental menu
  construction, this needs to go.  I can't even figure out why it was done
  this way in the first place...it's just a historical weirdism. --Stig */
  call_data = (val ? val->call_data : NULL);
#endif 
  if (val && val->call_data)
    abort();			/* #### - the call_data for the top_level
				   "menubar" widget_value used to be passed
				   back to the pre_hook. */

  if (instance->info->pre_activate_cb)
    instance->info->pre_activate_cb (w, instance->info->id, call_data);
}

static void
pick_hook (Widget w, XtPointer client_data, XtPointer call_data)
{
  widget_instance* instance = (widget_instance*)client_data;
  widget_value* contents_val = (widget_value*)call_data;
  widget_value* widget_val;
  XtPointer widget_arg;
  LWLIB_ID id;
  lw_callback post_activate_cb;

  if (w->core.being_destroyed)
    return;

  /* Grab these values before running any functions, in case running
     the selection_cb causes the widget to be destroyed. */
  id = instance->info->id;
  post_activate_cb = instance->info->post_activate_cb;

  widget_val = lw_get_widget_value_for_widget (instance, w);
  widget_arg = widget_val ? widget_val->call_data : NULL;

  if (instance->info->selection_cb &&
      contents_val &&
      contents_val->enabled &&
      !contents_val->contents)
    instance->info->selection_cb (w, id, contents_val->call_data);

  if (post_activate_cb)
    post_activate_cb (w, id, widget_arg);
}



/* creation functions */
static Widget
xlw_create_menubar (widget_instance* instance)
{
  Arg al [1];
  Widget widget;
  
  XtSetArg (al [0], XtNmenu, instance->info->val);
  widget = XtCreateWidget (instance->info->name, xlwMenuWidgetClass,
			   instance->parent, al, 1);
  XtAddCallback (widget, XtNopen,   pre_hook,  (XtPointer)instance);
  XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
  return widget;
}

static Widget
xlw_create_popup_menu (widget_instance* instance)
{
  Arg al [2];
  Widget popup_shell, widget;
  
  popup_shell = XtCreatePopupShell (instance->info->name,
				    overrideShellWidgetClass,
				    instance->parent, NULL, 0);
  XtSetArg (al [0], XtNmenu, instance->info->val);
  XtSetArg (al [1], XtNhorizontal, False);
  widget = XtCreateManagedWidget ("popup", xlwMenuWidgetClass,
				  popup_shell, al, 2);
  XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);

  return popup_shell;
}
#endif /* LWLIB_MENUBARS_LUCID */

#ifdef LWLIB_SCROLLBARS_LUCID
static void
xlw_scrollbar_callback (Widget widget, XtPointer closure, XtPointer call_data)
{
  widget_instance *instance = (widget_instance *) closure;
  LWLIB_ID id;
  XlwScrollBarCallbackStruct *data =
    (XlwScrollBarCallbackStruct *) call_data;
  scroll_event event_data;
  scrollbar_values *val =
    (scrollbar_values *) instance->info->val->scrollbar_data;
  double percent;

  if (!instance || widget->core.being_destroyed)
    return;

  id = instance->info->id;

  percent = (double) (data->value - 1) / (double) (INT_MAX - 1);
  event_data.slider_value =
    (int) (percent * (double) (val->maximum - val->minimum)) + val->minimum;

  if (event_data.slider_value > val->maximum - val->slider_size)
      event_data.slider_value = val->maximum - val->slider_size;
  else if (event_data.slider_value < val->minimum)
           event_data.slider_value = val->minimum;

  if (data->event)
    {
      switch (data->event->type)
	{
	case KeyPress:
	case KeyRelease:
	  event_data.time = data->event->xkey.time;
	  break;
	case ButtonPress:
	case ButtonRelease:
	  event_data.time = data->event->xbutton.time;
	  break;
	case MotionNotify:
	  event_data.time = data->event->xmotion.time;
	  break;
	case EnterNotify:
	case LeaveNotify:
	  event_data.time = data->event->xcrossing.time;
	  break;
	default:
	  event_data.time = 0;
	  break;
	}
    }
  else
    event_data.time = 0;

  switch (data->reason)
    {
    case XmCR_DECREMENT:	event_data.action = SCROLLBAR_LINE_UP;   break;
    case XmCR_INCREMENT:	event_data.action = SCROLLBAR_LINE_DOWN; break;
    case XmCR_PAGE_DECREMENT:	event_data.action = SCROLLBAR_PAGE_UP;   break;
    case XmCR_PAGE_INCREMENT:	event_data.action = SCROLLBAR_PAGE_DOWN; break;
    case XmCR_TO_TOP:		event_data.action = SCROLLBAR_TOP;       break;
    case XmCR_TO_BOTTOM:	event_data.action = SCROLLBAR_BOTTOM;    break;
    case XmCR_DRAG:		event_data.action = SCROLLBAR_DRAG;      break;
    case XmCR_VALUE_CHANGED:	event_data.action = SCROLLBAR_CHANGE;    break;
    default:			event_data.action = SCROLLBAR_CHANGE;    break;
    }

  if (instance->info->pre_activate_cb)
    instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
}

#define add_scrollbar_callback(resource) \
XtAddCallback (scrollbar, resource, xlw_scrollbar_callback, (XtPointer) instance)

/* #### Does not yet support horizontal scrollbars. */
static Widget
xlw_create_scrollbar (widget_instance *instance, int vertical)
{
  Arg al[20];
  int ac = 0;
  static XtCallbackRec callbacks[2] =
  { {xlw_scrollbar_callback, NULL}, {NULL, NULL} };

  callbacks[0].closure  = (XtPointer) instance;

  XtSetArg (al[ac], XmNminimum,       1); ac++;
  XtSetArg (al[ac], XmNmaximum, INT_MAX); ac++;
  XtSetArg (al[ac], XmNincrement,     1); ac++;
  XtSetArg (al[ac], XmNpageIncrement, 1); ac++;
  XtSetArg (al[ac], XmNorientation, (vertical ? XmVERTICAL : XmHORIZONTAL)); ac++;

  XtSetArg (al[ac], XmNdecrementCallback,	callbacks); ac++;
  XtSetArg (al[ac], XmNdragCallback,		callbacks); ac++;
  XtSetArg (al[ac], XmNincrementCallback,	callbacks); ac++;
  XtSetArg (al[ac], XmNpageDecrementCallback,	callbacks); ac++;
  XtSetArg (al[ac], XmNpageIncrementCallback,	callbacks); ac++;
  XtSetArg (al[ac], XmNtoBottomCallback,	callbacks); ac++;
  XtSetArg (al[ac], XmNtoTopCallback,		callbacks); ac++;
  XtSetArg (al[ac], XmNvalueChangedCallback,	callbacks); ac++;

  return XtCreateWidget (instance->info->name, xlwScrollBarWidgetClass,
			 instance->parent, al, ac);
}

static Widget
xlw_create_vertical_scrollbar (widget_instance *instance)
{
  return xlw_create_scrollbar (instance, 1);
}

static Widget
xlw_create_horizontal_scrollbar (widget_instance *instance)
{
  return xlw_create_scrollbar (instance, 0);
}

static void
xlw_update_scrollbar (widget_instance *instance, Widget widget,
		      widget_value *val)
{
  if (val->scrollbar_data)
    {
      scrollbar_values *data = val->scrollbar_data;
      int widget_sliderSize, widget_val;
      int new_sliderSize, new_value;
      double percent;
      Arg al [4];

      /* First size and position the scrollbar widget. */
      XtSetArg (al [0], XtNx,      data->scrollbar_x);
      XtSetArg (al [1], XtNy,      data->scrollbar_y);
      XtSetArg (al [2], XtNwidth,  data->scrollbar_width);
      XtSetArg (al [3], XtNheight, data->scrollbar_height);
      XtSetValues (widget, al, 4);

      /* Now size the scrollbar's slider. */
      XtSetArg (al [0], XmNsliderSize, &widget_sliderSize);
      XtSetArg (al [1], XmNvalue,      &widget_val);
      XtGetValues (widget, al, 2);

      percent = (double) data->slider_size /
	(double) (data->maximum - data->minimum);
      percent = (percent > 1.0 ? 1.0 : percent);
      new_sliderSize = (int) ((double) (INT_MAX - 1) * percent);

      percent = (double) (data->slider_position - data->minimum) /
	(double) (data->maximum - data->minimum);
      percent = (percent > 1.0 ? 1.0 : percent);
      new_value = (int) ((double) (INT_MAX - 1) * percent);

      if (new_sliderSize > INT_MAX - 1)
	new_sliderSize = INT_MAX - 1;
      else if (new_sliderSize < 1)
	new_sliderSize = 1;

      if (new_value > (INT_MAX - new_sliderSize))
	new_value = INT_MAX - new_sliderSize;
      else if (new_value < 1)
	new_value = 1;

      if (new_sliderSize != widget_sliderSize || new_value != widget_val)
	XlwScrollBarSetValues (widget, new_value, new_sliderSize, 1, 1, False);
    }
}

#endif /* LWLIB_SCROLLBARS_LUCID */

#ifdef LWLIB_TABS_LUCID
/* tab control
   
   lwlib is such an incredible hairy crock. I just cannot believe
   it! There are random dependencies between functions, there is a
   total lack of genericity, even though it initially appears to be
   generic. It should all be junked and begun again. Building tabs are
   an example - in theory we should be able to reuse a lot of the
   general stuff because we want to put labels of whatever toolkit we
   are using in the tab. Instead we have to hack it by hand. */
static void
xlw_tab_control_callback (Widget w, XtPointer client_data, XtPointer call_data)
{
  /* call data is the topmost widget */
  widget_instance* instance = (widget_instance*)client_data;
  Widget top = (Widget)call_data;
  char *name = XtName (top);
  widget_value* widget_val;
  XtPointer widget_arg;
  LWLIB_ID id;
  lw_callback post_activate_cb;

  if (w->core.being_destroyed)
    return;

  /* Grab these values before running any functions, in case running
     the selection_cb causes the widget to be destroyed. */
  id = instance->info->id;
  post_activate_cb = instance->info->post_activate_cb;

  /* search for the widget_val for the selected tab */
  for (widget_val = instance->info->val->contents; widget_val; 
       widget_val = widget_val->next)
    {
      if (!strcmp (widget_val->name, name))
	break;
    }

  widget_arg = widget_val ? widget_val->call_data : NULL;

  if (instance->info->selection_cb &&
      widget_val &&
      widget_val->enabled &&
      !widget_val->contents)
    instance->info->selection_cb (w, id, widget_arg);

  if (post_activate_cb)
    post_activate_cb (w, id, widget_arg);
}

static Widget
xlw_create_tab_control (widget_instance *instance)
{
  Arg al[20];
  int ac = 0;
  Widget tab = 0;
  widget_value* val = instance->info->val;

  XtSetArg (al [ac], XtNsensitive, val->enabled);		ac++;
  XtSetArg (al [ac], XtNmappedWhenManaged, FALSE);	ac++;
  XtSetArg (al [ac], XtNorientation, XtorientHorizontal);	ac++;
  XtSetArg (al [ac], XtNresizable, False);			ac++;

  /* add any args the user supplied for creation time */
  lw_add_value_args_to_args (val, al, &ac);

  tab = XtCreateManagedWidget (val->name, tabsWidgetClass,
			       instance->parent, al, ac);
  XtRemoveAllCallbacks (tab, XtNcallback);
  XtAddCallback (tab, XtNcallback, xlw_tab_control_callback, (XtPointer)instance);

  XtManageChild (tab);

  return tab;
}

static void build_tabs_in_widget (widget_instance* instance, Widget widget, 
				  widget_value* val)
{
  widget_value* cur = val;
  for (cur = val; cur; cur = cur->next)
    {
      if (cur->value)
	{
#ifdef LWLIB_WIDGETS_MOTIF
	  xm_create_label (widget, cur);
#else
	  xaw_create_label (widget, cur);
#endif
	}
      cur->change = NO_CHANGE;
    }
}

static void
xlw_update_tab_control (widget_instance* instance, Widget widget, widget_value* val)
{
  Widget* children;
  unsigned int num_children;
  Dimension i;
  widget_value *cur = 0;

  XtRemoveAllCallbacks (widget, XtNcallback);
  XtAddCallback (widget, XtNcallback, xlw_tab_control_callback, (XtPointer)instance);

  if (val->change == STRUCTURAL_CHANGE
      ||
      (val->contents && val->contents->change == STRUCTURAL_CHANGE))
    {
      destroy_all_children (widget);
      build_tabs_in_widget (instance, widget, val->contents);
    }

  children = XtCompositeChildren (widget, &num_children);
  if (children)
    {
      for (i = 0, cur = val->contents; i < (int) num_children; i++)
	{
	  if (!cur)
	    abort ();
	  if (children [i]->core.being_destroyed
	      || strcmp (XtName (children [i]), cur->name))
	    continue;
#ifdef NEED_MOTIF
	  if (lw_motif_widget_p (children [i]))
	    xm_update_one_widget (instance, children [i], cur, False);
#endif
#ifdef NEED_ATHENA
	  if (lw_xaw_widget_p (children [i]))
	    xaw_update_one_widget (instance, children [i], cur, False);
#endif
	  cur = cur->next;
	}
      XtFree ((char *) children);
    }
  if (cur)
    abort ();
}
#endif /* LWLIB_TABS_LUCID */

#ifdef HAVE_X_WIDGETS
static Widget
xlw_create_clip_window (widget_instance *instance)
{
  Arg al[20];
  int ac = 0;
  Widget clip = 0;
  widget_value* val = instance->info->val;

  XtSetArg (al [ac], XtNmappedWhenManaged, FALSE);	ac++;
  XtSetArg (al [ac], XtNsensitive, TRUE);		ac++;
  /* add any args the user supplied for creation time */
  lw_add_value_args_to_args (val, al, &ac);

  /* Create a clip window to contain the subwidget. Incredibly the
     XEmacs manager seems to be the most appropriate widget for
     this. Nothing else is simple enough and yet does what is
     required. */
  clip = XtCreateManagedWidget (val->name,
				emacsManagerWidgetClass,
				instance->parent, al, ac);

  return clip;
}
#endif

const widget_creation_entry 
xlw_creation_table [] =
{
#ifdef LWLIB_MENUBARS_LUCID
  {"menubar", xlw_create_menubar},
  {"popup", xlw_create_popup_menu},
#endif
#ifdef LWLIB_SCROLLBARS_LUCID
  {"vertical-scrollbar",	xlw_create_vertical_scrollbar},
  {"horizontal-scrollbar",	xlw_create_horizontal_scrollbar},
#endif
#ifdef LWLIB_TABS_LUCID
  {"tab-control",	xlw_create_tab_control},
#endif
#ifdef HAVE_X_WIDGETS
  {"clip-window", xlw_create_clip_window},
#endif
  {NULL, NULL}
};

Boolean
lw_lucid_widget_p (Widget widget)
{
  WidgetClass the_class = XtClass (widget);
#ifdef LWLIB_MENUBARS_LUCID
  if (the_class == xlwMenuWidgetClass)
    return True;
#endif
#ifdef LWLIB_SCROLLBARS_LUCID
  if (the_class == xlwScrollBarWidgetClass)
    return True;
#endif
#ifdef LWLIB_TABS_LUCID
  if (the_class == tabsWidgetClass)
    return True;
#endif
#ifdef LWLIB_MENUBARS_LUCID
  if (the_class == overrideShellWidgetClass)
    return
      XtClass (((CompositeWidget)widget)->composite.children [0])
	== xlwMenuWidgetClass;
#endif
#ifdef HAVE_X_WIDGETS
  if (the_class == emacsManagerWidgetClass)
    return True;
#endif
  return False;
}

void
xlw_update_one_widget (widget_instance* instance, Widget widget,
		       widget_value* val, Boolean deep_p)
{
  WidgetClass class_ = XtClass (widget);

  if (0)
    ;
#ifdef LWLIB_MENUBARS_LUCID
  else if (class_ == xlwMenuWidgetClass)
    {
      XlwMenuWidget mw;
      Arg al [1];
      if (XtIsShell (widget))
	mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0];
      else
	mw = (XlwMenuWidget)widget;
      XtSetArg (al [0], XtNmenu, val);
      XtSetValues (widget, al, 1); /* #### mw unused! */
    }
#endif
#ifdef LWLIB_SCROLLBARS_LUCID
  else if (class_ == xlwScrollBarWidgetClass)
    {
      xlw_update_scrollbar (instance, widget, val);
    }
#endif
#ifdef LWLIB_TABS_LUCID
  else if (class_ == tabsWidgetClass)
    {
      xlw_update_tab_control (instance, widget, val);
    }
#endif
  /* Lastly update our global arg values. */
  if (val->args && val->args->nargs)
    XtSetValues (widget, val->args->args, val->args->nargs);
}

void
xlw_update_one_value (widget_instance* instance, Widget widget,
		      widget_value* val)
{
  return;
}

void
xlw_pop_instance (widget_instance* instance, Boolean up)
{
}

#ifdef LWLIB_MENUBARS_LUCID
void
xlw_popup_menu (Widget widget, XEvent *event)
{
  XlwMenuWidget mw;

  if (!XtIsShell (widget))
    return;

  if (event->type == ButtonPress || event->type == ButtonRelease)
    {
      mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0];
      xlw_pop_up_menu (mw, (XButtonPressedEvent *)event);
    }
  else
    abort ();
}
#endif /* LWLIB_MENUBARS_LUCID */

/* Destruction of instances */
void
xlw_destroy_instance (widget_instance* instance)
{
  if (instance->widget)
    XtDestroyWidget (instance->widget);
}