[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r114147: Cache current header and mode line height f
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] trunk r114147: Cache current header and mode line height for each window. |
Date: |
Thu, 05 Sep 2013 17:05:37 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 114147
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Thu 2013-09-05 20:25:20 +0400
message:
Cache current header and mode line height for each window.
* window.h (struct window): New fields mode_line_height
and header_line_height.
* window.c (make_window): Initialize them.
* dispextern.h (CURRENT_MODE_LINE_HEIGHT)
(CURRENT_HEADER_LINE_HEIGHT): Use them. Adjust comment.
(current_mode_line_height, current_header_line_height):
Remove declaration.
* xdisp.c (current_mode_line_height, current_header_line_height):
Remove.
(pos_visible_p, init_xdisp): Adjust user.
(redisplay_window): Invalidate mode_line_height and
header_line_height if current and desired matrices do not agree.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/dispextern.h
dispextern.h-20091113204419-o5vbwnq5f7feedwu-218
src/window.c window.c-20091113204419-o5vbwnq5f7feedwu-231
src/window.h window.h-20091113204419-o5vbwnq5f7feedwu-271
src/xdisp.c xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-09-05 12:08:50 +0000
+++ b/src/ChangeLog 2013-09-05 16:25:20 +0000
@@ -1,5 +1,21 @@
2013-09-05 Dmitry Antipov <address@hidden>
+ Cache current header and mode line height for each window.
+ * window.h (struct window): New fields mode_line_height
+ and header_line_height.
+ * window.c (make_window): Initialize them.
+ * dispextern.h (CURRENT_MODE_LINE_HEIGHT)
+ (CURRENT_HEADER_LINE_HEIGHT): Use them. Adjust comment.
+ (current_mode_line_height, current_header_line_height):
+ Remove declaration.
+ * xdisp.c (current_mode_line_height, current_header_line_height):
+ Remove.
+ (pos_visible_p, init_xdisp): Adjust user.
+ (redisplay_window): Invalidate mode_line_height and
+ header_line_height if current and desired matrices do not agree.
+
+2013-09-05 Dmitry Antipov <address@hidden>
+
* fontset.c, window.c, xdisp.c (toplevel): Use TERM_HEADER.
* xfaces.c (toplevel) [HAVE_X_WINDOWS]: Do not include xterm.h twice.
=== modified file 'src/dispextern.h'
--- a/src/dispextern.h 2013-09-01 16:21:48 +0000
+++ b/src/dispextern.h 2013-09-05 16:25:20 +0000
@@ -1428,31 +1428,31 @@
#define CURRENT_MODE_LINE_FACE_ID(W) \
(CURRENT_MODE_LINE_FACE_ID_3((W), XWINDOW (selected_window), (W)))
-/* Return the current height of the mode line of window W. If not
- known from current_mode_line_height, look at W's current glyph
- matrix, or return a default based on the height of the font of the
- face `mode-line'. */
-
-#define CURRENT_MODE_LINE_HEIGHT(W) \
- (current_mode_line_height >= 0 \
- ? current_mode_line_height \
- : (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \
- ? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \
- : estimate_mode_line_height (XFRAME ((W)->frame), \
- CURRENT_MODE_LINE_FACE_ID (W))))
-
-/* Return the current height of the header line of window W. If not
- known from current_header_line_height, look at W's current glyph
- matrix, or return an estimation based on the height of the font of
- the face `header-line'. */
+/* Return the current height of the mode line of window W. If not known
+ from W->mode_line_height, look at W's current glyph matrix, or return
+ a default based on the height of the font of the face `mode-line'. */
+
+#define CURRENT_MODE_LINE_HEIGHT(W) \
+ (W->mode_line_height >= 0 \
+ ? W->mode_line_height \
+ : (W->mode_line_height \
+ = (MATRIX_MODE_LINE_HEIGHT (W->current_matrix) \
+ ? MATRIX_MODE_LINE_HEIGHT (W->current_matrix) \
+ : estimate_mode_line_height \
+ (XFRAME (W->frame), CURRENT_MODE_LINE_FACE_ID (W)))))
+
+/* Return the current height of the header line of window W. If not known
+ from W->header_line_height, look at W's current glyph matrix, or return
+ an estimation based on the height of the font of the face `header-line'. */
#define CURRENT_HEADER_LINE_HEIGHT(W) \
- (current_header_line_height >= 0 \
- ? current_header_line_height \
- : (MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \
- ? MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \
- : estimate_mode_line_height (XFRAME ((W)->frame), \
- HEADER_LINE_FACE_ID)))
+ (W->header_line_height >= 0 \
+ ? W->header_line_height \
+ : (W->header_line_height \
+ = (MATRIX_HEADER_LINE_HEIGHT (W->current_matrix) \
+ ? MATRIX_HEADER_LINE_HEIGHT (W->current_matrix) \
+ : estimate_mode_line_height \
+ (XFRAME (W->frame), HEADER_LINE_FACE_ID))))
/* Return the height of the desired mode line of window W. */
@@ -3201,7 +3201,6 @@
extern Lisp_Object Qtool_bar;
extern bool redisplaying_p;
extern int help_echo_showing_p;
-extern int current_mode_line_height, current_header_line_height;
extern Lisp_Object help_echo_string, help_echo_window;
extern Lisp_Object help_echo_object, previous_help_echo_string;
extern ptrdiff_t help_echo_pos;
=== modified file 'src/window.c'
--- a/src/window.c 2013-09-05 12:08:50 +0000
+++ b/src/window.c 2013-09-05 16:25:20 +0000
@@ -3419,6 +3419,7 @@
non-Lisp data, so do it only for slots which should not be zero. */
w->nrows_scale_factor = w->ncols_scale_factor = 1;
w->left_fringe_width = w->right_fringe_width = -1;
+ w->mode_line_height = w->header_line_height = -1;
w->phys_cursor_type = -1;
w->phys_cursor_width = -1;
w->scroll_bar_width = -1;
=== modified file 'src/window.h'
--- a/src/window.h 2013-09-02 06:12:26 +0000
+++ b/src/window.h 2013-09-05 16:25:20 +0000
@@ -264,6 +264,12 @@
A value of -1 means use frame values. */
int scroll_bar_width;
+ /* Effective height of the mode line, or -1 if not known. */
+ int mode_line_height;
+
+ /* Effective height of the header line, or -1 if not known. */
+ int header_line_height;
+
/* Z - the buffer position of the last glyph in the current
matrix of W. Only valid if window_end_valid is nonzero. */
ptrdiff_t window_end_pos;
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2013-09-05 12:08:50 +0000
+++ b/src/xdisp.c 2013-09-05 16:25:20 +0000
@@ -573,12 +573,6 @@
int help_echo_showing_p;
-/* If >= 0, computed, exact values of mode-line and header-line height
- to use in the macros CURRENT_MODE_LINE_HEIGHT and
- CURRENT_HEADER_LINE_HEIGHT. */
-
-int current_mode_line_height, current_header_line_height;
-
/* The maximum distance to look ahead for text properties. Values
that are too small let us call compute_char_face and similar
functions too often which is expensive. Values that are too large
@@ -1349,12 +1343,12 @@
/* Compute exact mode line heights. */
if (WINDOW_WANTS_MODELINE_P (w))
- current_mode_line_height
+ w->mode_line_height
= display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
BVAR (current_buffer, mode_line_format));
if (WINDOW_WANTS_HEADER_LINE_P (w))
- current_header_line_height
+ w->header_line_height
= display_mode_line (w, HEADER_LINE_FACE_ID,
BVAR (current_buffer, header_line_format));
@@ -1647,8 +1641,6 @@
if (old_buffer)
set_buffer_internal_1 (old_buffer);
- current_header_line_height = current_mode_line_height = -1;
-
if (visible_p && w->hscroll > 0)
*x -=
window_hscroll_limited (w, WINDOW_XFRAME (w))
@@ -16107,6 +16099,7 @@
&& CURRENT_MODE_LINE_HEIGHT (w) != DESIRED_MODE_LINE_HEIGHT (w))
{
fonts_changed_p = 1;
+ w->mode_line_height = -1;
MATRIX_MODE_LINE_ROW (w->current_matrix)->height
= DESIRED_MODE_LINE_HEIGHT (w);
}
@@ -16117,6 +16110,7 @@
&& CURRENT_HEADER_LINE_HEIGHT (w) != DESIRED_HEADER_LINE_HEIGHT (w))
{
fonts_changed_p = 1;
+ w->header_line_height = -1;
MATRIX_HEADER_LINE_ROW (w->current_matrix)->height
= DESIRED_HEADER_LINE_HEIGHT (w);
}
@@ -29686,8 +29680,6 @@
void
init_xdisp (void)
{
- current_header_line_height = current_mode_line_height = -1;
-
CHARPOS (this_line_start_pos) = 0;
if (!noninteractive)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r114147: Cache current header and mode line height for each window.,
Dmitry Antipov <=