diff options
| author | John Wiegley | 2016-07-12 15:27:25 -0700 |
|---|---|---|
| committer | John Wiegley | 2016-07-12 15:27:25 -0700 |
| commit | 54b7eb0dee2397f1430e81b7356f8efb19946ba0 (patch) | |
| tree | a463da12f08f32dc78beb2f99a37eb1951f51a43 /src | |
| parent | 9c8c3a5478db6ff4b245e9128cbf24bd722ab1d6 (diff) | |
| download | emacs-54b7eb0dee2397f1430e81b7356f8efb19946ba0.tar.gz emacs-54b7eb0dee2397f1430e81b7356f8efb19946ba0.zip | |
Revert "Cleanup tooltips"
This reverts commit 20038f8ab75dd1551412a43cd58520c483c22921.
I am reverting this change because it was applied without prior discussion
on emacs-devel, and has been found to break the NS port. It needs more
testing and review before it should be applied here.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/frame.c | 19 | ||||
| -rw-r--r-- | src/frame.h | 9 | ||||
| -rw-r--r-- | src/gtkutil.c | 29 | ||||
| -rw-r--r-- | src/gtkutil.h | 1 | ||||
| -rw-r--r-- | src/menu.c | 7 | ||||
| -rw-r--r-- | src/nsfns.m | 4 | ||||
| -rw-r--r-- | src/w32fns.c | 213 | ||||
| -rw-r--r-- | src/w32term.c | 15 | ||||
| -rw-r--r-- | src/w32term.h | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 21 | ||||
| -rw-r--r-- | src/xfns.c | 277 | ||||
| -rw-r--r-- | src/xterm.c | 19 | ||||
| -rw-r--r-- | src/xterm.h | 4 |
14 files changed, 304 insertions, 319 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index c2fcca5591a..1325ff9da28 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3461,6 +3461,8 @@ void gamma_correct (struct frame *, COLORREF *); | |||
| 3461 | void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); | 3461 | void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); |
| 3462 | void x_change_tool_bar_height (struct frame *f, int); | 3462 | void x_change_tool_bar_height (struct frame *f, int); |
| 3463 | 3463 | ||
| 3464 | extern Lisp_Object tip_frame; | ||
| 3465 | extern Window tip_window; | ||
| 3464 | extern frame_parm_handler x_frame_parm_handlers[]; | 3466 | extern frame_parm_handler x_frame_parm_handlers[]; |
| 3465 | 3467 | ||
| 3466 | extern void start_hourglass (void); | 3468 | extern void start_hourglass (void); |
diff --git a/src/frame.c b/src/frame.c index 80e181f89ef..22143ab26bf 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -642,7 +642,6 @@ make_frame (bool mini_p) | |||
| 642 | f->vertical_scroll_bar_type = vertical_scroll_bar_none; | 642 | f->vertical_scroll_bar_type = vertical_scroll_bar_none; |
| 643 | f->horizontal_scroll_bars = false; | 643 | f->horizontal_scroll_bars = false; |
| 644 | f->want_fullscreen = FULLSCREEN_NONE; | 644 | f->want_fullscreen = FULLSCREEN_NONE; |
| 645 | f->tooltip = false; | ||
| 646 | #if ! defined (USE_GTK) && ! defined (HAVE_NS) | 645 | #if ! defined (USE_GTK) && ! defined (HAVE_NS) |
| 647 | f->last_tool_bar_item = -1; | 646 | f->last_tool_bar_item = -1; |
| 648 | #endif | 647 | #endif |
| @@ -1261,16 +1260,13 @@ DEFUN ("frame-list", Fframe_list, Sframe_list, | |||
| 1261 | doc: /* Return a list of all live frames. */) | 1260 | doc: /* Return a list of all live frames. */) |
| 1262 | (void) | 1261 | (void) |
| 1263 | { | 1262 | { |
| 1263 | Lisp_Object frames; | ||
| 1264 | frames = Fcopy_sequence (Vframe_list); | ||
| 1264 | #ifdef HAVE_WINDOW_SYSTEM | 1265 | #ifdef HAVE_WINDOW_SYSTEM |
| 1265 | Lisp_Object list = Qnil, tail, frame; | 1266 | if (FRAMEP (tip_frame)) |
| 1266 | 1267 | frames = Fdelq (tip_frame, frames); | |
| 1267 | FOR_EACH_FRAME (tail, frame) | ||
| 1268 | if (!FRAME_TOOLTIP_P (XFRAME (frame))) | ||
| 1269 | list = Fcons (frame, list); | ||
| 1270 | return list; | ||
| 1271 | #else /* !HAVE_WINDOW_SYSTEM */ | ||
| 1272 | return Fcopy_sequence (Vframe_list); | ||
| 1273 | #endif | 1268 | #endif |
| 1269 | return frames; | ||
| 1274 | } | 1270 | } |
| 1275 | 1271 | ||
| 1276 | /* Return CANDIDATE if it can be used as 'other-than-FRAME' frame on the | 1272 | /* Return CANDIDATE if it can be used as 'other-than-FRAME' frame on the |
| @@ -1561,7 +1557,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 1561 | } | 1557 | } |
| 1562 | } | 1558 | } |
| 1563 | 1559 | ||
| 1564 | is_tooltip_frame = FRAME_TOOLTIP_P (f); | 1560 | is_tooltip_frame = !NILP (Fframe_parameter (frame, Qtooltip)); |
| 1565 | 1561 | ||
| 1566 | /* Run `delete-frame-functions' unless FORCE is `noelisp' or | 1562 | /* Run `delete-frame-functions' unless FORCE is `noelisp' or |
| 1567 | frame is a tooltip. FORCE is set to `noelisp' when handling | 1563 | frame is a tooltip. FORCE is set to `noelisp' when handling |
| @@ -4904,6 +4900,7 @@ syms_of_frame (void) | |||
| 4904 | DEFSYM (Qgeometry, "geometry"); | 4900 | DEFSYM (Qgeometry, "geometry"); |
| 4905 | DEFSYM (Qicon_left, "icon-left"); | 4901 | DEFSYM (Qicon_left, "icon-left"); |
| 4906 | DEFSYM (Qicon_top, "icon-top"); | 4902 | DEFSYM (Qicon_top, "icon-top"); |
| 4903 | DEFSYM (Qtooltip, "tooltip"); | ||
| 4907 | DEFSYM (Quser_position, "user-position"); | 4904 | DEFSYM (Quser_position, "user-position"); |
| 4908 | DEFSYM (Quser_size, "user-size"); | 4905 | DEFSYM (Quser_size, "user-size"); |
| 4909 | DEFSYM (Qwindow_id, "window-id"); | 4906 | DEFSYM (Qwindow_id, "window-id"); |
| @@ -5025,8 +5022,6 @@ syms_of_frame (void) | |||
| 5025 | DEFSYM (Qvertical_scroll_bars, "vertical-scroll-bars"); | 5022 | DEFSYM (Qvertical_scroll_bars, "vertical-scroll-bars"); |
| 5026 | DEFSYM (Qvisibility, "visibility"); | 5023 | DEFSYM (Qvisibility, "visibility"); |
| 5027 | DEFSYM (Qwait_for_wm, "wait-for-wm"); | 5024 | DEFSYM (Qwait_for_wm, "wait-for-wm"); |
| 5028 | DEFSYM (Qtooltip_timer, "tooltip-timer"); | ||
| 5029 | DEFSYM (Qtooltip_parameters, "tooltip-parameters"); | ||
| 5030 | 5025 | ||
| 5031 | { | 5026 | { |
| 5032 | int i; | 5027 | int i; |
diff --git a/src/frame.h b/src/frame.h index 635a5ed7be4..5e3ee68942a 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -309,9 +309,6 @@ struct frame | |||
| 309 | ENUM_BF (output_method) output_method : 3; | 309 | ENUM_BF (output_method) output_method : 3; |
| 310 | 310 | ||
| 311 | #ifdef HAVE_WINDOW_SYSTEM | 311 | #ifdef HAVE_WINDOW_SYSTEM |
| 312 | /* True if this frame is a tooltip frame. */ | ||
| 313 | bool_bf tooltip : 1; | ||
| 314 | |||
| 315 | /* See FULLSCREEN_ enum on top. */ | 312 | /* See FULLSCREEN_ enum on top. */ |
| 316 | ENUM_BF (fullscreen_type) want_fullscreen : 4; | 313 | ENUM_BF (fullscreen_type) want_fullscreen : 4; |
| 317 | 314 | ||
| @@ -864,9 +861,6 @@ default_pixels_per_inch_y (void) | |||
| 864 | #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \ | 861 | #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \ |
| 865 | ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right) | 862 | ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right) |
| 866 | 863 | ||
| 867 | /* Whether F is a tooltip frame. */ | ||
| 868 | #define FRAME_TOOLTIP_P(f) ((f)->tooltip) | ||
| 869 | |||
| 870 | #else /* not HAVE_WINDOW_SYSTEM */ | 864 | #else /* not HAVE_WINDOW_SYSTEM */ |
| 871 | 865 | ||
| 872 | /* If there is no window system, there are no scroll bars. */ | 866 | /* If there is no window system, there are no scroll bars. */ |
| @@ -875,9 +869,6 @@ default_pixels_per_inch_y (void) | |||
| 875 | #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) ((void) f, 0) | 869 | #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) ((void) f, 0) |
| 876 | #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) ((void) f, 0) | 870 | #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) ((void) f, 0) |
| 877 | 871 | ||
| 878 | /* If there is no window system, there are no tooltips. */ | ||
| 879 | #define FRAME_TOOLTIP_P(f) ((void) f, 0) | ||
| 880 | |||
| 881 | #endif /* HAVE_WINDOW_SYSTEM */ | 872 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 882 | 873 | ||
| 883 | /* Whether horizontal scroll bars are currently enabled for frame F. */ | 874 | /* Whether horizontal scroll bars are currently enabled for frame F. */ |
diff --git a/src/gtkutil.c b/src/gtkutil.c index e08a4b53489..88e6d30bd9a 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -731,23 +731,14 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y) | |||
| 731 | bool | 731 | bool |
| 732 | xg_hide_tooltip (struct frame *f) | 732 | xg_hide_tooltip (struct frame *f) |
| 733 | { | 733 | { |
| 734 | bool ret = 0; | ||
| 734 | #ifdef USE_GTK_TOOLTIP | 735 | #ifdef USE_GTK_TOOLTIP |
| 735 | struct x_output *x = FRAME_X_OUTPUT (f); | 736 | if (f->output_data.x->ttip_window) |
| 736 | |||
| 737 | if (x->ttip_window) | ||
| 738 | { | 737 | { |
| 739 | GtkWindow *win = f->output_data.x->ttip_window; | 738 | GtkWindow *win = f->output_data.x->ttip_window; |
| 740 | |||
| 741 | block_input (); | 739 | block_input (); |
| 742 | gtk_widget_hide (GTK_WIDGET (win)); | 740 | gtk_widget_hide (GTK_WIDGET (win)); |
| 743 | 741 | ||
| 744 | /* Cancel call to xg_hide_tip. */ | ||
| 745 | if (x->ttip_timeout != 0) | ||
| 746 | { | ||
| 747 | g_source_remove (x->ttip_timeout); | ||
| 748 | x->ttip_timeout = 0; | ||
| 749 | } | ||
| 750 | |||
| 751 | if (g_object_get_data (G_OBJECT (win), "restore-tt")) | 742 | if (g_object_get_data (G_OBJECT (win), "restore-tt")) |
| 752 | { | 743 | { |
| 753 | GdkWindow *gwin = gtk_widget_get_window (GTK_WIDGET (win)); | 744 | GdkWindow *gwin = gtk_widget_get_window (GTK_WIDGET (win)); |
| @@ -756,21 +747,11 @@ xg_hide_tooltip (struct frame *f) | |||
| 756 | g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL); | 747 | g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL); |
| 757 | } | 748 | } |
| 758 | unblock_input (); | 749 | unblock_input (); |
| 759 | return 1; | ||
| 760 | } | ||
| 761 | #endif | ||
| 762 | return 0; | ||
| 763 | } | ||
| 764 | 750 | ||
| 765 | /* One-shot timeout handler attached to GTK event loop in Fx_show_tip. */ | 751 | ret = 1; |
| 766 | 752 | } | |
| 767 | gboolean | ||
| 768 | xg_hide_tip (gpointer data) | ||
| 769 | { | ||
| 770 | #ifdef USE_GTK_TOOLTIP | ||
| 771 | xg_hide_tooltip ((struct frame *) data); | ||
| 772 | #endif | 753 | #endif |
| 773 | return FALSE; | 754 | return ret; |
| 774 | } | 755 | } |
| 775 | 756 | ||
| 776 | 757 | ||
diff --git a/src/gtkutil.h b/src/gtkutil.h index d4dc295c512..8840fe76a85 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h | |||
| @@ -178,7 +178,6 @@ extern bool xg_prepare_tooltip (struct frame *f, | |||
| 178 | int *height); | 178 | int *height); |
| 179 | extern void xg_show_tooltip (struct frame *f, int root_x, int root_y); | 179 | extern void xg_show_tooltip (struct frame *f, int root_x, int root_y); |
| 180 | extern bool xg_hide_tooltip (struct frame *f); | 180 | extern bool xg_hide_tooltip (struct frame *f); |
| 181 | extern gboolean xg_hide_tip (gpointer data); | ||
| 182 | 181 | ||
| 183 | #ifdef USE_CAIRO | 182 | #ifdef USE_CAIRO |
| 184 | extern void xg_page_setup_dialog (void); | 183 | extern void xg_page_setup_dialog (void); |
diff --git a/src/menu.c b/src/menu.c index 675caff6b88..90bb19a2e94 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -1400,12 +1400,7 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1400 | #ifdef HAVE_WINDOW_SYSTEM | 1400 | #ifdef HAVE_WINDOW_SYSTEM |
| 1401 | /* Hide a previous tip, if any. */ | 1401 | /* Hide a previous tip, if any. */ |
| 1402 | if (!FRAME_TERMCAP_P (f)) | 1402 | if (!FRAME_TERMCAP_P (f)) |
| 1403 | { | 1403 | Fx_hide_tip (); |
| 1404 | Lisp_Object frame; | ||
| 1405 | |||
| 1406 | XSETFRAME (frame, f); | ||
| 1407 | Fx_hide_tip (frame); | ||
| 1408 | } | ||
| 1409 | #endif | 1404 | #endif |
| 1410 | 1405 | ||
| 1411 | #ifdef HAVE_NTGUI /* FIXME: Is it really w32-specific? --Stef */ | 1406 | #ifdef HAVE_NTGUI /* FIXME: Is it really w32-specific? --Stef */ |
diff --git a/src/nsfns.m b/src/nsfns.m index a017be5c1c5..051e5091919 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -2658,6 +2658,10 @@ If omitted or nil, that stands for the selected frame's display. */) | |||
| 2658 | return make_number (1 << min (dpyinfo->n_planes, 24)); | 2658 | return make_number (1 << min (dpyinfo->n_planes, 24)); |
| 2659 | } | 2659 | } |
| 2660 | 2660 | ||
| 2661 | |||
| 2662 | /* Unused dummy def needed for compatibility. */ | ||
| 2663 | Lisp_Object tip_frame; | ||
| 2664 | |||
| 2661 | /* TODO: move to xdisp or similar */ | 2665 | /* TODO: move to xdisp or similar */ |
| 2662 | static void | 2666 | static void |
| 2663 | compute_tip_xy (struct frame *f, | 2667 | compute_tip_xy (struct frame *f, |
diff --git a/src/w32fns.c b/src/w32fns.c index f5e5b33556c..d6b54d19a19 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -343,6 +343,7 @@ x_window_to_frame (struct w32_display_info *dpyinfo, HWND wdesc) | |||
| 343 | 343 | ||
| 344 | 344 | ||
| 345 | static Lisp_Object unwind_create_frame (Lisp_Object); | 345 | static Lisp_Object unwind_create_frame (Lisp_Object); |
| 346 | static void unwind_create_tip_frame (Lisp_Object); | ||
| 346 | static void my_create_window (struct frame *); | 347 | static void my_create_window (struct frame *); |
| 347 | static void my_create_tip_window (struct frame *); | 348 | static void my_create_tip_window (struct frame *); |
| 348 | 349 | ||
| @@ -5067,7 +5068,6 @@ static void | |||
| 5067 | my_create_tip_window (struct frame *f) | 5068 | my_create_tip_window (struct frame *f) |
| 5068 | { | 5069 | { |
| 5069 | RECT rect; | 5070 | RECT rect; |
| 5070 | Window tip_window; | ||
| 5071 | 5071 | ||
| 5072 | rect.left = rect.top = 0; | 5072 | rect.left = rect.top = 0; |
| 5073 | rect.right = FRAME_PIXEL_WIDTH (f); | 5073 | rect.right = FRAME_PIXEL_WIDTH (f); |
| @@ -5215,8 +5215,9 @@ x_make_gc (struct frame *f) | |||
| 5215 | } | 5215 | } |
| 5216 | 5216 | ||
| 5217 | 5217 | ||
| 5218 | /* Handler for signals raised during x_create_frame. | 5218 | /* Handler for signals raised during x_create_frame and |
| 5219 | FRAME is the frame which is partially constructed. */ | 5219 | x_create_tip_frame. FRAME is the frame which is partially |
| 5220 | constructed. */ | ||
| 5220 | 5221 | ||
| 5221 | static Lisp_Object | 5222 | static Lisp_Object |
| 5222 | unwind_create_frame (Lisp_Object frame) | 5223 | unwind_create_frame (Lisp_Object frame) |
| @@ -5990,7 +5991,7 @@ w32_display_monitor_attributes_list (void) | |||
| 5990 | { | 5991 | { |
| 5991 | struct frame *f = XFRAME (frame); | 5992 | struct frame *f = XFRAME (frame); |
| 5992 | 5993 | ||
| 5993 | if (FRAME_W32_P (f) && !FRAME_TOOLTIP_P (f)) | 5994 | if (FRAME_W32_P (f) && !EQ (frame, tip_frame)) |
| 5994 | { | 5995 | { |
| 5995 | HMONITOR monitor = | 5996 | HMONITOR monitor = |
| 5996 | monitor_from_window_fn (FRAME_W32_WINDOW (f), | 5997 | monitor_from_window_fn (FRAME_W32_WINDOW (f), |
| @@ -6077,7 +6078,7 @@ w32_display_monitor_attributes_list_fallback (struct w32_display_info *dpyinfo) | |||
| 6077 | { | 6078 | { |
| 6078 | struct frame *f = XFRAME (frame); | 6079 | struct frame *f = XFRAME (frame); |
| 6079 | 6080 | ||
| 6080 | if (FRAME_W32_P (f) && FRAME_TOOLTIP_P (f)) | 6081 | if (FRAME_W32_P (f) && !EQ (frame, tip_frame)) |
| 6081 | frames = Fcons (frame, frames); | 6082 | frames = Fcons (frame, frames); |
| 6082 | } | 6083 | } |
| 6083 | attributes = Fcons (Fcons (Qframes, frames), attributes); | 6084 | attributes = Fcons (Fcons (Qframes, frames), attributes); |
| @@ -6480,6 +6481,39 @@ no value of TYPE (always string in the MS Windows case). */) | |||
| 6480 | Tool tips | 6481 | Tool tips |
| 6481 | ***********************************************************************/ | 6482 | ***********************************************************************/ |
| 6482 | 6483 | ||
| 6484 | static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object, | ||
| 6485 | Lisp_Object, int, int, int *, int *); | ||
| 6486 | |||
| 6487 | /* The frame of a currently visible tooltip. */ | ||
| 6488 | |||
| 6489 | Lisp_Object tip_frame; | ||
| 6490 | |||
| 6491 | /* If non-nil, a timer started that hides the last tooltip when it | ||
| 6492 | fires. */ | ||
| 6493 | |||
| 6494 | Lisp_Object tip_timer; | ||
| 6495 | Window tip_window; | ||
| 6496 | |||
| 6497 | /* If non-nil, a vector of 3 elements containing the last args | ||
| 6498 | with which x-show-tip was called. See there. */ | ||
| 6499 | |||
| 6500 | Lisp_Object last_show_tip_args; | ||
| 6501 | |||
| 6502 | |||
| 6503 | static void | ||
| 6504 | unwind_create_tip_frame (Lisp_Object frame) | ||
| 6505 | { | ||
| 6506 | Lisp_Object deleted; | ||
| 6507 | |||
| 6508 | deleted = unwind_create_frame (frame); | ||
| 6509 | if (EQ (deleted, Qt)) | ||
| 6510 | { | ||
| 6511 | tip_window = NULL; | ||
| 6512 | tip_frame = Qnil; | ||
| 6513 | } | ||
| 6514 | } | ||
| 6515 | |||
| 6516 | |||
| 6483 | /* Create a frame for a tooltip on the display described by DPYINFO. | 6517 | /* Create a frame for a tooltip on the display described by DPYINFO. |
| 6484 | PARMS is a list of frame parameters. Value is the frame. | 6518 | PARMS is a list of frame parameters. Value is the frame. |
| 6485 | 6519 | ||
| @@ -6524,7 +6558,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) | |||
| 6524 | f->wants_modeline = false; | 6558 | f->wants_modeline = false; |
| 6525 | XSETFRAME (frame, f); | 6559 | XSETFRAME (frame, f); |
| 6526 | 6560 | ||
| 6527 | record_unwind_protect (do_unwind_create_frame, frame); | 6561 | record_unwind_protect (unwind_create_tip_frame, frame); |
| 6528 | 6562 | ||
| 6529 | /* By setting the output method, we're essentially saying that | 6563 | /* By setting the output method, we're essentially saying that |
| 6530 | the frame is live, as per FRAME_LIVE_P. If we get a signal | 6564 | the frame is live, as per FRAME_LIVE_P. If we get a signal |
| @@ -6536,7 +6570,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) | |||
| 6536 | 6570 | ||
| 6537 | FRAME_FONTSET (f) = -1; | 6571 | FRAME_FONTSET (f) = -1; |
| 6538 | fset_icon_name (f, Qnil); | 6572 | fset_icon_name (f, Qnil); |
| 6539 | f->tooltip = true; | ||
| 6540 | 6573 | ||
| 6541 | #ifdef GLYPH_DEBUG | 6574 | #ifdef GLYPH_DEBUG |
| 6542 | image_cache_refcount = | 6575 | image_cache_refcount = |
| @@ -6645,7 +6678,11 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) | |||
| 6645 | height = FRAME_LINES (f); | 6678 | height = FRAME_LINES (f); |
| 6646 | SET_FRAME_COLS (f, 0); | 6679 | SET_FRAME_COLS (f, 0); |
| 6647 | SET_FRAME_LINES (f, 0); | 6680 | SET_FRAME_LINES (f, 0); |
| 6648 | change_frame_size (f, width, height, true, false, false, false); | 6681 | adjust_frame_size (f, width * FRAME_COLUMN_WIDTH (f), |
| 6682 | height * FRAME_LINE_HEIGHT (f), 0, true, Qtip_frame); | ||
| 6683 | /* Add `tooltip' frame parameter's default value. */ | ||
| 6684 | if (NILP (Fframe_parameter (frame, Qtooltip))) | ||
| 6685 | Fmodify_frame_parameters (frame, Fcons (Fcons (Qtooltip, Qt), Qnil)); | ||
| 6649 | 6686 | ||
| 6650 | /* Set up faces after all frame parameters are known. This call | 6687 | /* Set up faces after all frame parameters are known. This call |
| 6651 | also merges in face attributes specified for new frames. | 6688 | also merges in face attributes specified for new frames. |
| @@ -6673,9 +6710,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) | |||
| 6673 | 6710 | ||
| 6674 | f->no_split = true; | 6711 | f->no_split = true; |
| 6675 | 6712 | ||
| 6676 | /* Now this is an official tooltip frame on this display. */ | ||
| 6677 | dpyinfo->w32_tooltip_frame = f; | ||
| 6678 | |||
| 6679 | /* Now that the frame is official, it counts as a reference to | 6713 | /* Now that the frame is official, it counts as a reference to |
| 6680 | its display. */ | 6714 | its display. */ |
| 6681 | FRAME_DISPLAY_INFO (f)->reference_count++; | 6715 | FRAME_DISPLAY_INFO (f)->reference_count++; |
| @@ -6794,39 +6828,46 @@ compute_tip_xy (struct frame *f, | |||
| 6794 | *root_x = min_x; | 6828 | *root_x = min_x; |
| 6795 | } | 6829 | } |
| 6796 | 6830 | ||
| 6797 | /* Hide tooltip frame F and delete it if DELETE is true. */ | 6831 | /* Hide tooltip. Delete its frame if DELETE is true. */ |
| 6798 | |||
| 6799 | static Lisp_Object | 6832 | static Lisp_Object |
| 6800 | x_hide_tip (struct frame *f, bool delete) | 6833 | x_hide_tip (bool delete) |
| 6801 | { | 6834 | { |
| 6802 | if (f) | 6835 | if (!NILP (tip_timer)) |
| 6803 | { | 6836 | { |
| 6804 | Lisp_Object frame, timer; | 6837 | call1 (Qcancel_timer, tip_timer); |
| 6838 | tip_timer = Qnil; | ||
| 6839 | } | ||
| 6805 | 6840 | ||
| 6806 | XSETFRAME (frame, f); | 6841 | if (NILP (tip_frame) |
| 6807 | timer = Fframe_parameter (frame, Qtooltip_timer); | 6842 | || (!delete && FRAMEP (tip_frame) |
| 6843 | && !FRAME_VISIBLE_P (XFRAME (tip_frame)))) | ||
| 6844 | return Qnil; | ||
| 6845 | else | ||
| 6846 | { | ||
| 6847 | ptrdiff_t count; | ||
| 6848 | Lisp_Object was_open = Qnil; | ||
| 6808 | 6849 | ||
| 6809 | if (!NILP (timer)) | 6850 | count = SPECPDL_INDEX (); |
| 6810 | call1 (Qcancel_timer, timer); | 6851 | specbind (Qinhibit_redisplay, Qt); |
| 6852 | specbind (Qinhibit_quit, Qt); | ||
| 6811 | 6853 | ||
| 6812 | if (!delete && !FRAME_VISIBLE_P (f)) | 6854 | if (FRAMEP (tip_frame)) |
| 6813 | return Qnil; | ||
| 6814 | else | ||
| 6815 | { | 6855 | { |
| 6816 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 6817 | |||
| 6818 | specbind (Qinhibit_redisplay, Qt); | ||
| 6819 | specbind (Qinhibit_quit, Qt); | ||
| 6820 | |||
| 6821 | if (delete) | 6856 | if (delete) |
| 6822 | delete_frame (frame, Qnil); | 6857 | { |
| 6858 | delete_frame (tip_frame, Qnil); | ||
| 6859 | tip_frame = Qnil; | ||
| 6860 | } | ||
| 6823 | else | 6861 | else |
| 6824 | x_make_frame_invisible (f); | 6862 | x_make_frame_invisible (XFRAME (tip_frame)); |
| 6825 | 6863 | ||
| 6826 | return unbind_to (count, Qt); | 6864 | was_open = Qt; |
| 6827 | } | 6865 | } |
| 6866 | else | ||
| 6867 | tip_frame = Qnil; | ||
| 6868 | |||
| 6869 | return unbind_to (count, was_open); | ||
| 6828 | } | 6870 | } |
| 6829 | return Qnil; | ||
| 6830 | } | 6871 | } |
| 6831 | 6872 | ||
| 6832 | 6873 | ||
| @@ -6860,8 +6901,7 @@ with offset DY added (default is -10). | |||
| 6860 | 6901 | ||
| 6861 | A tooltip's maximum size is specified by `x-max-tooltip-size'. | 6902 | A tooltip's maximum size is specified by `x-max-tooltip-size'. |
| 6862 | Text larger than the specified size is clipped. */) | 6903 | Text larger than the specified size is clipped. */) |
| 6863 | (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, | 6904 | (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy) |
| 6864 | Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy) | ||
| 6865 | { | 6905 | { |
| 6866 | struct frame *tip_f; | 6906 | struct frame *tip_f; |
| 6867 | struct window *w; | 6907 | struct window *w; |
| @@ -6872,7 +6912,7 @@ Text larger than the specified size is clipped. */) | |||
| 6872 | int old_windows_or_buffers_changed = windows_or_buffers_changed; | 6912 | int old_windows_or_buffers_changed = windows_or_buffers_changed; |
| 6873 | ptrdiff_t count = SPECPDL_INDEX (); | 6913 | ptrdiff_t count = SPECPDL_INDEX (); |
| 6874 | ptrdiff_t count_1; | 6914 | ptrdiff_t count_1; |
| 6875 | Lisp_Object window, size, tip_frame, parameters; | 6915 | Lisp_Object window, size; |
| 6876 | AUTO_STRING (tip, " *tip*"); | 6916 | AUTO_STRING (tip, " *tip*"); |
| 6877 | 6917 | ||
| 6878 | specbind (Qinhibit_redisplay, Qt); | 6918 | specbind (Qinhibit_redisplay, Qt); |
| @@ -6894,22 +6934,14 @@ Text larger than the specified size is clipped. */) | |||
| 6894 | else | 6934 | else |
| 6895 | CHECK_NUMBER (dy); | 6935 | CHECK_NUMBER (dy); |
| 6896 | 6936 | ||
| 6897 | parameters = Fframe_parameter (frame, Qtooltip_parameters); | 6937 | if (NILP (last_show_tip_args)) |
| 6898 | if (NILP (parameters)) | 6938 | last_show_tip_args = Fmake_vector (make_number (3), Qnil); |
| 6899 | parameters = Fmake_vector (make_number (3), Qnil); | ||
| 6900 | 6939 | ||
| 6901 | /* Look at current tooltip frame, if any. */ | 6940 | if (FRAMEP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame))) |
| 6902 | tip_f = FRAME_DISPLAY_INFO (XFRAME (frame))->w32_tooltip_frame; | ||
| 6903 | if (tip_f) | ||
| 6904 | XSETFRAME (tip_frame, tip_f); | ||
| 6905 | else | ||
| 6906 | tip_frame = Qnil; | ||
| 6907 | |||
| 6908 | if (tip_f && FRAME_LIVE_P (tip_f)) | ||
| 6909 | { | 6941 | { |
| 6910 | Lisp_Object last_string = AREF (parameters, 0); | 6942 | Lisp_Object last_string = AREF (last_show_tip_args, 0); |
| 6911 | Lisp_Object last_frame = AREF (parameters, 1); | 6943 | Lisp_Object last_frame = AREF (last_show_tip_args, 1); |
| 6912 | Lisp_Object last_parms = AREF (parameters, 2); | 6944 | Lisp_Object last_parms = AREF (last_show_tip_args, 2); |
| 6913 | 6945 | ||
| 6914 | if (FRAME_VISIBLE_P (XFRAME (tip_frame)) | 6946 | if (FRAME_VISIBLE_P (XFRAME (tip_frame)) |
| 6915 | && EQ (frame, last_frame) | 6947 | && EQ (frame, last_frame) |
| @@ -6917,10 +6949,14 @@ Text larger than the specified size is clipped. */) | |||
| 6917 | && !NILP (Fequal (last_parms, parms))) | 6949 | && !NILP (Fequal (last_parms, parms))) |
| 6918 | { | 6950 | { |
| 6919 | /* Only DX and DY have changed. */ | 6951 | /* Only DX and DY have changed. */ |
| 6920 | Lisp_Object timer = Fframe_parameter (tip_frame, Qtooltip_timer); | 6952 | tip_f = XFRAME (tip_frame); |
| 6953 | if (!NILP (tip_timer)) | ||
| 6954 | { | ||
| 6955 | Lisp_Object timer = tip_timer; | ||
| 6921 | 6956 | ||
| 6922 | if (!NILP (timer)) | 6957 | tip_timer = Qnil; |
| 6923 | call1 (Qcancel_timer, timer); | 6958 | call1 (Qcancel_timer, timer); |
| 6959 | } | ||
| 6924 | 6960 | ||
| 6925 | block_input (); | 6961 | block_input (); |
| 6926 | compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), | 6962 | compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), |
| @@ -6990,22 +7026,17 @@ Text larger than the specified size is clipped. */) | |||
| 6990 | } | 7026 | } |
| 6991 | } | 7027 | } |
| 6992 | 7028 | ||
| 6993 | x_hide_tip (tip_f, delete); | 7029 | x_hide_tip (delete); |
| 6994 | } | 7030 | } |
| 6995 | else | 7031 | else |
| 6996 | x_hide_tip (tip_f, true); | 7032 | x_hide_tip (true); |
| 6997 | } | 7033 | } |
| 6998 | else | 7034 | else |
| 6999 | x_hide_tip (tip_f, true); | 7035 | x_hide_tip (true); |
| 7000 | 7036 | ||
| 7001 | /* Update tooltip parameters. */ | 7037 | ASET (last_show_tip_args, 0, string); |
| 7002 | { | 7038 | ASET (last_show_tip_args, 1, frame); |
| 7003 | AUTO_FRAME_ARG (arg, Qtooltip_parameters, parameters); | 7039 | ASET (last_show_tip_args, 2, parms); |
| 7004 | ASET (parameters, 0, string); | ||
| 7005 | ASET (parameters, 1, frame); | ||
| 7006 | ASET (parameters, 2, parms); | ||
| 7007 | Fmodify_frame_parameters (frame, arg); | ||
| 7008 | } | ||
| 7009 | 7040 | ||
| 7010 | /* Block input until the tip has been fully drawn, to avoid crashes | 7041 | /* Block input until the tip has been fully drawn, to avoid crashes |
| 7011 | when drawing tips in menus. */ | 7042 | when drawing tips in menus. */ |
| @@ -7025,8 +7056,11 @@ Text larger than the specified size is clipped. */) | |||
| 7025 | if (NILP (Fassq (Qbackground_color, parms))) | 7056 | if (NILP (Fassq (Qbackground_color, parms))) |
| 7026 | parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")), | 7057 | parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")), |
| 7027 | parms); | 7058 | parms); |
| 7028 | if (NILP (tip_frame | 7059 | |
| 7029 | = x_create_tip_frame (FRAME_DISPLAY_INFO (XFRAME (frame)), parms))) | 7060 | /* Create a frame for the tooltip, and record it in the global |
| 7061 | variable tip_frame. */ | ||
| 7062 | struct frame *f; /* The value is unused. */ | ||
| 7063 | if (NILP (tip_frame = x_create_tip_frame (FRAME_DISPLAY_INFO (f), parms))) | ||
| 7030 | { | 7064 | { |
| 7031 | /* Creating the tip frame failed. */ | 7065 | /* Creating the tip frame failed. */ |
| 7032 | unblock_input (); | 7066 | unblock_input (); |
| @@ -7130,47 +7164,20 @@ Text larger than the specified size is clipped. */) | |||
| 7130 | windows_or_buffers_changed = old_windows_or_buffers_changed; | 7164 | windows_or_buffers_changed = old_windows_or_buffers_changed; |
| 7131 | 7165 | ||
| 7132 | start_timer: | 7166 | start_timer: |
| 7133 | { | 7167 | /* Let the tip disappear after timeout seconds. */ |
| 7134 | /* Let the tip disappear after timeout seconds. */ | 7168 | tip_timer = call3 (intern ("run-at-time"), timeout, Qnil, |
| 7135 | AUTO_FRAME_ARG (arg, Qtooltip_timer, | 7169 | intern ("x-hide-tip")); |
| 7136 | call3 (intern ("run-at-time"), timeout, | 7170 | |
| 7137 | Qnil, intern ("x-hide-tip"))); | ||
| 7138 | Fmodify_frame_parameters (tip_frame, arg); | ||
| 7139 | } | ||
| 7140 | return unbind_to (count, Qnil); | 7171 | return unbind_to (count, Qnil); |
| 7141 | } | 7172 | } |
| 7142 | 7173 | ||
| 7143 | 7174 | ||
| 7144 | DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 1, 0, | 7175 | DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, |
| 7145 | doc: /* Hide the current tooltip window, if there is any. | 7176 | doc: /* Hide the current tooltip window, if there is any. |
| 7146 | Optional FRAME is the frame to hide tooltip on. | ||
| 7147 | Value is t if tooltip was open, nil otherwise. */) | 7177 | Value is t if tooltip was open, nil otherwise. */) |
| 7148 | (Lisp_Object frame) | 7178 | (void) |
| 7149 | { | 7179 | { |
| 7150 | Lisp_Object obj = Qnil; | 7180 | return x_hide_tip (!tooltip_reuse_hidden_frame); |
| 7151 | |||
| 7152 | if (NILP (frame)) | ||
| 7153 | { | ||
| 7154 | struct w32_display_info *dpyinfo; | ||
| 7155 | |||
| 7156 | for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next) | ||
| 7157 | if (dpyinfo->w32_tooltip_frame) | ||
| 7158 | if (!NILP (x_hide_tip (dpyinfo->w32_tooltip_frame, | ||
| 7159 | !tooltip_reuse_hidden_frame))) | ||
| 7160 | obj = Qt; | ||
| 7161 | } | ||
| 7162 | else | ||
| 7163 | { | ||
| 7164 | struct frame *f; | ||
| 7165 | |||
| 7166 | CHECK_FRAME (frame); | ||
| 7167 | f = XFRAME (frame); | ||
| 7168 | if (FRAME_DISPLAY_INFO (f) | ||
| 7169 | && FRAME_DISPLAY_INFO (f)->w32_tooltip_frame) | ||
| 7170 | obj = x_hide_tip (FRAME_DISPLAY_INFO (f)->w32_tooltip_frame, | ||
| 7171 | !tooltip_reuse_hidden_frame); | ||
| 7172 | } | ||
| 7173 | return obj; | ||
| 7174 | } | 7181 | } |
| 7175 | 7182 | ||
| 7176 | /*********************************************************************** | 7183 | /*********************************************************************** |
| @@ -9773,6 +9780,7 @@ syms_of_w32fns (void) | |||
| 9773 | DEFSYM (Qworkarea, "workarea"); | 9780 | DEFSYM (Qworkarea, "workarea"); |
| 9774 | DEFSYM (Qmm_size, "mm-size"); | 9781 | DEFSYM (Qmm_size, "mm-size"); |
| 9775 | DEFSYM (Qframes, "frames"); | 9782 | DEFSYM (Qframes, "frames"); |
| 9783 | DEFSYM (Qtip_frame, "tip-frame"); | ||
| 9776 | DEFSYM (Qassq_delete_all, "assq-delete-all"); | 9784 | DEFSYM (Qassq_delete_all, "assq-delete-all"); |
| 9777 | DEFSYM (Qunicode_sip, "unicode-sip"); | 9785 | DEFSYM (Qunicode_sip, "unicode-sip"); |
| 9778 | #if defined WINDOWSNT && !defined HAVE_DBUS | 9786 | #if defined WINDOWSNT && !defined HAVE_DBUS |
| @@ -10158,6 +10166,13 @@ tip frame. */); | |||
| 10158 | defsubr (&Sset_message_beep); | 10166 | defsubr (&Sset_message_beep); |
| 10159 | defsubr (&Sx_show_tip); | 10167 | defsubr (&Sx_show_tip); |
| 10160 | defsubr (&Sx_hide_tip); | 10168 | defsubr (&Sx_hide_tip); |
| 10169 | tip_timer = Qnil; | ||
| 10170 | staticpro (&tip_timer); | ||
| 10171 | tip_frame = Qnil; | ||
| 10172 | staticpro (&tip_frame); | ||
| 10173 | |||
| 10174 | last_show_tip_args = Qnil; | ||
| 10175 | staticpro (&last_show_tip_args); | ||
| 10161 | 10176 | ||
| 10162 | defsubr (&Sx_file_dialog); | 10177 | defsubr (&Sx_file_dialog); |
| 10163 | #ifdef WINDOWSNT | 10178 | #ifdef WINDOWSNT |
diff --git a/src/w32term.c b/src/w32term.c index 8c2fdaf0f59..5a11e2a871a 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -5024,10 +5024,11 @@ w32_read_socket (struct terminal *terminal, | |||
| 5024 | /* wParam non-zero means Window is about to be shown, 0 means | 5024 | /* wParam non-zero means Window is about to be shown, 0 means |
| 5025 | about to be hidden. */ | 5025 | about to be hidden. */ |
| 5026 | /* Redo the mouse-highlight after the tooltip has gone. */ | 5026 | /* Redo the mouse-highlight after the tooltip has gone. */ |
| 5027 | if (!msg.msg.wParam | 5027 | if (!msg.msg.wParam && msg.msg.hwnd == tip_window) |
| 5028 | && dpyinfo->w32_tooltip_frame | 5028 | { |
| 5029 | && FRAME_W32_WINDOW (dpyinfo->w32_tooltip_frame) == msg.msg.hwnd) | 5029 | tip_window = NULL; |
| 5030 | x_redo_mouse_highlight (dpyinfo); | 5030 | x_redo_mouse_highlight (dpyinfo); |
| 5031 | } | ||
| 5031 | 5032 | ||
| 5032 | /* If window has been obscured or exposed by another window | 5033 | /* If window has been obscured or exposed by another window |
| 5033 | being maximized or minimized/restored, then recheck | 5034 | being maximized or minimized/restored, then recheck |
| @@ -5393,7 +5394,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 5393 | struct frame *f = XFRAME (frame); | 5394 | struct frame *f = XFRAME (frame); |
| 5394 | /* The tooltip has been drawn already. Avoid the | 5395 | /* The tooltip has been drawn already. Avoid the |
| 5395 | SET_FRAME_GARBAGED below. */ | 5396 | SET_FRAME_GARBAGED below. */ |
| 5396 | if (FRAME_TOOLTIP_P (f)) | 5397 | if (EQ (frame, tip_frame)) |
| 5397 | continue; | 5398 | continue; |
| 5398 | 5399 | ||
| 5399 | /* Check "visible" frames and mark each as obscured or not. | 5400 | /* Check "visible" frames and mark each as obscured or not. |
| @@ -5870,7 +5871,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) | |||
| 5870 | /* Don't change the size of a tip frame; there's no point in | 5871 | /* Don't change the size of a tip frame; there's no point in |
| 5871 | doing it because it's done in Fx_show_tip, and it leads to | 5872 | doing it because it's done in Fx_show_tip, and it leads to |
| 5872 | problems because the tip frame has no widget. */ | 5873 | problems because the tip frame has no widget. */ |
| 5873 | if (!FRAME_TOOLTIP_P (f)) | 5874 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) |
| 5874 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), | 5875 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), |
| 5875 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, | 5876 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, |
| 5876 | false, Qfont); | 5877 | false, Qfont); |
| @@ -6568,8 +6569,6 @@ x_free_frame_resources (struct frame *f) | |||
| 6568 | dpyinfo->w32_focus_event_frame = 0; | 6569 | dpyinfo->w32_focus_event_frame = 0; |
| 6569 | if (f == dpyinfo->x_highlight_frame) | 6570 | if (f == dpyinfo->x_highlight_frame) |
| 6570 | dpyinfo->x_highlight_frame = 0; | 6571 | dpyinfo->x_highlight_frame = 0; |
| 6571 | if (f == dpyinfo->w32_tooltip_frame) | ||
| 6572 | dpyinfo->w32_tooltip_frame = 0; | ||
| 6573 | if (f == hlinfo->mouse_face_mouse_frame) | 6572 | if (f == hlinfo->mouse_face_mouse_frame) |
| 6574 | reset_mouse_highlight (hlinfo); | 6573 | reset_mouse_highlight (hlinfo); |
| 6575 | 6574 | ||
diff --git a/src/w32term.h b/src/w32term.h index 3934e8500a3..320477073a5 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -186,9 +186,6 @@ struct w32_display_info | |||
| 186 | /* The frame waiting to be auto-raised in w32_read_socket. */ | 186 | /* The frame waiting to be auto-raised in w32_read_socket. */ |
| 187 | struct frame *w32_pending_autoraise_frame; | 187 | struct frame *w32_pending_autoraise_frame; |
| 188 | 188 | ||
| 189 | /* Tooltip frame on this display. */ | ||
| 190 | struct frame *w32_tooltip_frame; | ||
| 191 | |||
| 192 | /* The frame where the mouse was last time we reported a mouse event. */ | 189 | /* The frame where the mouse was last time we reported a mouse event. */ |
| 193 | struct frame *last_mouse_frame; | 190 | struct frame *last_mouse_frame; |
| 194 | 191 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index b8dcdcec41f..14d6f8fcf93 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2841,7 +2841,11 @@ init_iterator (struct it *it, struct window *w, | |||
| 2841 | frames when the fringes are turned off. But leave the dimensions | 2841 | frames when the fringes are turned off. But leave the dimensions |
| 2842 | zero for tooltip frames, as these glyphs look ugly there and also | 2842 | zero for tooltip frames, as these glyphs look ugly there and also |
| 2843 | sabotage calculations of tooltip dimensions in x-show-tip. */ | 2843 | sabotage calculations of tooltip dimensions in x-show-tip. */ |
| 2844 | if (!FRAME_TOOLTIP_P (it->f)) | 2844 | #ifdef HAVE_WINDOW_SYSTEM |
| 2845 | if (!(FRAME_WINDOW_P (it->f) | ||
| 2846 | && FRAMEP (tip_frame) | ||
| 2847 | && it->f == XFRAME (tip_frame))) | ||
| 2848 | #endif | ||
| 2845 | { | 2849 | { |
| 2846 | if (it->line_wrap == TRUNCATE) | 2850 | if (it->line_wrap == TRUNCATE) |
| 2847 | { | 2851 | { |
| @@ -11709,7 +11713,7 @@ x_consider_frame_title (Lisp_Object frame) | |||
| 11709 | if ((FRAME_WINDOW_P (f) | 11713 | if ((FRAME_WINDOW_P (f) |
| 11710 | || FRAME_MINIBUF_ONLY_P (f) | 11714 | || FRAME_MINIBUF_ONLY_P (f) |
| 11711 | || f->explicit_name) | 11715 | || f->explicit_name) |
| 11712 | && !FRAME_TOOLTIP_P (f)) | 11716 | && NILP (Fframe_parameter (frame, Qtooltip))) |
| 11713 | { | 11717 | { |
| 11714 | /* Do we have more than one visible frame on this X display? */ | 11718 | /* Do we have more than one visible frame on this X display? */ |
| 11715 | Lisp_Object tail, other_frame, fmt; | 11719 | Lisp_Object tail, other_frame, fmt; |
| @@ -11726,7 +11730,7 @@ x_consider_frame_title (Lisp_Object frame) | |||
| 11726 | if (tf != f | 11730 | if (tf != f |
| 11727 | && FRAME_KBOARD (tf) == FRAME_KBOARD (f) | 11731 | && FRAME_KBOARD (tf) == FRAME_KBOARD (f) |
| 11728 | && !FRAME_MINIBUF_ONLY_P (tf) | 11732 | && !FRAME_MINIBUF_ONLY_P (tf) |
| 11729 | && !FRAME_TOOLTIP_P (tf) | 11733 | && !EQ (other_frame, tip_frame) |
| 11730 | && (FRAME_VISIBLE_P (tf) || FRAME_ICONIFIED_P (tf))) | 11734 | && (FRAME_VISIBLE_P (tf) || FRAME_ICONIFIED_P (tf))) |
| 11731 | break; | 11735 | break; |
| 11732 | } | 11736 | } |
| @@ -11789,6 +11793,13 @@ prepare_menu_bars (void) | |||
| 11789 | { | 11793 | { |
| 11790 | bool all_windows = windows_or_buffers_changed || update_mode_lines; | 11794 | bool all_windows = windows_or_buffers_changed || update_mode_lines; |
| 11791 | bool some_windows = REDISPLAY_SOME_P (); | 11795 | bool some_windows = REDISPLAY_SOME_P (); |
| 11796 | Lisp_Object tooltip_frame; | ||
| 11797 | |||
| 11798 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 11799 | tooltip_frame = tip_frame; | ||
| 11800 | #else | ||
| 11801 | tooltip_frame = Qnil; | ||
| 11802 | #endif | ||
| 11792 | 11803 | ||
| 11793 | if (FUNCTIONP (Vpre_redisplay_function)) | 11804 | if (FUNCTIONP (Vpre_redisplay_function)) |
| 11794 | { | 11805 | { |
| @@ -11829,7 +11840,7 @@ prepare_menu_bars (void) | |||
| 11829 | && !XBUFFER (w->contents)->text->redisplay) | 11840 | && !XBUFFER (w->contents)->text->redisplay) |
| 11830 | continue; | 11841 | continue; |
| 11831 | 11842 | ||
| 11832 | if (!FRAME_TOOLTIP_P (f) | 11843 | if (!EQ (frame, tooltip_frame) |
| 11833 | && (FRAME_ICONIFIED_P (f) | 11844 | && (FRAME_ICONIFIED_P (f) |
| 11834 | || FRAME_VISIBLE_P (f) == 1 | 11845 | || FRAME_VISIBLE_P (f) == 1 |
| 11835 | /* Exclude TTY frames that are obscured because they | 11846 | /* Exclude TTY frames that are obscured because they |
| @@ -11866,7 +11877,7 @@ prepare_menu_bars (void) | |||
| 11866 | struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); | 11877 | struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); |
| 11867 | 11878 | ||
| 11868 | /* Ignore tooltip frame. */ | 11879 | /* Ignore tooltip frame. */ |
| 11869 | if (FRAME_TOOLTIP_P (f)) | 11880 | if (EQ (frame, tooltip_frame)) |
| 11870 | continue; | 11881 | continue; |
| 11871 | 11882 | ||
| 11872 | if (some_windows | 11883 | if (some_windows |
diff --git a/src/xfns.c b/src/xfns.c index 16dbcfd5f84..798dc49bef5 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -4151,7 +4151,7 @@ x_make_monitor_attribute_list (struct MonitorInfo *monitors, | |||
| 4151 | struct frame *f = XFRAME (frame); | 4151 | struct frame *f = XFRAME (frame); |
| 4152 | 4152 | ||
| 4153 | if (FRAME_X_P (f) && FRAME_DISPLAY_INFO (f) == dpyinfo | 4153 | if (FRAME_X_P (f) && FRAME_DISPLAY_INFO (f) == dpyinfo |
| 4154 | && !FRAME_TOOLTIP_P (f)) | 4154 | && !EQ (frame, tip_frame)) |
| 4155 | { | 4155 | { |
| 4156 | int i = x_get_monitor_for_frame (f, monitors, n_monitors); | 4156 | int i = x_get_monitor_for_frame (f, monitors, n_monitors); |
| 4157 | ASET (monitor_frames, i, Fcons (frame, AREF (monitor_frames, i))); | 4157 | ASET (monitor_frames, i, Fcons (frame, AREF (monitor_frames, i))); |
| @@ -4447,7 +4447,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 4447 | struct frame *f = XFRAME (frame); | 4447 | struct frame *f = XFRAME (frame); |
| 4448 | 4448 | ||
| 4449 | if (FRAME_X_P (f) && FRAME_DISPLAY_INFO (f) == dpyinfo | 4449 | if (FRAME_X_P (f) && FRAME_DISPLAY_INFO (f) == dpyinfo |
| 4450 | && !FRAME_TOOLTIP_P (f)) | 4450 | && !EQ (frame, tip_frame)) |
| 4451 | { | 4451 | { |
| 4452 | GdkWindow *gwin = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); | 4452 | GdkWindow *gwin = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); |
| 4453 | 4453 | ||
| @@ -5312,6 +5312,39 @@ no value of TYPE (always string in the MS Windows case). */) | |||
| 5312 | Tool tips | 5312 | Tool tips |
| 5313 | ***********************************************************************/ | 5313 | ***********************************************************************/ |
| 5314 | 5314 | ||
| 5315 | static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object, | ||
| 5316 | Lisp_Object, int, int, int *, int *); | ||
| 5317 | |||
| 5318 | /* The frame of a currently visible tooltip. */ | ||
| 5319 | |||
| 5320 | Lisp_Object tip_frame; | ||
| 5321 | |||
| 5322 | /* If non-nil, a timer started that hides the last tooltip when it | ||
| 5323 | fires. */ | ||
| 5324 | |||
| 5325 | static Lisp_Object tip_timer; | ||
| 5326 | Window tip_window; | ||
| 5327 | |||
| 5328 | /* If non-nil, a vector of 3 elements containing the last args | ||
| 5329 | with which x-show-tip was called. See there. */ | ||
| 5330 | |||
| 5331 | static Lisp_Object last_show_tip_args; | ||
| 5332 | |||
| 5333 | |||
| 5334 | static void | ||
| 5335 | unwind_create_tip_frame (Lisp_Object frame) | ||
| 5336 | { | ||
| 5337 | Lisp_Object deleted; | ||
| 5338 | |||
| 5339 | deleted = unwind_create_frame (frame); | ||
| 5340 | if (EQ (deleted, Qt)) | ||
| 5341 | { | ||
| 5342 | tip_window = None; | ||
| 5343 | tip_frame = Qnil; | ||
| 5344 | } | ||
| 5345 | } | ||
| 5346 | |||
| 5347 | |||
| 5315 | /* Create a frame for a tooltip on the display described by DPYINFO. | 5348 | /* Create a frame for a tooltip on the display described by DPYINFO. |
| 5316 | PARMS is a list of frame parameters. TEXT is the string to | 5349 | PARMS is a list of frame parameters. TEXT is the string to |
| 5317 | display in the tip frame. Value is the frame. | 5350 | display in the tip frame. Value is the frame. |
| @@ -5348,7 +5381,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) | |||
| 5348 | f = make_frame (false); | 5381 | f = make_frame (false); |
| 5349 | f->wants_modeline = false; | 5382 | f->wants_modeline = false; |
| 5350 | XSETFRAME (frame, f); | 5383 | XSETFRAME (frame, f); |
| 5351 | record_unwind_protect (do_unwind_create_frame, frame); | 5384 | record_unwind_protect (unwind_create_tip_frame, frame); |
| 5352 | 5385 | ||
| 5353 | f->terminal = dpyinfo->terminal; | 5386 | f->terminal = dpyinfo->terminal; |
| 5354 | 5387 | ||
| @@ -5369,7 +5402,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) | |||
| 5369 | f->output_data.x->white_relief.pixel = -1; | 5402 | f->output_data.x->white_relief.pixel = -1; |
| 5370 | f->output_data.x->black_relief.pixel = -1; | 5403 | f->output_data.x->black_relief.pixel = -1; |
| 5371 | 5404 | ||
| 5372 | f->tooltip = true; | ||
| 5373 | fset_icon_name (f, Qnil); | 5405 | fset_icon_name (f, Qnil); |
| 5374 | FRAME_DISPLAY_INFO (f) = dpyinfo; | 5406 | FRAME_DISPLAY_INFO (f) = dpyinfo; |
| 5375 | f->output_data.x->parent_desc = FRAME_DISPLAY_INFO (f)->root_window; | 5407 | f->output_data.x->parent_desc = FRAME_DISPLAY_INFO (f)->root_window; |
| @@ -5513,7 +5545,8 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) | |||
| 5513 | = f->output_data.x->text_cursor; | 5545 | = f->output_data.x->text_cursor; |
| 5514 | /* Arrange for getting MapNotify and UnmapNotify events. */ | 5546 | /* Arrange for getting MapNotify and UnmapNotify events. */ |
| 5515 | attrs.event_mask = StructureNotifyMask; | 5547 | attrs.event_mask = StructureNotifyMask; |
| 5516 | FRAME_X_WINDOW (f) | 5548 | tip_window |
| 5549 | = FRAME_X_WINDOW (f) | ||
| 5517 | = XCreateWindow (FRAME_X_DISPLAY (f), | 5550 | = XCreateWindow (FRAME_X_DISPLAY (f), |
| 5518 | FRAME_DISPLAY_INFO (f)->root_window, | 5551 | FRAME_DISPLAY_INFO (f)->root_window, |
| 5519 | /* x, y, width, height */ | 5552 | /* x, y, width, height */ |
| @@ -5522,7 +5555,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) | |||
| 5522 | f->border_width, | 5555 | f->border_width, |
| 5523 | CopyFromParent, InputOutput, CopyFromParent, | 5556 | CopyFromParent, InputOutput, CopyFromParent, |
| 5524 | mask, &attrs); | 5557 | mask, &attrs); |
| 5525 | XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 5558 | XChangeProperty (FRAME_X_DISPLAY (f), tip_window, |
| 5526 | FRAME_DISPLAY_INFO (f)->Xatom_net_window_type, | 5559 | FRAME_DISPLAY_INFO (f)->Xatom_net_window_type, |
| 5527 | XA_ATOM, 32, PropModeReplace, | 5560 | XA_ATOM, 32, PropModeReplace, |
| 5528 | (unsigned char *)&type, 1); | 5561 | (unsigned char *)&type, 1); |
| @@ -5549,6 +5582,13 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) | |||
| 5549 | SET_FRAME_LINES (f, 0); | 5582 | SET_FRAME_LINES (f, 0); |
| 5550 | change_frame_size (f, width, height, true, false, false, false); | 5583 | change_frame_size (f, width, height, true, false, false, false); |
| 5551 | 5584 | ||
| 5585 | /* Add `tooltip' frame parameter's default value. */ | ||
| 5586 | if (NILP (Fframe_parameter (frame, Qtooltip))) | ||
| 5587 | { | ||
| 5588 | AUTO_FRAME_ARG (arg, Qtooltip, Qt); | ||
| 5589 | Fmodify_frame_parameters (frame, arg); | ||
| 5590 | } | ||
| 5591 | |||
| 5552 | /* FIXME - can this be done in a similar way to normal frames? | 5592 | /* FIXME - can this be done in a similar way to normal frames? |
| 5553 | http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00641.html */ | 5593 | http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00641.html */ |
| 5554 | 5594 | ||
| @@ -5593,9 +5633,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) | |||
| 5593 | 5633 | ||
| 5594 | f->no_split = true; | 5634 | f->no_split = true; |
| 5595 | 5635 | ||
| 5596 | /* Now this is an official tooltip frame on this display. */ | ||
| 5597 | dpyinfo->x_tooltip_frame = f; | ||
| 5598 | |||
| 5599 | /* Now that the frame will be official, it counts as a reference to | 5636 | /* Now that the frame will be official, it counts as a reference to |
| 5600 | its display and terminal. */ | 5637 | its display and terminal. */ |
| 5601 | FRAME_DISPLAY_INFO (f)->reference_count++; | 5638 | FRAME_DISPLAY_INFO (f)->reference_count++; |
| @@ -5626,9 +5663,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) | |||
| 5626 | the display in *ROOT_X, and *ROOT_Y. */ | 5663 | the display in *ROOT_X, and *ROOT_Y. */ |
| 5627 | 5664 | ||
| 5628 | static void | 5665 | static void |
| 5629 | compute_tip_xy (struct frame *f, | 5666 | compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, int width, int height, int *root_x, int *root_y) |
| 5630 | Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, | ||
| 5631 | int width, int height, int *root_x, int *root_y) | ||
| 5632 | { | 5667 | { |
| 5633 | Lisp_Object left, top, right, bottom; | 5668 | Lisp_Object left, top, right, bottom; |
| 5634 | int win_x, win_y; | 5669 | int win_x, win_y; |
| @@ -5724,39 +5759,56 @@ compute_tip_xy (struct frame *f, | |||
| 5724 | *root_x = min_x; | 5759 | *root_x = min_x; |
| 5725 | } | 5760 | } |
| 5726 | 5761 | ||
| 5727 | /* Hide tooltip frame F and delete it if DELETE is true. */ | ||
| 5728 | 5762 | ||
| 5763 | /* Hide tooltip. Delete its frame if DELETE is true. */ | ||
| 5729 | static Lisp_Object | 5764 | static Lisp_Object |
| 5730 | x_hide_tip (struct frame *f, bool delete) | 5765 | x_hide_tip (bool delete) |
| 5731 | { | 5766 | { |
| 5732 | if (f) | 5767 | if (!NILP (tip_timer)) |
| 5733 | { | 5768 | { |
| 5734 | Lisp_Object frame, timer; | 5769 | call1 (Qcancel_timer, tip_timer); |
| 5735 | 5770 | tip_timer = Qnil; | |
| 5736 | XSETFRAME (frame, f); | 5771 | } |
| 5737 | timer = Fframe_parameter (frame, Qtooltip_timer); | ||
| 5738 | 5772 | ||
| 5739 | if (!NILP (timer)) | ||
| 5740 | call1 (Qcancel_timer, timer); | ||
| 5741 | 5773 | ||
| 5742 | if (!delete && !FRAME_VISIBLE_P (f)) | 5774 | if (NILP (tip_frame) |
| 5743 | return Qnil; | 5775 | || (!delete && FRAMEP (tip_frame) |
| 5744 | else | 5776 | && !FRAME_VISIBLE_P (XFRAME (tip_frame)))) |
| 5745 | { | 5777 | return Qnil; |
| 5746 | ptrdiff_t count = SPECPDL_INDEX (); | 5778 | else |
| 5779 | { | ||
| 5780 | ptrdiff_t count; | ||
| 5781 | Lisp_Object was_open = Qnil; | ||
| 5747 | 5782 | ||
| 5748 | specbind (Qinhibit_redisplay, Qt); | 5783 | count = SPECPDL_INDEX (); |
| 5749 | specbind (Qinhibit_quit, Qt); | 5784 | specbind (Qinhibit_redisplay, Qt); |
| 5785 | specbind (Qinhibit_quit, Qt); | ||
| 5750 | 5786 | ||
| 5751 | #ifdef USE_GTK | 5787 | #ifdef USE_GTK |
| 5752 | if (x_gtk_use_system_tooltips) | 5788 | { |
| 5753 | /* Should be handled by xg_hide_tooltip. */ | 5789 | /* When using system tooltip, tip_frame is the Emacs frame on |
| 5754 | emacs_abort (); | 5790 | which the tip is shown. */ |
| 5791 | struct frame *f = XFRAME (tip_frame); | ||
| 5792 | |||
| 5793 | if (FRAME_LIVE_P (f) && xg_hide_tooltip (f)) | ||
| 5794 | { | ||
| 5795 | tip_frame = Qnil; | ||
| 5796 | was_open = Qt; | ||
| 5797 | } | ||
| 5798 | } | ||
| 5755 | #endif | 5799 | #endif |
| 5800 | |||
| 5801 | if (FRAMEP (tip_frame)) | ||
| 5802 | { | ||
| 5756 | if (delete) | 5803 | if (delete) |
| 5757 | delete_frame (frame, Qnil); | 5804 | { |
| 5805 | delete_frame (tip_frame, Qnil); | ||
| 5806 | tip_frame = Qnil; | ||
| 5807 | } | ||
| 5758 | else | 5808 | else |
| 5759 | x_make_frame_invisible (f); | 5809 | x_make_frame_invisible (XFRAME (tip_frame)); |
| 5810 | |||
| 5811 | was_open = Qt; | ||
| 5760 | 5812 | ||
| 5761 | #ifdef USE_LUCID | 5813 | #ifdef USE_LUCID |
| 5762 | /* Bloodcurdling hack alert: The Lucid menu bar widget's | 5814 | /* Bloodcurdling hack alert: The Lucid menu bar widget's |
| @@ -5764,12 +5816,12 @@ x_hide_tip (struct frame *f, bool delete) | |||
| 5764 | menu items is unmapped. Redisplay the menu manually... */ | 5816 | menu items is unmapped. Redisplay the menu manually... */ |
| 5765 | { | 5817 | { |
| 5766 | Widget w; | 5818 | Widget w; |
| 5767 | struct frame *sf = SELECTED_FRAME (); | 5819 | struct frame *f = SELECTED_FRAME (); |
| 5768 | if (FRAME_X_P (sf) && FRAME_LIVE_P (sf)) | 5820 | if (FRAME_X_P (f) && FRAME_LIVE_P (f)) |
| 5769 | { | 5821 | { |
| 5770 | w = sf->output_data.x->menubar_widget; | 5822 | w = f->output_data.x->menubar_widget; |
| 5771 | 5823 | ||
| 5772 | if (!DoesSaveUnders (FRAME_DISPLAY_INFO (sf)->screen) | 5824 | if (!DoesSaveUnders (FRAME_DISPLAY_INFO (f)->screen) |
| 5773 | && w != NULL) | 5825 | && w != NULL) |
| 5774 | { | 5826 | { |
| 5775 | block_input (); | 5827 | block_input (); |
| @@ -5779,10 +5831,12 @@ x_hide_tip (struct frame *f, bool delete) | |||
| 5779 | } | 5831 | } |
| 5780 | } | 5832 | } |
| 5781 | #endif /* USE_LUCID */ | 5833 | #endif /* USE_LUCID */ |
| 5782 | return unbind_to (count, Qt); | ||
| 5783 | } | 5834 | } |
| 5835 | else | ||
| 5836 | tip_frame = Qnil; | ||
| 5837 | |||
| 5838 | return unbind_to (count, was_open); | ||
| 5784 | } | 5839 | } |
| 5785 | return Qnil; | ||
| 5786 | } | 5840 | } |
| 5787 | 5841 | ||
| 5788 | DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | 5842 | DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, |
| @@ -5815,8 +5869,7 @@ with offset DY added (default is -10). | |||
| 5815 | 5869 | ||
| 5816 | A tooltip's maximum size is specified by `x-max-tooltip-size'. | 5870 | A tooltip's maximum size is specified by `x-max-tooltip-size'. |
| 5817 | Text larger than the specified size is clipped. */) | 5871 | Text larger than the specified size is clipped. */) |
| 5818 | (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, | 5872 | (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy) |
| 5819 | Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy) | ||
| 5820 | { | 5873 | { |
| 5821 | struct frame *f, *tip_f; | 5874 | struct frame *f, *tip_f; |
| 5822 | struct window *w; | 5875 | struct window *w; |
| @@ -5827,7 +5880,7 @@ Text larger than the specified size is clipped. */) | |||
| 5827 | int old_windows_or_buffers_changed = windows_or_buffers_changed; | 5880 | int old_windows_or_buffers_changed = windows_or_buffers_changed; |
| 5828 | ptrdiff_t count = SPECPDL_INDEX (); | 5881 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5829 | ptrdiff_t count_1; | 5882 | ptrdiff_t count_1; |
| 5830 | Lisp_Object window, size, tip_frame, parameters; | 5883 | Lisp_Object window, size; |
| 5831 | AUTO_STRING (tip, " *tip*"); | 5884 | AUTO_STRING (tip, " *tip*"); |
| 5832 | 5885 | ||
| 5833 | specbind (Qinhibit_redisplay, Qt); | 5886 | specbind (Qinhibit_redisplay, Qt); |
| @@ -5857,8 +5910,8 @@ Text larger than the specified size is clipped. */) | |||
| 5857 | { | 5910 | { |
| 5858 | bool ok; | 5911 | bool ok; |
| 5859 | 5912 | ||
| 5860 | /* Hide a previous tip on this frame, if any. */ | 5913 | /* Hide a previous tip, if any. */ |
| 5861 | xg_hide_tooltip (f); | 5914 | Fx_hide_tip (); |
| 5862 | 5915 | ||
| 5863 | block_input (); | 5916 | block_input (); |
| 5864 | ok = xg_prepare_tooltip (f, string, &width, &height); | 5917 | ok = xg_prepare_tooltip (f, string, &width, &height); |
| @@ -5866,47 +5919,37 @@ Text larger than the specified size is clipped. */) | |||
| 5866 | { | 5919 | { |
| 5867 | compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); | 5920 | compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); |
| 5868 | xg_show_tooltip (f, root_x, root_y); | 5921 | xg_show_tooltip (f, root_x, root_y); |
| 5922 | /* This is used in Fx_hide_tip. */ | ||
| 5923 | XSETFRAME (tip_frame, f); | ||
| 5869 | } | 5924 | } |
| 5870 | unblock_input (); | 5925 | unblock_input (); |
| 5871 | if (ok) | 5926 | if (ok) goto start_timer; |
| 5872 | /* Schedule call to xg_hide_tip from GTK event loop | ||
| 5873 | to allow the tip disappear after timeout seconds. */ | ||
| 5874 | FRAME_X_OUTPUT (f)->ttip_timeout | ||
| 5875 | = g_timeout_add_seconds (XINT (timeout), xg_hide_tip, (gpointer) f); | ||
| 5876 | else | ||
| 5877 | /* FIXME: what if not ok? */ | ||
| 5878 | FRAME_X_OUTPUT (f)->ttip_timeout = 0; | ||
| 5879 | return unbind_to (count, Qnil); | ||
| 5880 | } | 5927 | } |
| 5881 | #endif /* USE_GTK */ | 5928 | #endif /* USE_GTK */ |
| 5882 | 5929 | ||
| 5883 | parameters = Fframe_parameter (frame, Qtooltip_parameters); | 5930 | if (NILP (last_show_tip_args)) |
| 5884 | if (NILP (parameters)) | 5931 | last_show_tip_args = Fmake_vector (make_number (3), Qnil); |
| 5885 | parameters = Fmake_vector (make_number (3), Qnil); | ||
| 5886 | 5932 | ||
| 5887 | /* Look at current tooltip frame, if any. */ | 5933 | if (FRAMEP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame))) |
| 5888 | tip_f = FRAME_DISPLAY_INFO (f)->x_tooltip_frame; | ||
| 5889 | if (tip_f) | ||
| 5890 | XSETFRAME (tip_frame, tip_f); | ||
| 5891 | else | ||
| 5892 | tip_frame = Qnil; | ||
| 5893 | |||
| 5894 | if (tip_f && FRAME_LIVE_P (tip_f)) | ||
| 5895 | { | 5934 | { |
| 5896 | Lisp_Object last_string = AREF (parameters, 0); | 5935 | Lisp_Object last_string = AREF (last_show_tip_args, 0); |
| 5897 | Lisp_Object last_frame = AREF (parameters, 1); | 5936 | Lisp_Object last_frame = AREF (last_show_tip_args, 1); |
| 5898 | Lisp_Object last_parms = AREF (parameters, 2); | 5937 | Lisp_Object last_parms = AREF (last_show_tip_args, 2); |
| 5899 | 5938 | ||
| 5900 | if (FRAME_VISIBLE_P (tip_f) | 5939 | if (FRAME_VISIBLE_P (XFRAME (tip_frame)) |
| 5901 | && EQ (frame, last_frame) | 5940 | && EQ (frame, last_frame) |
| 5902 | && !NILP (Fequal_including_properties (last_string, string)) | 5941 | && !NILP (Fequal_including_properties (last_string, string)) |
| 5903 | && !NILP (Fequal (last_parms, parms))) | 5942 | && !NILP (Fequal (last_parms, parms))) |
| 5904 | { | 5943 | { |
| 5905 | /* Only DX and DY have changed. */ | 5944 | /* Only DX and DY have changed. */ |
| 5906 | Lisp_Object timer = Fframe_parameter (tip_frame, Qtooltip_timer); | 5945 | tip_f = XFRAME (tip_frame); |
| 5946 | if (!NILP (tip_timer)) | ||
| 5947 | { | ||
| 5948 | Lisp_Object timer = tip_timer; | ||
| 5907 | 5949 | ||
| 5908 | if (!NILP (timer)) | 5950 | tip_timer = Qnil; |
| 5909 | call1 (Qcancel_timer, timer); | 5951 | call1 (Qcancel_timer, timer); |
| 5952 | } | ||
| 5910 | 5953 | ||
| 5911 | block_input (); | 5954 | block_input (); |
| 5912 | compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), | 5955 | compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), |
| @@ -5966,22 +6009,17 @@ Text larger than the specified size is clipped. */) | |||
| 5966 | } | 6009 | } |
| 5967 | } | 6010 | } |
| 5968 | 6011 | ||
| 5969 | x_hide_tip (tip_f, delete); | 6012 | x_hide_tip (delete); |
| 5970 | } | 6013 | } |
| 5971 | else | 6014 | else |
| 5972 | x_hide_tip (tip_f, true); | 6015 | x_hide_tip (true); |
| 5973 | } | 6016 | } |
| 5974 | else | 6017 | else |
| 5975 | x_hide_tip (tip_f, true); | 6018 | x_hide_tip (true); |
| 5976 | 6019 | ||
| 5977 | /* Update tooltip parameters. */ | 6020 | ASET (last_show_tip_args, 0, string); |
| 5978 | { | 6021 | ASET (last_show_tip_args, 1, frame); |
| 5979 | AUTO_FRAME_ARG (arg, Qtooltip_parameters, parameters); | 6022 | ASET (last_show_tip_args, 2, parms); |
| 5980 | ASET (parameters, 0, string); | ||
| 5981 | ASET (parameters, 1, frame); | ||
| 5982 | ASET (parameters, 2, parms); | ||
| 5983 | Fmodify_frame_parameters (frame, arg); | ||
| 5984 | } | ||
| 5985 | 6023 | ||
| 5986 | if (!FRAMEP (tip_frame) || !FRAME_LIVE_P (XFRAME (tip_frame))) | 6024 | if (!FRAMEP (tip_frame) || !FRAME_LIVE_P (XFRAME (tip_frame))) |
| 5987 | { | 6025 | { |
| @@ -5997,6 +6035,9 @@ Text larger than the specified size is clipped. */) | |||
| 5997 | if (NILP (Fassq (Qbackground_color, parms))) | 6035 | if (NILP (Fassq (Qbackground_color, parms))) |
| 5998 | parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")), | 6036 | parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")), |
| 5999 | parms); | 6037 | parms); |
| 6038 | |||
| 6039 | /* Create a frame for the tooltip, and record it in the global | ||
| 6040 | variable tip_frame. */ | ||
| 6000 | if (NILP (tip_frame = x_create_tip_frame (FRAME_DISPLAY_INFO (f), parms))) | 6041 | if (NILP (tip_frame = x_create_tip_frame (FRAME_DISPLAY_INFO (f), parms))) |
| 6001 | /* Creating the tip frame failed. */ | 6042 | /* Creating the tip frame failed. */ |
| 6002 | return unbind_to (count, Qnil); | 6043 | return unbind_to (count, Qnil); |
| @@ -6074,69 +6115,20 @@ Text larger than the specified size is clipped. */) | |||
| 6074 | windows_or_buffers_changed = old_windows_or_buffers_changed; | 6115 | windows_or_buffers_changed = old_windows_or_buffers_changed; |
| 6075 | 6116 | ||
| 6076 | start_timer: | 6117 | start_timer: |
| 6077 | { | 6118 | /* Let the tip disappear after timeout seconds. */ |
| 6078 | /* Let the tip disappear after timeout seconds. */ | 6119 | tip_timer = call3 (intern ("run-at-time"), timeout, Qnil, |
| 6079 | AUTO_FRAME_ARG (arg, Qtooltip_timer, | 6120 | intern ("x-hide-tip")); |
| 6080 | call3 (intern ("run-at-time"), timeout, | 6121 | |
| 6081 | Qnil, intern ("x-hide-tip"))); | ||
| 6082 | Fmodify_frame_parameters (tip_frame, arg); | ||
| 6083 | } | ||
| 6084 | return unbind_to (count, Qnil); | 6122 | return unbind_to (count, Qnil); |
| 6085 | } | 6123 | } |
| 6086 | 6124 | ||
| 6087 | DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 1, 0, | 6125 | |
| 6126 | DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, | ||
| 6088 | doc: /* Hide the current tooltip window, if there is any. | 6127 | doc: /* Hide the current tooltip window, if there is any. |
| 6089 | Optional FRAME is the frame to hide tooltip on. | ||
| 6090 | Value is t if tooltip was open, nil otherwise. */) | 6128 | Value is t if tooltip was open, nil otherwise. */) |
| 6091 | (Lisp_Object frame) | 6129 | (void) |
| 6092 | { | 6130 | { |
| 6093 | Lisp_Object obj = Qnil; | 6131 | return x_hide_tip (!tooltip_reuse_hidden_frame); |
| 6094 | |||
| 6095 | #ifdef USE_GTK | ||
| 6096 | if (x_gtk_use_system_tooltips) | ||
| 6097 | { | ||
| 6098 | if (NILP (frame)) | ||
| 6099 | { | ||
| 6100 | Lisp_Object tail, frame; | ||
| 6101 | |||
| 6102 | FOR_EACH_FRAME (tail, frame) | ||
| 6103 | if (FRAME_X_P (XFRAME (frame))) | ||
| 6104 | if (xg_hide_tooltip (XFRAME (frame))) | ||
| 6105 | obj = Qt; | ||
| 6106 | } | ||
| 6107 | else | ||
| 6108 | { | ||
| 6109 | CHECK_FRAME (frame); | ||
| 6110 | if (FRAME_X_P (XFRAME (frame))) | ||
| 6111 | if (xg_hide_tooltip (XFRAME (frame))) | ||
| 6112 | obj = Qt; | ||
| 6113 | } | ||
| 6114 | return obj; | ||
| 6115 | } | ||
| 6116 | #endif /* USE_GTK */ | ||
| 6117 | |||
| 6118 | if (NILP (frame)) | ||
| 6119 | { | ||
| 6120 | struct x_display_info *dpyinfo; | ||
| 6121 | |||
| 6122 | for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next) | ||
| 6123 | if (dpyinfo->x_tooltip_frame) | ||
| 6124 | if (!NILP (x_hide_tip (dpyinfo->x_tooltip_frame, | ||
| 6125 | !tooltip_reuse_hidden_frame))) | ||
| 6126 | obj = Qt; | ||
| 6127 | } | ||
| 6128 | else | ||
| 6129 | { | ||
| 6130 | struct frame *f; | ||
| 6131 | |||
| 6132 | CHECK_FRAME (frame); | ||
| 6133 | f = XFRAME (frame); | ||
| 6134 | if (FRAME_DISPLAY_INFO (f) | ||
| 6135 | && FRAME_DISPLAY_INFO (f)->x_tooltip_frame) | ||
| 6136 | obj = x_hide_tip (FRAME_DISPLAY_INFO (f)->x_tooltip_frame, | ||
| 6137 | !tooltip_reuse_hidden_frame); | ||
| 6138 | } | ||
| 6139 | return obj; | ||
| 6140 | } | 6132 | } |
| 6141 | 6133 | ||
| 6142 | 6134 | ||
| @@ -7005,6 +6997,13 @@ When using Gtk+ tooltips, the tooltip face is not used. */); | |||
| 7005 | 6997 | ||
| 7006 | defsubr (&Sx_show_tip); | 6998 | defsubr (&Sx_show_tip); |
| 7007 | defsubr (&Sx_hide_tip); | 6999 | defsubr (&Sx_hide_tip); |
| 7000 | tip_timer = Qnil; | ||
| 7001 | staticpro (&tip_timer); | ||
| 7002 | tip_frame = Qnil; | ||
| 7003 | staticpro (&tip_frame); | ||
| 7004 | |||
| 7005 | last_show_tip_args = Qnil; | ||
| 7006 | staticpro (&last_show_tip_args); | ||
| 7008 | 7007 | ||
| 7009 | defsubr (&Sx_uses_old_gtk_dialog); | 7008 | defsubr (&Sx_uses_old_gtk_dialog); |
| 7010 | #if defined (USE_MOTIF) || defined (USE_GTK) | 7009 | #if defined (USE_MOTIF) || defined (USE_GTK) |
diff --git a/src/xterm.c b/src/xterm.c index ada1160ec90..cd1d712f39a 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -987,7 +987,8 @@ static void | |||
| 987 | x_update_begin (struct frame *f) | 987 | x_update_begin (struct frame *f) |
| 988 | { | 988 | { |
| 989 | #ifdef USE_CAIRO | 989 | #ifdef USE_CAIRO |
| 990 | if (FRAME_TOOLTIP_P (f) && ! FRAME_VISIBLE_P (f)) | 990 | if (! NILP (tip_frame) && XFRAME (tip_frame) == f |
| 991 | && ! FRAME_VISIBLE_P (f)) | ||
| 991 | return; | 992 | return; |
| 992 | 993 | ||
| 993 | if (! FRAME_CR_SURFACE (f)) | 994 | if (! FRAME_CR_SURFACE (f)) |
| @@ -7838,9 +7839,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 7838 | 7839 | ||
| 7839 | case UnmapNotify: | 7840 | case UnmapNotify: |
| 7840 | /* Redo the mouse-highlight after the tooltip has gone. */ | 7841 | /* Redo the mouse-highlight after the tooltip has gone. */ |
| 7841 | if (dpyinfo->x_tooltip_frame | 7842 | if (event->xunmap.window == tip_window) |
| 7842 | && FRAME_X_WINDOW (dpyinfo->x_tooltip_frame) == event->xunmap.window) | 7843 | { |
| 7843 | x_redo_mouse_highlight (dpyinfo); | 7844 | tip_window = 0; |
| 7845 | x_redo_mouse_highlight (dpyinfo); | ||
| 7846 | } | ||
| 7844 | 7847 | ||
| 7845 | f = x_top_window_to_frame (dpyinfo, event->xunmap.window); | 7848 | f = x_top_window_to_frame (dpyinfo, event->xunmap.window); |
| 7846 | if (f) /* F may no longer exist if | 7849 | if (f) /* F may no longer exist if |
| @@ -8430,7 +8433,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 8430 | 8433 | ||
| 8431 | #ifdef USE_X_TOOLKIT | 8434 | #ifdef USE_X_TOOLKIT |
| 8432 | /* Tip frames are pure X window, set size for them. */ | 8435 | /* Tip frames are pure X window, set size for them. */ |
| 8433 | if (FRAME_TOOLTIP_P (f)) | 8436 | if (! NILP (tip_frame) && XFRAME (tip_frame) == f) |
| 8434 | { | 8437 | { |
| 8435 | if (FRAME_PIXEL_HEIGHT (f) != configureEvent.xconfigure.height | 8438 | if (FRAME_PIXEL_HEIGHT (f) != configureEvent.xconfigure.height |
| 8436 | || FRAME_PIXEL_WIDTH (f) != configureEvent.xconfigure.width) | 8439 | || FRAME_PIXEL_WIDTH (f) != configureEvent.xconfigure.width) |
| @@ -9611,7 +9614,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) | |||
| 9611 | /* Don't change the size of a tip frame; there's no point in | 9614 | /* Don't change the size of a tip frame; there's no point in |
| 9612 | doing it because it's done in Fx_show_tip, and it leads to | 9615 | doing it because it's done in Fx_show_tip, and it leads to |
| 9613 | problems because the tip frame has no widget. */ | 9616 | problems because the tip frame has no widget. */ |
| 9614 | if (!FRAME_TOOLTIP_P (f)) | 9617 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) |
| 9615 | { | 9618 | { |
| 9616 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), | 9619 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), |
| 9617 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, | 9620 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, |
| @@ -10686,7 +10689,7 @@ x_set_window_size (struct frame *f, bool change_gravity, | |||
| 10686 | /* The following breaks our calculations. If it's really needed, | 10689 | /* The following breaks our calculations. If it's really needed, |
| 10687 | think of something else. */ | 10690 | think of something else. */ |
| 10688 | #if false | 10691 | #if false |
| 10689 | if (!FRAME_TOOLTIP_P (f)) | 10692 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) |
| 10690 | { | 10693 | { |
| 10691 | int text_width, text_height; | 10694 | int text_width, text_height; |
| 10692 | 10695 | ||
| @@ -11337,8 +11340,6 @@ x_free_frame_resources (struct frame *f) | |||
| 11337 | dpyinfo->x_focus_event_frame = 0; | 11340 | dpyinfo->x_focus_event_frame = 0; |
| 11338 | if (f == dpyinfo->x_highlight_frame) | 11341 | if (f == dpyinfo->x_highlight_frame) |
| 11339 | dpyinfo->x_highlight_frame = 0; | 11342 | dpyinfo->x_highlight_frame = 0; |
| 11340 | if (f == dpyinfo->x_tooltip_frame) | ||
| 11341 | dpyinfo->x_tooltip_frame = 0; | ||
| 11342 | if (f == hlinfo->mouse_face_mouse_frame) | 11343 | if (f == hlinfo->mouse_face_mouse_frame) |
| 11343 | reset_mouse_highlight (hlinfo); | 11344 | reset_mouse_highlight (hlinfo); |
| 11344 | 11345 | ||
diff --git a/src/xterm.h b/src/xterm.h index 1eb3e304f84..675a48443dc 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -362,9 +362,6 @@ struct x_display_info | |||
| 362 | /* The frame waiting to be auto-raised in XTread_socket. */ | 362 | /* The frame waiting to be auto-raised in XTread_socket. */ |
| 363 | struct frame *x_pending_autoraise_frame; | 363 | struct frame *x_pending_autoraise_frame; |
| 364 | 364 | ||
| 365 | /* Tooltip frame on this display. */ | ||
| 366 | struct frame *x_tooltip_frame; | ||
| 367 | |||
| 368 | /* The frame where the mouse was last time we reported a ButtonPress event. */ | 365 | /* The frame where the mouse was last time we reported a ButtonPress event. */ |
| 369 | struct frame *last_mouse_frame; | 366 | struct frame *last_mouse_frame; |
| 370 | 367 | ||
| @@ -578,7 +575,6 @@ struct x_output | |||
| 578 | GtkTooltip *ttip_widget; | 575 | GtkTooltip *ttip_widget; |
| 579 | GtkWidget *ttip_lbl; | 576 | GtkWidget *ttip_lbl; |
| 580 | GtkWindow *ttip_window; | 577 | GtkWindow *ttip_window; |
| 581 | guint ttip_timeout; | ||
| 582 | #endif /* USE_GTK_TOOLTIP */ | 578 | #endif /* USE_GTK_TOOLTIP */ |
| 583 | 579 | ||
| 584 | #endif /* USE_GTK */ | 580 | #endif /* USE_GTK */ |