changeset 38574:79a0d7b341b3

(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.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 26 Jul 2001 13:14:02 +0000
parents 37d0e44d564c
children 0b974a5d9460
files src/xfns.c
diffstat 1 files changed, 33 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Thu Jul 26 12:34:25 2001 +0000
+++ b/src/xfns.c	Thu Jul 26 13:14:02 2001 +0000
@@ -10484,6 +10484,10 @@
 
 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 @@
   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 @@
 {
   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 @@
   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 @@
 		&& (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 @@
 	       "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\