diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2007-01-06 15:25:16 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2007-01-06 15:25:16 +0000 |
commit | 191ae1cf7cd2571277635b3b8e488e773ca5c9b9 (patch) | |
tree | e0b26e3040767dae38fb39a03b757da05088c58f /lwlib | |
parent | 382707ecfb50f8c7794a7ba3d8cd9db9b6cd29d0 (diff) | |
parent | f85c5e3b72855951b071eacb7b6e2d002c5fc4be (diff) | |
download | emacs-191ae1cf7cd2571277635b3b8e488e773ca5c9b9.tar.gz |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-585
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-586
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-587
Update from erc--emacs--22
* emacs@sv.gnu.org/emacs--devo--0--patch-588
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-589
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-590
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-591
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-592
Diffstat (limited to 'lwlib')
-rw-r--r-- | lwlib/ChangeLog | 16 | ||||
-rw-r--r-- | lwlib/lwlib-Xlw.c | 27 | ||||
-rw-r--r-- | lwlib/xlwmenu.c | 31 | ||||
-rw-r--r-- | lwlib/xlwmenu.h | 2 | ||||
-rw-r--r-- | lwlib/xlwmenuP.h | 2 |
5 files changed, 71 insertions, 7 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 904d8eadf05..d3e8c2eb4c3 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,19 @@ +2007-01-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * xlwmenu.c (xlwMenuResources): Add XtNleaveCallback, XtNenterCallback. + (display_menu, map_event_to_widget_value): Generate enter and + leave callbacks. + (pop_up_menu): Initialize mw->menu.inside_entry. + + * xlwmenu.h (XtNleaveCallback, XtNenterCallback): New strings. + + * xlwmenuP.h (_XlwMenu_part): Add enter/leave callbacks and + inside_entry. + + * lwlib-Xlw.c (enter_hook, leave_hook): New functions + (xlw_create_menubar, xlw_create_popup_menu): Connect XtNenter/leave + to enter/leave_hook. + 2006-10-30 Chong Yidong <cyd@stupidchicken.com> * Makefile.in (lwlib-utils.o): Use CPPFLAGS. diff --git a/lwlib/lwlib-Xlw.c b/lwlib/lwlib-Xlw.c index 4799b1dbd9d..dd366e4cca1 100644 --- a/lwlib/lwlib-Xlw.c +++ b/lwlib/lwlib-Xlw.c @@ -84,6 +84,25 @@ highlight_hook (w, client_data, call_data) } static void +enter_hook (w, client_data, call_data) + Widget w; + XtPointer client_data; + XtPointer call_data; +{ + highlight_hook (w, client_data, call_data); +} + +static void +leave_hook (w, client_data, call_data) + Widget w; + XtPointer client_data; + XtPointer call_data; +{ + highlight_hook (w, client_data, NULL); +} + + +static void pre_hook (w, client_data, call_data) Widget w; XtPointer client_data; @@ -152,8 +171,8 @@ xlw_create_menubar (instance) XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance); XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance); - XtAddCallback (widget, XtNhighlightCallback, highlight_hook, - (XtPointer)instance); + XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance); + XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance); return widget; } @@ -179,8 +198,8 @@ xlw_create_popup_menu (instance) popup_shell, al, ac); XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance); - XtAddCallback (widget, XtNhighlightCallback, highlight_hook, - (XtPointer)instance); + XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance); + XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance); return popup_shell; } diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index b01569ca5ab..65b9685038e 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c @@ -161,6 +161,10 @@ xlwMenuResources[] = offset(menu.select), XtRCallback, (XtPointer)NULL}, {XtNhighlightCallback, XtCCallback, XtRCallback, sizeof(XtPointer), offset(menu.highlight), XtRCallback, (XtPointer)NULL}, + {XtNenterCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(menu.enter), XtRCallback, (XtPointer)NULL}, + {XtNleaveCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(menu.leave), XtRCallback, (XtPointer)NULL}, {XtNmenu, XtCMenu, XtRPointer, sizeof(XtPointer), offset(menu.contents), XtRImmediate, (XtPointer)NULL}, {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), @@ -1186,8 +1190,17 @@ display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return, { if (val->enabled) *hit_return = val; - else - no_return = 1; + else + no_return = 1; + if (mw->menu.inside_entry != val) + { + if (mw->menu.inside_entry) + XtCallCallbackList ((Widget)mw, mw->menu.leave, + (XtPointer) mw->menu.inside_entry); + mw->menu.inside_entry = val; + XtCallCallbackList ((Widget)mw, mw->menu.enter, + (XtPointer) mw->menu.inside_entry); + } } if (horizontal_p) @@ -1452,7 +1465,7 @@ motion_event_is_in_menu (mw, ev, level, relative_pos) relative_pos->x = ev->x_root - x; relative_pos->y = ev->y_root - y; return (x - shadow < ev->x_root && ev->x_root < x + ws->width - && y - shadow < ev->y_root && ev->y_root < y + ws->height); + && y - shadow < ev->y_root && ev->y_root < y + ws->height); } static Boolean @@ -1465,6 +1478,7 @@ map_event_to_widget_value (mw, ev, val, level) int i; XPoint relative_pos; window_state* ws; + int inside = 0; *val = NULL; @@ -1474,6 +1488,7 @@ map_event_to_widget_value (mw, ev, val, level) ws = &mw->menu.windows [i]; if (ws && motion_event_is_in_menu (mw, ev, i, &relative_pos)) { + inside = 1; display_menu (mw, i, True, NULL, &relative_pos, val, NULL, NULL); if (*val) @@ -1483,6 +1498,15 @@ map_event_to_widget_value (mw, ev, val, level) } } } + + if (!inside) + { + if (mw->menu.inside_entry != NULL) + XtCallCallbackList ((Widget)mw, mw->menu.leave, + (XtPointer) mw->menu.inside_entry); + mw->menu.inside_entry = NULL; + } + return False; } @@ -2426,6 +2450,7 @@ pop_up_menu (mw, event) next_release_must_exit = 0; + mw->menu.inside_entry = NULL; XtCallCallbackList ((Widget)mw, mw->menu.open, NULL); if (XtIsShell (XtParent ((Widget)mw))) diff --git a/lwlib/xlwmenu.h b/lwlib/xlwmenu.h index fa5dc887330..9b7a6b099db 100644 --- a/lwlib/xlwmenu.h +++ b/lwlib/xlwmenu.h @@ -44,6 +44,8 @@ Boston, MA 02110-1301, USA. */ #define XtNopen "open" #define XtNselect "select" #define XtNhighlightCallback "highlightCallback" +#define XtNenterCallback "enterCallback" +#define XtNleaveCallback "leaveCallback" #define XtNmenuBorderWidth "menuBorderWidth" #define XtNhorizontal "horizontal" #define XtCHorizontal "Horizontal" diff --git a/lwlib/xlwmenuP.h b/lwlib/xlwmenuP.h index ce170d7bfe4..b90bc3da827 100644 --- a/lwlib/xlwmenuP.h +++ b/lwlib/xlwmenuP.h @@ -64,6 +64,7 @@ typedef struct _XlwMenu_part Cursor cursor_shape; XtCallbackList open; XtCallbackList select, highlight; + XtCallbackList enter, leave; widget_value* contents; int horizontal; @@ -76,6 +77,7 @@ typedef struct _XlwMenu_part int old_depth; widget_value** old_stack; int old_stack_length; + widget_value* inside_entry; /* New state after the user moved */ int new_depth; |