comparison src/xfns.c @ 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 58603538f196
children 0b974a5d9460
comparison
equal deleted inserted replaced
38573:37d0e44d564c 38574:79a0d7b341b3
10482 /* If non-nil, a vector of 3 elements containing the last args 10482 /* If non-nil, a vector of 3 elements containing the last args
10483 with which x-show-tip was called. See there. */ 10483 with which x-show-tip was called. See there. */
10484 10484
10485 Lisp_Object last_show_tip_args; 10485 Lisp_Object last_show_tip_args;
10486 10486
10487 /* Maximum size for tooltips; a cons (COLUMNS . ROWS). */
10488
10489 Lisp_Object Vx_max_tooltip_size;
10490
10487 10491
10488 static Lisp_Object 10492 static Lisp_Object
10489 unwind_create_tip_frame (frame) 10493 unwind_create_tip_frame (frame)
10490 Lisp_Object frame; 10494 Lisp_Object frame;
10491 { 10495 {
10555 10559
10556 buffer = Fget_buffer_create (build_string (" *tip*")); 10560 buffer = Fget_buffer_create (build_string (" *tip*"));
10557 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer); 10561 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer);
10558 old_buffer = current_buffer; 10562 old_buffer = current_buffer;
10559 set_buffer_internal_1 (XBUFFER (buffer)); 10563 set_buffer_internal_1 (XBUFFER (buffer));
10564 current_buffer->truncate_lines = Qnil;
10560 Ferase_buffer (); 10565 Ferase_buffer ();
10561 Finsert (1, &text); 10566 Finsert (1, &text);
10562 set_buffer_internal_1 (old_buffer); 10567 set_buffer_internal_1 (old_buffer);
10563 10568
10564 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; 10569 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
10891 (string, frame, parms, timeout, dx, dy) 10896 (string, frame, parms, timeout, dx, dy)
10892 Lisp_Object string, frame, parms, timeout, dx, dy; 10897 Lisp_Object string, frame, parms, timeout, dx, dy;
10893 { 10898 {
10894 struct frame *f; 10899 struct frame *f;
10895 struct window *w; 10900 struct window *w;
10896 Lisp_Object buffer, top, left; 10901 Lisp_Object buffer, top, left, max_width, max_height;
10897 int root_x, root_y; 10902 int root_x, root_y;
10898 struct buffer *old_buffer; 10903 struct buffer *old_buffer;
10899 struct text_pos pos; 10904 struct text_pos pos;
10900 int i, width, height; 10905 int i, width, height;
10901 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 10906 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
10979 /* Create a frame for the tooltip, and record it in the global 10984 /* Create a frame for the tooltip, and record it in the global
10980 variable tip_frame. */ 10985 variable tip_frame. */
10981 frame = x_create_tip_frame (FRAME_X_DISPLAY_INFO (f), parms, string); 10986 frame = x_create_tip_frame (FRAME_X_DISPLAY_INFO (f), parms, string);
10982 f = XFRAME (frame); 10987 f = XFRAME (frame);
10983 10988
10984 /* Set up the frame's root window. Currently we use a size of 80 10989 /* Set up the frame's root window. */
10985 columns x 40 lines. If someone wants to show a larger tip, he
10986 will loose. I don't think this is a realistic case. */
10987 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 10990 w = XWINDOW (FRAME_ROOT_WINDOW (f));
10988 w->left = w->top = make_number (0); 10991 w->left = w->top = make_number (0);
10989 w->width = make_number (80); 10992
10990 w->height = make_number (40); 10993 if (CONSP (Vx_max_tooltip_size)
10994 && INTEGERP (XCAR (Vx_max_tooltip_size))
10995 && XINT (XCAR (Vx_max_tooltip_size)) > 0
10996 && INTEGERP (XCDR (Vx_max_tooltip_size))
10997 && XINT (XCDR (Vx_max_tooltip_size)) > 0)
10998 {
10999 w->width = XCAR (Vx_max_tooltip_size);
11000 w->height = XCDR (Vx_max_tooltip_size);
11001 }
11002 else
11003 {
11004 w->width = make_number (80);
11005 w->height = make_number (40);
11006 }
11007
11008 f->window_width = XINT (w->width);
10991 adjust_glyphs (f); 11009 adjust_glyphs (f);
10992 w->pseudo_window_p = 1; 11010 w->pseudo_window_p = 1;
10993 11011
10994 /* Display the tooltip text in a temporary buffer. */ 11012 /* Display the tooltip text in a temporary buffer. */
10995 old_buffer = current_buffer; 11013 old_buffer = current_buffer;
10996 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 11014 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
11015 current_buffer->truncate_lines = Qnil;
10997 clear_glyph_matrix (w->desired_matrix); 11016 clear_glyph_matrix (w->desired_matrix);
10998 clear_glyph_matrix (w->current_matrix); 11017 clear_glyph_matrix (w->current_matrix);
10999 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 11018 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
11000 try_window (FRAME_ROOT_WINDOW (f), pos); 11019 try_window (FRAME_ROOT_WINDOW (f), pos);
11001 11020
11357 for (i = kb->min_key_code; 11376 for (i = kb->min_key_code;
11358 (i < kb->max_key_code 11377 (i < kb->max_key_code
11359 && (delete_keycode == 0 || backspace_keycode == 0)); 11378 && (delete_keycode == 0 || backspace_keycode == 0));
11360 ++i) 11379 ++i)
11361 { 11380 {
11362 /* The XKB symbolic key names can be seen most easily 11381 /* The XKB symbolic key names can be seen most easily in
11363 in the PS file generated by `xkbprint -label name $DISPLAY'. */ 11382 the PS file generated by `xkbprint -label name
11383 $DISPLAY'. */
11364 if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0) 11384 if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0)
11365 delete_keycode = i; 11385 delete_keycode = i;
11366 else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0) 11386 else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0)
11367 backspace_keycode = i; 11387 backspace_keycode = i;
11368 } 11388 }
11594 11614
11595 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, 11615 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
11596 "A string indicating the foreground color of the cursor box."); 11616 "A string indicating the foreground color of the cursor box.");
11597 Vx_cursor_fore_pixel = Qnil; 11617 Vx_cursor_fore_pixel = Qnil;
11598 11618
11619 DEFVAR_LISP ("x-max-tooltip-size", &Vx_max_tooltip_size,
11620 "Maximum size for tooltips. Value is a pair (COLUMNS . ROWS).\n\
11621 Text larger than this is clipped.");
11622 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40));
11623
11599 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, 11624 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
11600 "Non-nil if no X window manager is in use.\n\ 11625 "Non-nil if no X window manager is in use.\n\
11601 Emacs doesn't try to figure this out; this is always nil\n\ 11626 Emacs doesn't try to figure this out; this is always nil\n\
11602 unless you set it to something else."); 11627 unless you set it to something else.");
11603 /* We don't have any way to find this out, so set it to nil 11628 /* We don't have any way to find this out, so set it to nil