aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-01-11 19:33:59 +0000
committerGerd Moellmann2001-01-11 19:33:59 +0000
commita23887b96a6a2b4624769c2821f79bcdca2c2594 (patch)
tree6c7a19c11b7ff5309ddcd07738f2186c51c28b20 /src
parent562e00daecc360ed0440260cbd5643bb17f3d409 (diff)
downloademacs-a23887b96a6a2b4624769c2821f79bcdca2c2594.tar.gz
emacs-a23887b96a6a2b4624769c2821f79bcdca2c2594.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/xdisp.c26
2 files changed, 18 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 78c2d5dea82..01d969a94f2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12001-01-11 Gerd Moellmann <gerd@gnu.org> 12001-01-11 Gerd Moellmann <gerd@gnu.org>
2 2
3 * xdisp.c (build_desired_tool_bar_string): Correct the computation
4 of the size needed for the tool bar string. For the last image,
5 use a `display' property that reaches to the end of the string.
6
3 * xselect.c (selection_request_dpyinfo): New variable. 7 * xselect.c (selection_request_dpyinfo): New variable.
4 (x_handle_selection_request): Set it. 8 (x_handle_selection_request): Set it.
5 (x_selection_request_lisp_error): Don't call 9 (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
7148build_desired_tool_bar_string (f) 7148build_desired_tool_bar_string (f)
7149 struct frame *f; 7149 struct frame *f;
7150{ 7150{
7151 int i, size, size_needed, string_idx; 7151 int i, size, size_needed;
7152 struct gcpro gcpro1, gcpro2, gcpro3; 7152 struct gcpro gcpro1, gcpro2, gcpro3;
7153 Lisp_Object image, plist, props; 7153 Lisp_Object image, plist, props;
7154 7154
@@ -7163,11 +7163,8 @@ build_desired_tool_bar_string (f)
7163 ? XSTRING (f->desired_tool_bar_string)->size 7163 ? XSTRING (f->desired_tool_bar_string)->size
7164 : 0); 7164 : 0);
7165 7165
7166 /* Each image in the string we build is preceded by a space,
7167 and there is a space at the end. */
7168 size_needed = f->n_tool_bar_items + 1;
7169
7170 /* Reuse f->desired_tool_bar_string, if possible. */ 7166 /* Reuse f->desired_tool_bar_string, if possible. */
7167 size_needed = f->n_tool_bar_items;
7171 if (size < size_needed) 7168 if (size < size_needed)
7172 f->desired_tool_bar_string = Fmake_string (make_number (size_needed), 7169 f->desired_tool_bar_string = Fmake_string (make_number (size_needed),
7173 make_number (' ')); 7170 make_number (' '));
@@ -7181,15 +7178,13 @@ build_desired_tool_bar_string (f)
7181 /* Put a `display' property on the string for the images to display, 7178 /* Put a `display' property on the string for the images to display,
7182 put a `menu_item' property on tool-bar items with a value that 7179 put a `menu_item' property on tool-bar items with a value that
7183 is the index of the item in F's tool-bar item vector. */ 7180 is the index of the item in F's tool-bar item vector. */
7184 for (i = 0, string_idx = 0; 7181 for (i = 0; i < f->n_tool_bar_items; ++i)
7185 i < f->n_tool_bar_items;
7186 ++i, string_idx += 1)
7187 { 7182 {
7188#define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) 7183#define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX))
7189 7184
7190 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); 7185 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
7191 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); 7186 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
7192 int margin, relief, idx; 7187 int margin, relief, idx, end;
7193 extern Lisp_Object QCrelief, QCmargin, QCalgorithm, Qimage; 7188 extern Lisp_Object QCrelief, QCmargin, QCalgorithm, Qimage;
7194 extern Lisp_Object Qlaplace; 7189 extern Lisp_Object Qlaplace;
7195 7190
@@ -7262,9 +7257,16 @@ build_desired_tool_bar_string (f)
7262 vector. */ 7257 vector. */
7263 image = Fcons (Qimage, plist); 7258 image = Fcons (Qimage, plist);
7264 props = list4 (Qdisplay, image, 7259 props = list4 (Qdisplay, image,
7265 Qmenu_item, make_number (i * TOOL_BAR_ITEM_NSLOTS)), 7260 Qmenu_item, make_number (i * TOOL_BAR_ITEM_NSLOTS));
7266 Fadd_text_properties (make_number (string_idx), 7261
7267 make_number (string_idx + 1), 7262 /* Let the last image hide all remaining spaces in the tool bar
7263 string. The string can be longer than needed when we reuse a
7264 previous string. */
7265 if (i + 1 == f->n_tool_bar_items)
7266 end = XSTRING (f->desired_tool_bar_string)->size;
7267 else
7268 end = i + 1;
7269 Fadd_text_properties (make_number (i), make_number (end),
7268 props, f->desired_tool_bar_string); 7270 props, f->desired_tool_bar_string);
7269#undef PROP 7271#undef PROP
7270 } 7272 }