[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a29a3ad55d: Apply tooltip assertions to all instances of x-show-t
From: |
Po Lu |
Subject: |
master a29a3ad55d: Apply tooltip assertions to all instances of x-show-tip |
Date: |
Thu, 21 Jul 2022 04:27:01 -0400 (EDT) |
branch: master
commit a29a3ad55d650af6230e2cfe8ef1ef45b5feb133
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Apply tooltip assertions to all instances of x-show-tip
* src/haikufns.c (Fx_show_tip):
(syms_of_haikufns):
* src/nsfns.m (Fx_show_tip):
(syms_of_nsfns):
* src/pgtkfns.c (Fx_show_tip):
(syms_of_pgtkfns):
* src/xfns.c (Fx_show_tip):
(syms_of_xfns): Add assertion and adjust default values.
---
src/haikufns.c | 27 +++++++++++++++++++++++++--
src/nsfns.m | 30 +++++++++++++++++++++++++++---
src/pgtkfns.c | 27 +++++++++++++++++++++++++--
src/xfns.c | 27 +++++++++++++++++++++++++--
4 files changed, 102 insertions(+), 9 deletions(-)
diff --git a/src/haikufns.c b/src/haikufns.c
index e0a65b499f..67f79a3166 100644
--- a/src/haikufns.c
+++ b/src/haikufns.c
@@ -2330,6 +2330,10 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
int old_windows_or_buffers_changed = windows_or_buffers_changed;
specpdl_ref count = SPECPDL_INDEX ();
Lisp_Object window, size, tip_buf;
+ bool displayed;
+#ifdef ENABLE_CHECKING
+ struct glyph_row *row, *end;
+#endif
AUTO_STRING (tip, " *tip*");
specbind (Qinhibit_redisplay, Qt);
@@ -2558,7 +2562,26 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
- try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+ displayed = try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+
+ if (!displayed && NILP (Vx_max_tooltip_size))
+ {
+#ifdef ENABLE_CHECKING
+ row = w->desired_matrix->rows;
+ end = w->desired_matrix->rows + w->desired_matrix->nrows;
+
+ while (row < end)
+ {
+ if (!row->displays_text_p
+ || row->ends_at_zv_p)
+ break;
+ ++row;
+ }
+
+ eassert (row < end && row->ends_at_zv_p);
+#endif
+ }
+
/* Calculate size of tooltip window. */
size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
make_fixnum (w->pixel_height), Qnil,
@@ -3179,7 +3202,7 @@ syms_of_haikufns (void)
DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size,
doc: /* SKIP: real doc in xfns.c. */);
- Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40));
+ Vx_max_tooltip_size = Qnil;
DEFVAR_LISP ("x-cursor-fore-pixel", Vx_cursor_fore_pixel,
doc: /* SKIP: real doc in xfns.c. */);
diff --git a/src/nsfns.m b/src/nsfns.m
index 1617421066..b0b779bd41 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -3210,7 +3210,8 @@ x_hide_tip (bool delete)
DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
doc: /* SKIP: real doc in xfns.c. */)
- (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object
timeout, Lisp_Object dx, Lisp_Object dy)
+ (Lisp_Object string, Lisp_Object frame, Lisp_Object parms,
+ Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy)
{
int root_x, root_y;
specpdl_ref count = SPECPDL_INDEX ();
@@ -3224,6 +3225,10 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
Lisp_Object window, size, tip_buf;
char *str;
NSWindow *nswindow;
+ bool displayed;
+#ifdef ENABLE_CHECKING
+ struct glyph_row *row, *end;
+#endif
AUTO_STRING (tip, " *tip*");
@@ -3454,7 +3459,26 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
- try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+ displayed = try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+
+ if (!displayed && NILP (Vx_max_tooltip_size))
+ {
+#ifdef ENABLE_CHECKING
+ row = w->desired_matrix->rows;
+ end = w->desired_matrix->rows + w->desired_matrix->nrows;
+
+ while (row < end)
+ {
+ if (!row->displays_text_p
+ || row->ends_at_zv_p)
+ break;
+ ++row;
+ }
+
+ eassert (row < end && row->ends_at_zv_p);
+#endif
+ }
+
/* Calculate size of tooltip window. */
size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
make_fixnum (w->pixel_height), Qnil,
@@ -3889,7 +3913,7 @@ Default is t. */);
DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size,
doc: /* SKIP: real doc in xfns.c. */);
- Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40));
+ Vx_max_tooltip_size = Qnil;
defsubr (&Sns_read_file_name);
defsubr (&Sns_get_resource);
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 5c43e5f360..d998c3d938 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -3130,6 +3130,10 @@ Text larger than the specified size is clipped. */)
int old_windows_or_buffers_changed = windows_or_buffers_changed;
specpdl_ref count = SPECPDL_INDEX ();
Lisp_Object window, size, tip_buf;
+ bool displayed;
+#ifdef ENABLE_CHECKING
+ struct glyph_row *row, *end;
+#endif
AUTO_STRING (tip, " *tip*");
specbind (Qinhibit_redisplay, Qt);
@@ -3334,7 +3338,26 @@ Text larger than the specified size is clipped. */)
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
- try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+ displayed = try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+
+ if (!displayed && NILP (Vx_max_tooltip_size))
+ {
+#ifdef ENABLE_CHECKING
+ row = w->desired_matrix->rows;
+ end = w->desired_matrix->rows + w->desired_matrix->nrows;
+
+ while (row < end)
+ {
+ if (!row->displays_text_p
+ || row->ends_at_zv_p)
+ break;
+ ++row;
+ }
+
+ eassert (row < end && row->ends_at_zv_p);
+#endif
+ }
+
/* Calculate size of tooltip window. */
size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
make_fixnum (w->pixel_height), Qnil,
@@ -3924,7 +3947,7 @@ syms_of_pgtkfns (void)
DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size,
doc: /* SKIP: real doc in xfns.c. */);
- Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40));
+ Vx_max_tooltip_size = Qnil;
DEFSYM (Qmono, "mono");
DEFSYM (Qassq_delete_all, "assq-delete-all");
diff --git a/src/xfns.c b/src/xfns.c
index 44208ffd51..ce867c1619 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -8623,6 +8623,10 @@ Text larger than the specified size is clipped. */)
Window child;
XWindowAttributes child_attrs;
int dest_x_return, dest_y_return;
+ bool displayed;
+#ifdef ENABLE_CHECKING
+ struct glyph_row *row, *end;
+#endif
AUTO_STRING (tip, " *tip*");
specbind (Qinhibit_redisplay, Qt);
@@ -8835,7 +8839,26 @@ Text larger than the specified size is clipped. */)
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
- try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+ displayed = try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+
+ if (!displayed && NILP (Vx_max_tooltip_size))
+ {
+#ifdef ENABLE_CHECKING
+ row = w->desired_matrix->rows;
+ end = w->desired_matrix->rows + w->desired_matrix->nrows;
+
+ while (row < end)
+ {
+ if (!row->displays_text_p
+ || row->ends_at_zv_p)
+ break;
+ ++row;
+ }
+
+ eassert (row < end && row->ends_at_zv_p);
+#endif
+ }
+
/* Calculate size of tooltip window. */
size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
make_fixnum (w->pixel_height), Qnil,
@@ -9949,7 +9972,7 @@ or when you set the mouse color. */);
DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size,
doc: /* Maximum size for tooltips.
Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */);
- Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40));
+ Vx_max_tooltip_size = Qnil;
DEFVAR_LISP ("x-no-window-manager", Vx_no_window_manager,
doc: /* Non-nil if no X window manager is in use.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master a29a3ad55d: Apply tooltip assertions to all instances of x-show-tip,
Po Lu <=