diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-08-12 18:57:08 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-08-12 18:57:08 +0000 |
commit | 6dd253337668fcf8495c90b8fab67a7e5b7ca0d2 (patch) | |
tree | 0e27621a663913b84f163ee7adfe0bf5d6e8cda9 /lwlib/lwlib-Xm.c | |
parent | be0486dcd387864bdb607408b4a66bad0b68942f (diff) | |
download | emacs-6dd253337668fcf8495c90b8fab67a7e5b7ca0d2.tar.gz |
(update_one_menu_entry): Fix previous change:
When XmIsCascadeButton, don't call XmCreateCascadeButtonGadget,
just modify the existing one.
Diffstat (limited to 'lwlib/lwlib-Xm.c')
-rw-r--r-- | lwlib/lwlib-Xm.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index 38713adb25f..2050c295755 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -510,9 +510,8 @@ update_one_menu_entry (instance, widget, val, deep_p) if (contents) { unsigned int old_num_children, i; - Widget button, parent; + Widget parent; Widget *widget_list; - int buttonchange; parent = XtParent (widget); widget_list = XtCompositeChildren (parent, &old_num_children); @@ -523,27 +522,37 @@ update_one_menu_entry (instance, widget, val, deep_p) break; if (i == old_num_children) abort (); - /* `buttonchange' indicates the parent button is being - exchanged with a CascadeButton. */ - buttonchange = !XmIsCascadeButton (widget_list[i]); - if (buttonchange) - XtDestroyWidget (widget_list[i]); - menu = XmCreatePulldownMenu (parent, val->name, NULL, 0); - make_menu_in_widget (instance, menu, contents, 0); - ac = 0; - XtSetArg (al [ac], XmNsubMenuId, menu); ac++; - /* Non-zero values don't work reliably in - conjunction with Emacs' event loop */ - XtSetArg (al [ac], XmNmappingDelay, 0); ac++; - /* Tell Motif to put it in the right place. */ - XtSetArg (al [ac], XmNpositionIndex, i); ac++; - button = XmCreateCascadeButtonGadget (parent, val->name, al, ac); - xm_update_label (instance, button, val); - - XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback, - (XtPointer)instance); - if (buttonchange) - XtManageChild (button); + if (XmIsCascadeButton (widget_list[i])) + { + menu = XmCreatePulldownMenu (parent, XtName(widget), NULL, 0); + make_menu_in_widget (instance, menu, contents, 0); + ac = 0; + XtSetArg (al [ac], XmNsubMenuId, menu); ac++; + XtSetValues (widget, al, ac); + } + else + { + Widget button; + + /* The current menuitem is a XmPushButtonGadget, it + needs to be replaced by a CascadeButtonGadget */ + XtDestroyWidget (widget_list[i]); + menu = XmCreatePulldownMenu (parent, val->name, NULL, 0); + make_menu_in_widget (instance, menu, contents, 0); + ac = 0; + XtSetArg (al [ac], XmNsubMenuId, menu); ac++; + /* Non-zero values don't work reliably in + conjunction with Emacs' event loop */ + XtSetArg (al [ac], XmNmappingDelay, 0); ac++; + /* Tell Motif to put it in the right place */ + XtSetArg (al [ac], XmNpositionIndex, i); ac++; + button = XmCreateCascadeButtonGadget (parent, val->name, al, ac); + xm_update_label (instance, button, val); + + XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback, + (XtPointer)instance); + XtManageChild (button); + } } } else if (!contents) |