I started fixing one bug, and found whole bughillock... All these are
reproduced in 20.3
1. (redraw-frame) and C-l (recenter) do not redraw toolbars.
2. Do (set-specifier default-toolbar-height 70 (current-buffer)). Nothing
happens. Now press C-M-l twice (assuming there isother buffer). Toolbar
is tall, and modeline is beneath bottob edge of the frame. Same for
default-toolbar-border-width.
3. Do (set-specifier default-toolbar-visible-p nil (current-buffer)). Not
as dramatic as in the above case, but does not regard the new spec unless
switched buffers.
4. In the above case, on X only *sometimes* (I can't describe it more precise)
the toolbar is not drawn when switching to a buffer with toolbar from the
one without. C-l does not help (see 1)
5. MS Windows ignores all 3 specifier changes, in any domain, so there is
either a hole or modeline is moved down the window.
Patch attached.
Kirill
1998-04-29 Kirill M. Katsnelson <kkm(a)kis.ru>
* frame.c (change_frame_size_1): Adjust frame row/columns taking
real toolbar size into account, not the theoretical one.
* toolbar.c (set_frame_toolbar): Removed unused parameter.
Return void, not unused int.
Logic which checks whether toolbar to be recomputed moved here
from macro COMPUTE_TOOLBAR_DATA (r.i.p)
(compute_frame_toolbars_data): Removed COMPUTE_TOOLBAR_DATA. It
did not work due to a bug, and also did not check whether toolbar
size has changed.
Compute new character sizes passed to change_frame_size, do not
use the old (pre-toolbar-change) ones.
(update_frame_toolbars): Honor frame_changed and clear frame bits.
(recompute_overlaying_specifier): New helper function, called from
default toolbar specifier change handlers.
(default_toolbar_specs_changed): Use it.
(default_toolbar_size_changed_in_frame): Ditto.
(default_toolbar_border_width_changed_in_frame): Ditto.
(default_toolbar_visible_p_changed_in_frame): Ditto.
(toolbar_geometry_changed_in_window): New handler. The old one,
some_windows_value_changed, did not do the trick.
(default_toolbar_size_changed_in_window): New handler for default
toolbar.
(default_toolbar_border_width_changed_in_window): Ditto.
(default_toolbar_visible_p_changed_in_window): Ditto.
(specifier_vars_of_toolbar): Use one of the above four handlers
instead of some_windows_value_changed in toolbar specifiers.
Index: src/frame.c
===================================================================
RCS file: /var/cvsroot/ntxemacs/src/frame.c,v
retrieving revision 1.5
diff --unified=2 -r1.5 frame.c
--- src/frame.c 1998/04/27 21:50:10 1.5
+++ src/frame.c 1998/04/29 08:31:58
@@ -2742,21 +2742,32 @@
/* when frame_conversion_internal() calculated the number of rows/cols
- in the frame, the toolbar sizes were subtracted out. However,
- if the corresponding toolbar is not actually visible in the
- selected window, then the extra space needs to be filled in
- with rows/cols. */
- if (!FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
- new_pixheight += FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f) +
- 2 * FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH (f);
- if (!FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
- new_pixheight += FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f) +
- 2 * FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f);
- if (!FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
- new_pixwidth += FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) +
- 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f);
- if (!FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
- new_pixwidth += FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f) +
- 2 * FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH (f);
+ in the frame, the theoretical toolbar sizes were subtracted out.
+ The caluclations below adjust for real toolbar height/width in
+ frame, which may be different from frame spec, taking the above
+ fact into account */
+ new_pixheight +=
+ + FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f)
+ + 2 * FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH (f)
+ - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f)
+ - 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f);
+
+ new_pixheight +=
+ + FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f)
+ + 2 * FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)
+ - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f)
+ - 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f);
+ new_pixwidth +=
+ + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f)
+ + 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f)
+ - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f)
+ - 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f);
+
+ new_pixwidth +=
+ + FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f)
+ + 2 * FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH (f)
+ - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f)
+ - 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f);
+
/* Adjust the width for the end glyph which may be a different width
than the default character width. */
Index: src/toolbar.c
===================================================================
RCS file: /var/cvsroot/ntxemacs/src/toolbar.c,v
retrieving revision 1.1.1.5
diff --unified=2 -r1.1.1.5 toolbar.c
--- src/toolbar.c 1998/04/19 02:07:45 1.1.1.5
+++ src/toolbar.c 1998/04/27 21:17:01
@@ -722,12 +722,16 @@
}
-static int
-set_frame_toolbar (struct frame *f, enum toolbar_pos pos, int first_time_p)
+static void
+set_frame_toolbar (struct frame *f, enum toolbar_pos pos)
{
Lisp_Object toolbar, buttons;
struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
Lisp_Object buffer = w->buffer;
- int visible = FRAME_THEORETICAL_TOOLBAR_SIZE (f, pos);
+ if (!f->toolbar_changed
+ && !NILP (f->toolbar_data[pos])
+ && EQ (FRAME_TOOLBAR_DATA (f, pos)->last_toolbar_buffer, buffer))
+ return;
+
toolbar = w->toolbar[pos];
@@ -742,58 +746,27 @@
}
- buttons = visible ? compute_frame_toolbar_buttons (f, pos, toolbar) : Qnil;
+ buttons = (FRAME_REAL_TOOLBAR_VISIBLE (f, pos)
+ ? compute_frame_toolbar_buttons (f, pos, toolbar) : Qnil);
FRAME_TOOLBAR_DATA (f, pos)->last_toolbar_buffer = buffer;
FRAME_TOOLBAR_DATA (f, pos)->toolbar_buttons = buttons;
-
- return visible;
}
-#define COMPUTE_TOOLBAR_DATA(position) \
- do \
- { \
- local_toolbar_changed = \
- (f->toolbar_changed \
- || NILP (f->toolbar_data[position]) \
- || (!EQ (FRAME_TOOLBAR_DATA (f, position)->last_toolbar_buffer, \
- XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->buffer))); \
- \
- toolbar_was_visible = \
- (!NILP (f->toolbar_data[position]) \
- && !NILP (FRAME_TOOLBAR_DATA (f, position)->toolbar_buttons)); \
- toolbar_will_be_visible = toolbar_was_visible; \
- \
- if (local_toolbar_changed) \
- toolbar_will_be_visible = \
- set_frame_toolbar (f, position, first_time_p); \
- \
- toolbar_visibility_changed = \
- (toolbar_was_visible != toolbar_will_be_visible); \
- \
- if (toolbar_visibility_changed) \
- frame_changed_size = 1; \
- } while (0)
-
static void
compute_frame_toolbars_data (struct frame *f, int first_time_p)
{
- int local_toolbar_changed;
- int toolbar_was_visible, toolbar_will_be_visible;
- int toolbar_visibility_changed;
- int frame_changed_size = 0;
-
- COMPUTE_TOOLBAR_DATA (TOP_TOOLBAR);
- COMPUTE_TOOLBAR_DATA (BOTTOM_TOOLBAR);
- COMPUTE_TOOLBAR_DATA (LEFT_TOOLBAR);
- COMPUTE_TOOLBAR_DATA (RIGHT_TOOLBAR);
-
- /* The frame itself doesn't actually change size, but the usable
- text area does. All we have to do is call change_frame_size with
- the current height and width parameters and it will readjust for
- all changes in the toolbars. */
- if (frame_changed_size && !first_time_p)
- change_frame_size (f, FRAME_HEIGHT (f), FRAME_WIDTH (f), 0);
+ set_frame_toolbar (f, TOP_TOOLBAR);
+ set_frame_toolbar (f, BOTTOM_TOOLBAR);
+ set_frame_toolbar (f, LEFT_TOOLBAR);
+ set_frame_toolbar (f, RIGHT_TOOLBAR);
+
+ if (!first_time_p)
+ {
+ int height, width;
+ pixel_to_char_size (f, FRAME_PIXWIDTH(f), FRAME_PIXHEIGHT(f),
+ &width, &height);
+ change_frame_size (f, height, width, 0);
+ }
}
-#undef COMPUTE_TOOLBAR_DATA
void
@@ -807,5 +780,5 @@
toolbars need to be recomputed. */
if ((HAS_DEVMETH_P (d, output_frame_toolbars))
- && (f->toolbar_changed
+ && (f->toolbar_changed || f->frame_changed || f->clear
|| !EQ (FRAME_TOOLBAR_BUFFER (f, TOP_TOOLBAR), buffer)
|| !EQ (FRAME_TOOLBAR_BUFFER (f, BOTTOM_TOOLBAR), buffer)
@@ -1231,4 +1204,15 @@
+/*
+ Helper for invalidating the real specifier when default
+ specifier caching changes
+*/
+static void
+recompute_overlaying_specifier (Lisp_Object real_one[4])
+{
+ enum toolbar_pos pos = decode_toolbar_position (Vdefault_toolbar_position);
+ Fset_specifier_dirty_flag (real_one[pos]);
+}
+
static void
toolbar_specs_changed (Lisp_Object specifier, struct window *w,
@@ -1246,7 +1230,5 @@
Lisp_Object oldval)
{
- enum toolbar_pos pos = decode_toolbar_position (Vdefault_toolbar_position);
-
- Fset_specifier_dirty_flag (Vtoolbar[pos]);
+ recompute_overlaying_specifier (Vtoolbar);
}
@@ -1314,10 +1296,5 @@
Lisp_Object oldval)
{
- enum toolbar_pos pos = decode_toolbar_position (Vdefault_toolbar_position);
-
- Fset_specifier_dirty_flag (Vtoolbar_size[pos]);
-
- /* Let redisplay know that something has possibly changed. */
- MARK_TOOLBAR_CHANGED;
+ recompute_overlaying_specifier (Vtoolbar_size);
}
@@ -1327,10 +1304,5 @@
Lisp_Object oldval)
{
- enum toolbar_pos pos = decode_toolbar_position (Vdefault_toolbar_position);
-
- Fset_specifier_dirty_flag (Vtoolbar_border_width[pos]);
-
- /* Let redisplay know that something has possibly changed. */
- MARK_TOOLBAR_CHANGED;
+ recompute_overlaying_specifier (Vtoolbar_border_width);
}
@@ -1340,12 +1312,37 @@
Lisp_Object oldval)
{
- enum toolbar_pos pos = decode_toolbar_position (Vdefault_toolbar_position);
-
- Fset_specifier_dirty_flag (Vtoolbar_visible_p[pos]);
+ recompute_overlaying_specifier (Vtoolbar_visible_p);
+}
- /* Let redisplay know that something has possibly changed. */
+static void
+toolbar_geometry_changed_in_window (Lisp_Object specifier, struct window *w,
+ Lisp_Object oldval)
+{
MARK_TOOLBAR_CHANGED;
+ MARK_WINDOWS_CHANGED (w);
}
+static void
+default_toolbar_size_changed_in_window (Lisp_Object specifier, struct window *w,
+ Lisp_Object oldval)
+{
+ recompute_overlaying_specifier (Vtoolbar_size);
+}
+
+static void
+default_toolbar_border_width_changed_in_window (Lisp_Object specifier,
+ struct window *w,
+ Lisp_Object oldval)
+{
+ recompute_overlaying_specifier (Vtoolbar_border_width);
+}
+
+static void
+default_toolbar_visible_p_changed_in_window (Lisp_Object specifier,
+ struct window *w,
+ Lisp_Object oldval)
+{
+ recompute_overlaying_specifier (Vtoolbar_visible_p);
+}
static void
@@ -1643,5 +1640,5 @@
slot_offset (struct window,
default_toolbar_height),
- some_window_value_changed,
+ default_toolbar_size_changed_in_window,
slot_offset (struct frame,
default_toolbar_height),
@@ -1658,5 +1655,5 @@
slot_offset (struct window,
default_toolbar_width),
- some_window_value_changed,
+ default_toolbar_size_changed_in_window,
slot_offset (struct frame,
default_toolbar_width),
@@ -1674,5 +1671,5 @@
slot_offset (struct window,
toolbar_size[TOP_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_size[TOP_TOOLBAR]),
@@ -1690,5 +1687,5 @@
slot_offset (struct window,
toolbar_size[BOTTOM_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_size[BOTTOM_TOOLBAR]),
@@ -1706,5 +1703,5 @@
slot_offset (struct window,
toolbar_size[LEFT_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_size[LEFT_TOOLBAR]),
@@ -1722,5 +1719,5 @@
slot_offset (struct window,
toolbar_size[RIGHT_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_size[RIGHT_TOOLBAR]),
@@ -1787,5 +1784,5 @@
slot_offset (struct window,
default_toolbar_border_width),
- some_window_value_changed,
+ default_toolbar_border_width_changed_in_window,
slot_offset (struct frame,
default_toolbar_border_width),
@@ -1803,5 +1800,5 @@
slot_offset (struct window,
toolbar_border_width[TOP_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_border_width[TOP_TOOLBAR]),
@@ -1819,5 +1816,5 @@
slot_offset (struct window,
toolbar_border_width[BOTTOM_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_border_width[BOTTOM_TOOLBAR]),
@@ -1835,5 +1832,5 @@
slot_offset (struct window,
toolbar_border_width[LEFT_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_border_width[LEFT_TOOLBAR]),
@@ -1851,5 +1848,5 @@
slot_offset (struct window,
toolbar_border_width[RIGHT_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_border_width[RIGHT_TOOLBAR]),
@@ -1899,5 +1896,5 @@
slot_offset (struct window,
default_toolbar_visible_p),
- some_window_value_changed,
+ default_toolbar_visible_p_changed_in_window,
slot_offset (struct frame,
default_toolbar_visible_p),
@@ -1915,5 +1912,5 @@
slot_offset (struct window,
toolbar_visible_p[TOP_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_visible_p[TOP_TOOLBAR]),
@@ -1931,5 +1928,5 @@
slot_offset (struct window,
toolbar_visible_p[BOTTOM_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_visible_p[BOTTOM_TOOLBAR]),
@@ -1947,5 +1944,5 @@
slot_offset (struct window,
toolbar_visible_p[LEFT_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_visible_p[LEFT_TOOLBAR]),
@@ -1963,5 +1960,5 @@
slot_offset (struct window,
toolbar_visible_p[RIGHT_TOOLBAR]),
- some_window_value_changed,
+ toolbar_geometry_changed_in_window,
slot_offset (struct frame,
toolbar_visible_p[RIGHT_TOOLBAR]),