comparison src/xdisp.c @ 7096:a3bf30f1a408

(syms_of_xdisp): Set up Qmenu_bar_update_hook. (update_menu_bar): Run that hook. Fix failure to update menu bar when w->update_mode_line was nil.
author Richard M. Stallman <rms@gnu.org>
date Mon, 25 Apr 1994 22:16:08 +0000
parents 9e949c4d0e4c
children 9a593efc103d
comparison
equal deleted inserted replaced
7095:098b87bde5a7 7096:a3bf30f1a408
91 /* String to display for the arrow. */ 91 /* String to display for the arrow. */
92 Lisp_Object Voverlay_arrow_string; 92 Lisp_Object Voverlay_arrow_string;
93 93
94 /* Values of those variables at last redisplay. */ 94 /* Values of those variables at last redisplay. */
95 static Lisp_Object last_arrow_position, last_arrow_string; 95 static Lisp_Object last_arrow_position, last_arrow_string;
96
97 Lisp_Object Qmenu_bar_update_hook;
96 98
97 /* Nonzero if overlay arrow has been displayed once in this window. */ 99 /* Nonzero if overlay arrow has been displayed once in this window. */
98 static int overlay_arrow_seen; 100 static int overlay_arrow_seen;
99 101
100 /* Nonzero means highlight the region even in nonselected windows. */ 102 /* Nonzero means highlight the region even in nonselected windows. */
925 w = XWINDOW (window); 927 w = XWINDOW (window);
926 928
927 if (update_mode_lines) 929 if (update_mode_lines)
928 w->update_mode_line = Qt; 930 w->update_mode_line = Qt;
929 931
930 /* When we reach a frame's selected window, redo the frame's menu bar. */ 932 if (
931 if (!NILP (w->update_mode_line)
932 #ifdef USE_X_TOOLKIT 933 #ifdef USE_X_TOOLKIT
933 && FRAME_EXTERNAL_MENU_BAR (f) 934 FRAME_EXTERNAL_MENU_BAR (f)
934 #else 935 #else
935 && FRAME_MENU_BAR_LINES (f) > 0 936 FRAME_MENU_BAR_LINES (f) > 0
936 #endif 937 #endif
937 ) 938 )
938 { 939 {
939 /* If the user has switched buffers or windows, we need to 940 /* If the user has switched buffers or windows, we need to
940 recompute to reflect the new bindings. But we'll 941 recompute to reflect the new bindings. But we'll
942 that people can use force-mode-line-update to request 943 that people can use force-mode-line-update to request
943 that the menu bar be recomputed. The adverse effect on 944 that the menu bar be recomputed. The adverse effect on
944 the rest of the redisplay algorithm is about the same as 945 the rest of the redisplay algorithm is about the same as
945 windows_or_buffers_changed anyway. */ 946 windows_or_buffers_changed anyway. */
946 if (windows_or_buffers_changed 947 if (windows_or_buffers_changed
947 || update_mode_lines 948 || !NILP (w->update_mode_line)
948 || (XFASTINT (w->last_modified) < MODIFF 949 || (XFASTINT (w->last_modified) < MODIFF
949 && (XFASTINT (w->last_modified) 950 && (XFASTINT (w->last_modified)
950 <= XBUFFER (w->buffer)->save_modified))) 951 <= XBUFFER (w->buffer)->save_modified)))
951 { 952 {
952 struct buffer *prev = current_buffer; 953 struct buffer *prev = current_buffer;
954 call1 (Vrun_hooks, Qmenu_bar_update_hook);
953 current_buffer = XBUFFER (w->buffer); 955 current_buffer = XBUFFER (w->buffer);
954 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); 956 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
955 current_buffer = prev; 957 current_buffer = prev;
956 #ifdef USE_X_TOOLKIT 958 #ifdef USE_X_TOOLKIT
957 set_frame_menubar (f, 0); 959 set_frame_menubar (f, 0);
3269 } 3271 }
3270 3272
3271 void 3273 void
3272 syms_of_xdisp () 3274 syms_of_xdisp ()
3273 { 3275 {
3276 staticpro (&Qmenu_bar_update_hook);
3277 Qmenu_bar_update_hook = intern ("menu-bar-update-hook");
3278
3274 staticpro (&last_arrow_position); 3279 staticpro (&last_arrow_position);
3275 staticpro (&last_arrow_string); 3280 staticpro (&last_arrow_string);
3276 last_arrow_position = Qnil; 3281 last_arrow_position = Qnil;
3277 last_arrow_string = Qnil; 3282 last_arrow_string = Qnil;
3278 3283