From d63931a26f6390e3dd44ec52bdb211ef46d4f604 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Thu, 26 Jul 2001 13:14:02 +0000 Subject: [PATCH] (Vx_max_tooltip_size): New variable. (syms_of_xfns): DEFVAR_LISP it. (Fx_show_tip): Set frame's window_width to the width of the window. Use a maximum tooltip size specified by Vx_max_tooltip_size, if that has valid contents. (x_create_tip_frame): Set tooltip buffer's truncate-lines to nil. --- src/xfns.c | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/xfns.c b/src/xfns.c index 1713c8ef963..0b1a492a758 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -10484,6 +10484,10 @@ Window tip_window; Lisp_Object last_show_tip_args; +/* Maximum size for tooltips; a cons (COLUMNS . ROWS). */ + +Lisp_Object Vx_max_tooltip_size; + static Lisp_Object unwind_create_tip_frame (frame) @@ -10557,6 +10561,7 @@ x_create_tip_frame (dpyinfo, parms, text) Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer); old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (buffer)); + current_buffer->truncate_lines = Qnil; Ferase_buffer (); Finsert (1, &text); set_buffer_internal_1 (old_buffer); @@ -10893,7 +10898,7 @@ DY added (default is -10).") { struct frame *f; struct window *w; - Lisp_Object buffer, top, left; + Lisp_Object buffer, top, left, max_width, max_height; int root_x, root_y; struct buffer *old_buffer; struct text_pos pos; @@ -10981,19 +10986,33 @@ DY added (default is -10).") frame = x_create_tip_frame (FRAME_X_DISPLAY_INFO (f), parms, string); f = XFRAME (frame); - /* Set up the frame's root window. Currently we use a size of 80 - columns x 40 lines. If someone wants to show a larger tip, he - will loose. I don't think this is a realistic case. */ + /* Set up the frame's root window. */ w = XWINDOW (FRAME_ROOT_WINDOW (f)); w->left = w->top = make_number (0); - w->width = make_number (80); - w->height = make_number (40); + + if (CONSP (Vx_max_tooltip_size) + && INTEGERP (XCAR (Vx_max_tooltip_size)) + && XINT (XCAR (Vx_max_tooltip_size)) > 0 + && INTEGERP (XCDR (Vx_max_tooltip_size)) + && XINT (XCDR (Vx_max_tooltip_size)) > 0) + { + w->width = XCAR (Vx_max_tooltip_size); + w->height = XCDR (Vx_max_tooltip_size); + } + else + { + w->width = make_number (80); + w->height = make_number (40); + } + + f->window_width = XINT (w->width); adjust_glyphs (f); w->pseudo_window_p = 1; /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); + current_buffer->truncate_lines = Qnil; clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); @@ -11359,8 +11378,9 @@ usual X keysyms.") && (delete_keycode == 0 || backspace_keycode == 0)); ++i) { - /* The XKB symbolic key names can be seen most easily - in the PS file generated by `xkbprint -label name $DISPLAY'. */ + /* The XKB symbolic key names can be seen most easily in + the PS file generated by `xkbprint -label name + $DISPLAY'. */ if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0) delete_keycode = i; else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0) @@ -11596,6 +11616,11 @@ or when you set the mouse color."); "A string indicating the foreground color of the cursor box."); Vx_cursor_fore_pixel = Qnil; + DEFVAR_LISP ("x-max-tooltip-size", &Vx_max_tooltip_size, + "Maximum size for tooltips. Value is a pair (COLUMNS . ROWS).\n\ +Text larger than this is clipped."); + Vx_max_tooltip_size = Fcons (make_number (80), make_number (40)); + DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, "Non-nil if no X window manager is in use.\n\ Emacs doesn't try to figure this out; this is always nil\n\ -- 2.39.2