From 122e7264b88049e8d1a0b54dd993f137238c33fb Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 9 Dec 2017 22:06:19 +0200 Subject: [PATCH] Fix tool-tip display when display margins are non-zero by default * src/buffer.h (bset_left_margin_cols, bset_right_margin_cols): New inline functions. * src/xfns.c (Fx_show_tip): * src/w32fns.c (Fx_show_tip): Force display margins of the tip buffer to zero, as it will be displayed in a pseudo-window, which doesn't support display margins. (Bug#29627) --- src/buffer.h | 10 ++++++++++ src/w32fns.c | 8 +++++++- src/window.h | 3 ++- src/xfns.c | 8 +++++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/buffer.h b/src/buffer.h index 46c7c6e5ad6..ecd2360dbca 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -949,6 +949,16 @@ bset_display_count (struct buffer *b, Lisp_Object val) b->display_count_ = val; } INLINE void +bset_left_margin_cols (struct buffer *b, Lisp_Object val) +{ + b->left_margin_cols_ = val; +} +INLINE void +bset_right_margin_cols (struct buffer *b, Lisp_Object val) +{ + b->right_margin_cols_ = val; +} +INLINE void bset_display_time (struct buffer *b, Lisp_Object val) { b->display_time_ = val; diff --git a/src/w32fns.c b/src/w32fns.c index 43af1122fad..b81cd70e0a7 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -7346,6 +7346,7 @@ Text larger than the specified size is clipped. */) ptrdiff_t count = SPECPDL_INDEX (); ptrdiff_t count_1; Lisp_Object window, size; + Lisp_Object tip_buf; AUTO_STRING (tip, " *tip*"); specbind (Qinhibit_redisplay, Qt); @@ -7503,7 +7504,12 @@ Text larger than the specified size is clipped. */) tip_f = XFRAME (tip_frame); window = FRAME_ROOT_WINDOW (tip_f); - set_window_buffer (window, Fget_buffer_create (tip), false, false); + tip_buf = Fget_buffer_create (tip); + /* We will mark the tip window a "pseudo-window" below, and such + windows cannot have display margins. */ + bset_left_margin_cols (XBUFFER (tip_buf), make_number (0)); + bset_right_margin_cols (XBUFFER (tip_buf), make_number (0)); + set_window_buffer (window, tip_buf, false, false); w = XWINDOW (window); w->pseudo_window_p = true; diff --git a/src/window.h b/src/window.h index 25c9686a9f0..563a6f6ff0d 100644 --- a/src/window.h +++ b/src/window.h @@ -370,7 +370,8 @@ struct window bool_bf must_be_updated_p : 1; /* Flag indicating that this window is not a real one. - Currently only used for menu bar windows of frames. */ + Currently only used for menu bar windows, for tool bar windows, + and for tooltips. */ bool_bf pseudo_window_p : 1; /* True means fringes are drawn outside display margins. diff --git a/src/xfns.c b/src/xfns.c index bbe73aa7c28..044f14876e3 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -6623,6 +6623,7 @@ Text larger than the specified size is clipped. */) ptrdiff_t count = SPECPDL_INDEX (); ptrdiff_t count_1; Lisp_Object window, size; + Lisp_Object tip_buf; AUTO_STRING (tip, " *tip*"); specbind (Qinhibit_redisplay, Qt); @@ -6787,7 +6788,12 @@ Text larger than the specified size is clipped. */) tip_f = XFRAME (tip_frame); window = FRAME_ROOT_WINDOW (tip_f); - set_window_buffer (window, Fget_buffer_create (tip), false, false); + tip_buf = Fget_buffer_create (tip); + /* We will mark the tip window a "pseudo-window" below, and such + windows cannot have display margins. */ + bset_left_margin_cols (XBUFFER (tip_buf), make_number (0)); + bset_right_margin_cols (XBUFFER (tip_buf), make_number (0)); + set_window_buffer (window, tip_buf, false, false); w = XWINDOW (window); w->pseudo_window_p = true; -- 2.39.2