diff options
| author | Po Lu | 2022-07-21 16:26:34 +0800 |
|---|---|---|
| committer | Po Lu | 2022-07-21 16:26:50 +0800 |
| commit | a29a3ad55d650af6230e2cfe8ef1ef45b5feb133 (patch) | |
| tree | e7e41121f33c6e592c406f81f4f8cb5c094f33e2 /src/pgtkfns.c | |
| parent | 5f1023a2ffe7c96027c3eaf23c1cf93cd5c78dfa (diff) | |
| download | emacs-a29a3ad55d650af6230e2cfe8ef1ef45b5feb133.tar.gz emacs-a29a3ad55d650af6230e2cfe8ef1ef45b5feb133.zip | |
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.
Diffstat (limited to 'src/pgtkfns.c')
| -rw-r--r-- | src/pgtkfns.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/pgtkfns.c b/src/pgtkfns.c index 5c43e5f3607..d998c3d938c 100644 --- a/src/pgtkfns.c +++ b/src/pgtkfns.c | |||
| @@ -3130,6 +3130,10 @@ Text larger than the specified size is clipped. */) | |||
| 3130 | int old_windows_or_buffers_changed = windows_or_buffers_changed; | 3130 | int old_windows_or_buffers_changed = windows_or_buffers_changed; |
| 3131 | specpdl_ref count = SPECPDL_INDEX (); | 3131 | specpdl_ref count = SPECPDL_INDEX (); |
| 3132 | Lisp_Object window, size, tip_buf; | 3132 | Lisp_Object window, size, tip_buf; |
| 3133 | bool displayed; | ||
| 3134 | #ifdef ENABLE_CHECKING | ||
| 3135 | struct glyph_row *row, *end; | ||
| 3136 | #endif | ||
| 3133 | AUTO_STRING (tip, " *tip*"); | 3137 | AUTO_STRING (tip, " *tip*"); |
| 3134 | 3138 | ||
| 3135 | specbind (Qinhibit_redisplay, Qt); | 3139 | specbind (Qinhibit_redisplay, Qt); |
| @@ -3334,7 +3338,26 @@ Text larger than the specified size is clipped. */) | |||
| 3334 | clear_glyph_matrix (w->desired_matrix); | 3338 | clear_glyph_matrix (w->desired_matrix); |
| 3335 | clear_glyph_matrix (w->current_matrix); | 3339 | clear_glyph_matrix (w->current_matrix); |
| 3336 | SET_TEXT_POS (pos, BEGV, BEGV_BYTE); | 3340 | SET_TEXT_POS (pos, BEGV, BEGV_BYTE); |
| 3337 | try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); | 3341 | displayed = try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); |
| 3342 | |||
| 3343 | if (!displayed && NILP (Vx_max_tooltip_size)) | ||
| 3344 | { | ||
| 3345 | #ifdef ENABLE_CHECKING | ||
| 3346 | row = w->desired_matrix->rows; | ||
| 3347 | end = w->desired_matrix->rows + w->desired_matrix->nrows; | ||
| 3348 | |||
| 3349 | while (row < end) | ||
| 3350 | { | ||
| 3351 | if (!row->displays_text_p | ||
| 3352 | || row->ends_at_zv_p) | ||
| 3353 | break; | ||
| 3354 | ++row; | ||
| 3355 | } | ||
| 3356 | |||
| 3357 | eassert (row < end && row->ends_at_zv_p); | ||
| 3358 | #endif | ||
| 3359 | } | ||
| 3360 | |||
| 3338 | /* Calculate size of tooltip window. */ | 3361 | /* Calculate size of tooltip window. */ |
| 3339 | size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil, | 3362 | size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil, |
| 3340 | make_fixnum (w->pixel_height), Qnil, | 3363 | make_fixnum (w->pixel_height), Qnil, |
| @@ -3924,7 +3947,7 @@ syms_of_pgtkfns (void) | |||
| 3924 | 3947 | ||
| 3925 | DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size, | 3948 | DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size, |
| 3926 | doc: /* SKIP: real doc in xfns.c. */); | 3949 | doc: /* SKIP: real doc in xfns.c. */); |
| 3927 | Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40)); | 3950 | Vx_max_tooltip_size = Qnil; |
| 3928 | 3951 | ||
| 3929 | DEFSYM (Qmono, "mono"); | 3952 | DEFSYM (Qmono, "mono"); |
| 3930 | DEFSYM (Qassq_delete_all, "assq-delete-all"); | 3953 | DEFSYM (Qassq_delete_all, "assq-delete-all"); |