diff options
| author | Gerd Moellmann | 2000-01-25 15:50:53 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-01-25 15:50:53 +0000 |
| commit | 640438b0567da9f61128ca67739ebac6be014f70 (patch) | |
| tree | 5bab0f6da2f7457f536f240bbaf8fbe7c34ff72e | |
| parent | 2088cd64c61f195070fc98883434d65e4614f290 (diff) | |
| download | emacs-640438b0567da9f61128ca67739ebac6be014f70.tar.gz emacs-640438b0567da9f61128ca67739ebac6be014f70.zip | |
(make_menu_in_widget): Don't add XmNpopdownCallback,
add XmNunmapCallback.
(xm_unmap_callback): New function.
(xm_pull_down_callback): Call pre-activate callback only if
parent is the menu bar.
| -rw-r--r-- | lwlib/lwlib-Xm.c | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index 266d1e0aab4..49c32293ef5 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c | |||
| @@ -125,6 +125,7 @@ static void xm_generic_callback P_ ((Widget, XtPointer, XtPointer)); | |||
| 125 | static void xm_nosel_callback P_ ((Widget, XtPointer, XtPointer)); | 125 | static void xm_nosel_callback P_ ((Widget, XtPointer, XtPointer)); |
| 126 | static void xm_pull_down_callback P_ ((Widget, XtPointer, XtPointer)); | 126 | static void xm_pull_down_callback P_ ((Widget, XtPointer, XtPointer)); |
| 127 | static void xm_pop_down_callback P_ ((Widget, XtPointer, XtPointer)); | 127 | static void xm_pop_down_callback P_ ((Widget, XtPointer, XtPointer)); |
| 128 | static void xm_unmap_callback P_ ((Widget, XtPointer, XtPointer)); | ||
| 128 | void xm_set_keyboard_focus P_ ((Widget, Widget)); | 129 | void xm_set_keyboard_focus P_ ((Widget, Widget)); |
| 129 | void xm_set_main_areas P_ ((Widget, Widget, Widget)); | 130 | void xm_set_main_areas P_ ((Widget, Widget, Widget)); |
| 130 | static void xm_internal_update_other_instances P_ ((Widget, XtPointer, | 131 | static void xm_internal_update_other_instances P_ ((Widget, XtPointer, |
| @@ -505,11 +506,18 @@ make_menu_in_widget (instance, widget, val, keep_first_children) | |||
| 505 | abort (); | 506 | abort (); |
| 506 | menubar_p = type == XmMENU_BAR; | 507 | menubar_p = type == XmMENU_BAR; |
| 507 | 508 | ||
| 509 | #if 0 /* This can't be used in LessTif as of 2000-01-24 because it's | ||
| 510 | impossible to decide from this plus the cascading callback if a | ||
| 511 | popup is still posted or not. When selecting cascade button A, | ||
| 512 | then B, then clicking on the frame, the sequence of callbacks is | ||
| 513 | `cascading A', cascading B', `popdown for all cascade buttons in | ||
| 514 | the menu bar. */ | ||
| 508 | /* Add a callback to popups and pulldowns that is called when | 515 | /* Add a callback to popups and pulldowns that is called when |
| 509 | it is made invisible again. */ | 516 | it is made invisible again. */ |
| 510 | if (!menubar_p) | 517 | if (!menubar_p) |
| 511 | XtAddCallback (XtParent (widget), XmNpopdownCallback, | 518 | XtAddCallback (XtParent (widget), XmNpopdownCallback, |
| 512 | xm_pop_down_callback, (XtPointer)instance); | 519 | xm_pop_down_callback, (XtPointer)instance); |
| 520 | #endif | ||
| 513 | 521 | ||
| 514 | /* Preserve the first KEEP_FIRST_CHILDREN old children. */ | 522 | /* Preserve the first KEEP_FIRST_CHILDREN old children. */ |
| 515 | for (child_index = 0, cur = val; child_index < keep_first_children; | 523 | for (child_index = 0, cur = val; child_index < keep_first_children; |
| @@ -585,11 +593,15 @@ make_menu_in_widget (instance, widget, val, keep_first_children) | |||
| 585 | else | 593 | else |
| 586 | { | 594 | { |
| 587 | menu = XmCreatePulldownMenu (widget, cur->name, NULL, 0); | 595 | menu = XmCreatePulldownMenu (widget, cur->name, NULL, 0); |
| 596 | |||
| 597 | /* XmNpopdownCallback is working strangely under LessTif. | ||
| 598 | Using XmNunmapCallback is the only way to go there. */ | ||
| 599 | if (menubar_p) | ||
| 600 | XtAddCallback (menu, XmNunmapCallback, xm_unmap_callback, | ||
| 601 | (XtPointer) instance); | ||
| 602 | |||
| 588 | make_menu_in_widget (instance, menu, cur->contents, 0); | 603 | make_menu_in_widget (instance, menu, cur->contents, 0); |
| 589 | XtSetArg (al [ac], XmNsubMenuId, menu); ac++; | 604 | XtSetArg (al[ac], XmNsubMenuId, menu); ac++; |
| 590 | /* Non-zero values don't work reliably in conjunction with | ||
| 591 | Emacs' event loop */ | ||
| 592 | XtSetArg (al [ac], XmNmappingDelay, 0); ac++; | ||
| 593 | button = XmCreateCascadeButton (widget, cur->name, al, ac); | 605 | button = XmCreateCascadeButton (widget, cur->name, al, ac); |
| 594 | 606 | ||
| 595 | xm_update_label (instance, button, cur); | 607 | xm_update_label (instance, button, cur); |
| @@ -1876,9 +1888,25 @@ xm_pull_down_callback (widget, closure, call_data) | |||
| 1876 | XtPointer closure; | 1888 | XtPointer closure; |
| 1877 | XtPointer call_data; | 1889 | XtPointer call_data; |
| 1878 | { | 1890 | { |
| 1879 | do_call (widget, closure, pre_activate); | 1891 | Widget parent = XtParent (widget); |
| 1892 | |||
| 1893 | if (XmIsRowColumn (parent)) | ||
| 1894 | { | ||
| 1895 | unsigned char type = 0xff; | ||
| 1896 | XtVaGetValues (parent, XmNrowColumnType, &type, NULL); | ||
| 1897 | if (type == XmMENU_BAR) | ||
| 1898 | do_call (widget, closure, pre_activate); | ||
| 1899 | } | ||
| 1880 | } | 1900 | } |
| 1881 | 1901 | ||
| 1902 | |||
| 1903 | /* XmNpopdownCallback for MenuShell widgets. WIDGET is the MenuShell, | ||
| 1904 | CLOSURE is a pointer to the widget_instance of the shell, CALL_DATA | ||
| 1905 | is always null under LessTif. | ||
| 1906 | |||
| 1907 | 2000-01-23: This callback is called for each cascade button in | ||
| 1908 | a menu, whether or not its submenu is visible. */ | ||
| 1909 | |||
| 1882 | static void | 1910 | static void |
| 1883 | xm_pop_down_callback (widget, closure, call_data) | 1911 | xm_pop_down_callback (widget, closure, call_data) |
| 1884 | Widget widget; | 1912 | Widget widget; |
| @@ -1892,6 +1920,17 @@ xm_pop_down_callback (widget, closure, call_data) | |||
| 1892 | do_call (widget, closure, post_activate); | 1920 | do_call (widget, closure, post_activate); |
| 1893 | } | 1921 | } |
| 1894 | 1922 | ||
| 1923 | static void | ||
| 1924 | xm_unmap_callback (widget, closure, call_data) | ||
| 1925 | Widget widget; | ||
| 1926 | XtPointer closure; | ||
| 1927 | XtPointer call_data; | ||
| 1928 | { | ||
| 1929 | widget_instance *instance = (widget_instance *) closure; | ||
| 1930 | if (!instance->pop_up_p) | ||
| 1931 | do_call (widget, closure, post_activate); | ||
| 1932 | } | ||
| 1933 | |||
| 1895 | 1934 | ||
| 1896 | /* set the keyboard focus */ | 1935 | /* set the keyboard focus */ |
| 1897 | void | 1936 | void |