From 40bb7e6f66eb8f88c324bc2756e19f7128d06603 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 29 Aug 2008 01:06:42 +0000 Subject: [PATCH] (update_tool_bar_unwind): New function. (update_tool_bar): Temporarily set selected frame before building tool-bar items. --- src/xdisp.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index 89dc814f71a..dc1dd16a3bc 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9834,6 +9834,14 @@ FRAME_PTR last_mouse_frame; int last_tool_bar_item; +static Lisp_Object +update_tool_bar_unwind (frame) + Lisp_Object frame; +{ + selected_frame = frame; + return Qnil; +} + /* Update the tool-bar item list for frame F. This has to be done before we start to fill in any display lines. Called from prepare_menu_bars. If SAVE_MATCH_DATA is non-zero, we must save @@ -9878,7 +9886,7 @@ update_tool_bar (f, save_match_data) { struct buffer *prev = current_buffer; int count = SPECPDL_INDEX (); - Lisp_Object new_tool_bar; + Lisp_Object frame, new_tool_bar; int new_n_tool_bar; struct gcpro gcpro1; @@ -9900,6 +9908,14 @@ update_tool_bar (f, save_match_data) GCPRO1 (new_tool_bar); + /* We must temporarily set the selected frame to this frame + before calling tool_bar_items, because the calculation of + the tool-bar keymap uses the selected frame (see + `tool-bar-make-keymap' in tool-bar.el). */ + record_unwind_protect (update_tool_bar_unwind, selected_frame); + XSETFRAME (frame, f); + selected_frame = frame; + /* Build desired tool-bar items from keymaps. */ new_tool_bar = tool_bar_items (Fcopy_sequence (f->tool_bar_items), &new_n_tool_bar); -- 2.39.5