From: Gerd Moellmann Date: Thu, 11 Jan 2001 19:33:59 +0000 (+0000) Subject: (build_desired_tool_bar_string): Correct the computation X-Git-Tag: emacs-pretest-21.0.96~341 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a23887b96a6a2b4624769c2821f79bcdca2c2594;p=emacs.git (build_desired_tool_bar_string): Correct the computation of the size needed for the tool bar string. For the last image, use a `display' property that reaches to the end of the string. --- diff --git a/src/ChangeLog b/src/ChangeLog index 78c2d5dea82..01d969a94f2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2001-01-11 Gerd Moellmann + * xdisp.c (build_desired_tool_bar_string): Correct the computation + of the size needed for the tool bar string. For the last image, + use a `display' property that reaches to the end of the string. + * xselect.c (selection_request_dpyinfo): New variable. (x_handle_selection_request): Set it. (x_selection_request_lisp_error): Don't call diff --git a/src/xdisp.c b/src/xdisp.c index a68bd5d40fb..b3684024b80 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7148,7 +7148,7 @@ static void build_desired_tool_bar_string (f) struct frame *f; { - int i, size, size_needed, string_idx; + int i, size, size_needed; struct gcpro gcpro1, gcpro2, gcpro3; Lisp_Object image, plist, props; @@ -7163,11 +7163,8 @@ build_desired_tool_bar_string (f) ? XSTRING (f->desired_tool_bar_string)->size : 0); - /* Each image in the string we build is preceded by a space, - and there is a space at the end. */ - size_needed = f->n_tool_bar_items + 1; - /* Reuse f->desired_tool_bar_string, if possible. */ + size_needed = f->n_tool_bar_items; if (size < size_needed) f->desired_tool_bar_string = Fmake_string (make_number (size_needed), make_number (' ')); @@ -7181,15 +7178,13 @@ build_desired_tool_bar_string (f) /* Put a `display' property on the string for the images to display, put a `menu_item' property on tool-bar items with a value that is the index of the item in F's tool-bar item vector. */ - for (i = 0, string_idx = 0; - i < f->n_tool_bar_items; - ++i, string_idx += 1) + for (i = 0; i < f->n_tool_bar_items; ++i) { #define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); - int margin, relief, idx; + int margin, relief, idx, end; extern Lisp_Object QCrelief, QCmargin, QCalgorithm, Qimage; extern Lisp_Object Qlaplace; @@ -7262,9 +7257,16 @@ build_desired_tool_bar_string (f) vector. */ image = Fcons (Qimage, plist); props = list4 (Qdisplay, image, - Qmenu_item, make_number (i * TOOL_BAR_ITEM_NSLOTS)), - Fadd_text_properties (make_number (string_idx), - make_number (string_idx + 1), + Qmenu_item, make_number (i * TOOL_BAR_ITEM_NSLOTS)); + + /* Let the last image hide all remaining spaces in the tool bar + string. The string can be longer than needed when we reuse a + previous string. */ + if (i + 1 == f->n_tool_bar_items) + end = XSTRING (f->desired_tool_bar_string)->size; + else + end = i + 1; + Fadd_text_properties (make_number (i), make_number (end), props, f->desired_tool_bar_string); #undef PROP }