Mercurial > emacs
comparison src/xfns.c @ 34450:5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
nothing to do. Bind inhibit-quit.
(tip_frame): Make it a Lisp_Object.
(x_create_tip_frame): Set tip_frame after it has been added to
Vframe_list.
(Fx_show_tip): Don't set tip_frame here.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 11 Dec 2000 19:26:11 +0000 |
parents | 41ecc8525dbc |
children | e381d256c0c2 |
comparison
equal
deleted
inserted
replaced
34449:06453a32471a | 34450:5de00bff5de3 |
---|---|
10296 ***********************************************************************/ | 10296 ***********************************************************************/ |
10297 | 10297 |
10298 static Lisp_Object x_create_tip_frame P_ ((struct x_display_info *, | 10298 static Lisp_Object x_create_tip_frame P_ ((struct x_display_info *, |
10299 Lisp_Object)); | 10299 Lisp_Object)); |
10300 | 10300 |
10301 /* The frame of a currently visible tooltip, or null. */ | 10301 /* The frame of a currently visible tooltip. */ |
10302 | 10302 |
10303 struct frame *tip_frame; | 10303 Lisp_Object tip_frame; |
10304 | 10304 |
10305 /* If non-nil, a timer started that hides the last tooltip when it | 10305 /* If non-nil, a timer started that hides the last tooltip when it |
10306 fires. */ | 10306 fires. */ |
10307 | 10307 |
10308 Lisp_Object tip_timer; | 10308 Lisp_Object tip_timer; |
10345 error ("Invalid frame name--not a string or nil"); | 10345 error ("Invalid frame name--not a string or nil"); |
10346 Vx_resource_name = name; | 10346 Vx_resource_name = name; |
10347 | 10347 |
10348 frame = Qnil; | 10348 frame = Qnil; |
10349 GCPRO3 (parms, name, frame); | 10349 GCPRO3 (parms, name, frame); |
10350 tip_frame = f = make_frame (1); | 10350 f = make_frame (1); |
10351 XSETFRAME (frame, f); | 10351 XSETFRAME (frame, f); |
10352 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; | 10352 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; |
10353 | 10353 |
10354 f->output_method = output_x_window; | 10354 f->output_method = output_x_window; |
10355 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); | 10355 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); |
10558 | 10558 |
10559 /* It is now ok to make the frame official even if we get an error | 10559 /* It is now ok to make the frame official even if we get an error |
10560 below. And the frame needs to be on Vframe_list or making it | 10560 below. And the frame needs to be on Vframe_list or making it |
10561 visible won't work. */ | 10561 visible won't work. */ |
10562 Vframe_list = Fcons (frame, Vframe_list); | 10562 Vframe_list = Fcons (frame, Vframe_list); |
10563 tip_frame = frame; | |
10563 | 10564 |
10564 /* Now that the frame is official, it counts as a reference to | 10565 /* Now that the frame is official, it counts as a reference to |
10565 its display. */ | 10566 its display. */ |
10566 FRAME_X_DISPLAY_INFO (f)->reference_count++; | 10567 FRAME_X_DISPLAY_INFO (f)->reference_count++; |
10567 | 10568 |
10642 parms); | 10643 parms); |
10643 | 10644 |
10644 /* Create a frame for the tooltip, and record it in the global | 10645 /* Create a frame for the tooltip, and record it in the global |
10645 variable tip_frame. */ | 10646 variable tip_frame. */ |
10646 frame = x_create_tip_frame (FRAME_X_DISPLAY_INFO (f), parms); | 10647 frame = x_create_tip_frame (FRAME_X_DISPLAY_INFO (f), parms); |
10647 tip_frame = f = XFRAME (frame); | 10648 f = XFRAME (frame); |
10648 | 10649 |
10649 /* Set up the frame's root window. Currently we use a size of 80 | 10650 /* Set up the frame's root window. Currently we use a size of 80 |
10650 columns x 40 lines. If someone wants to show a larger tip, he | 10651 columns x 40 lines. If someone wants to show a larger tip, he |
10651 will loose. I don't think this is a realistic case. */ | 10652 will loose. I don't think this is a realistic case. */ |
10652 w = XWINDOW (FRAME_ROOT_WINDOW (f)); | 10653 w = XWINDOW (FRAME_ROOT_WINDOW (f)); |
10747 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, | 10748 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, |
10748 "Hide the current tooltip window, if there is any.\n\ | 10749 "Hide the current tooltip window, if there is any.\n\ |
10749 Value is t is tooltip was open, nil otherwise.") | 10750 Value is t is tooltip was open, nil otherwise.") |
10750 () | 10751 () |
10751 { | 10752 { |
10752 int count = specpdl_ptr - specpdl; | 10753 int count; |
10753 int deleted_p = 0; | 10754 Lisp_Object deleted; |
10754 | 10755 |
10756 /* Return quickly if nothing to do. */ | |
10757 if (NILP (tip_timer) && !FRAMEP (tip_frame)) | |
10758 return Qnil; | |
10759 | |
10760 count = BINDING_STACK_SIZE (); | |
10761 deleted = Qnil; | |
10755 specbind (Qinhibit_redisplay, Qt); | 10762 specbind (Qinhibit_redisplay, Qt); |
10763 specbind (Qinhibit_quit, Qt); | |
10756 | 10764 |
10757 if (!NILP (tip_timer)) | 10765 if (!NILP (tip_timer)) |
10758 { | 10766 { |
10759 call1 (intern ("cancel-timer"), tip_timer); | 10767 Lisp_Object tem = tip_timer; |
10760 tip_timer = Qnil; | 10768 tip_timer = Qnil; |
10761 } | 10769 call1 (intern ("cancel-timer"), tem); |
10762 | 10770 } |
10763 if (tip_frame) | 10771 |
10772 if (FRAMEP (tip_frame)) | |
10764 { | 10773 { |
10765 Lisp_Object frame; | 10774 Lisp_Object frame; |
10766 | 10775 struct gcpro gcpro1; |
10767 XSETFRAME (frame, tip_frame); | 10776 |
10768 Fdelete_frame (frame, Qt); | 10777 frame = tip_frame; |
10769 tip_frame = NULL; | 10778 GCPRO1 (frame); |
10770 deleted_p = 1; | 10779 tip_frame = Qnil; |
10780 Fdelete_frame (frame, Qnil); | |
10781 deleted = Qt; | |
10771 | 10782 |
10772 #ifdef USE_LUCID | 10783 #ifdef USE_LUCID |
10773 /* Bloodcurdling hack alert: The Lucid menu bar widget's | 10784 /* Bloodcurdling hack alert: The Lucid menu bar widget's |
10774 redisplay procedure is not called when a tip frame over menu | 10785 redisplay procedure is not called when a tip frame over menu |
10775 items is unmapped. Redisplay the menu manually... */ | 10786 items is unmapped. Redisplay the menu manually... */ |
10787 } | 10798 } |
10788 } | 10799 } |
10789 #endif /* USE_LUCID */ | 10800 #endif /* USE_LUCID */ |
10790 } | 10801 } |
10791 | 10802 |
10792 return unbind_to (count, deleted_p ? Qt : Qnil); | 10803 return unbind_to (count, deleted); |
10793 } | 10804 } |
10794 | 10805 |
10795 | 10806 |
10796 | 10807 |
10797 /*********************************************************************** | 10808 /*********************************************************************** |
11328 busy_cursor_atimer = NULL; | 11339 busy_cursor_atimer = NULL; |
11329 busy_cursor_shown_p = 0; | 11340 busy_cursor_shown_p = 0; |
11330 | 11341 |
11331 defsubr (&Sx_show_tip); | 11342 defsubr (&Sx_show_tip); |
11332 defsubr (&Sx_hide_tip); | 11343 defsubr (&Sx_hide_tip); |
11344 tip_timer = Qnil; | |
11333 staticpro (&tip_timer); | 11345 staticpro (&tip_timer); |
11334 tip_timer = Qnil; | 11346 tip_frame = Qnil; |
11347 staticpro (&tip_frame); | |
11335 | 11348 |
11336 #ifdef USE_MOTIF | 11349 #ifdef USE_MOTIF |
11337 defsubr (&Sx_file_dialog); | 11350 defsubr (&Sx_file_dialog); |
11338 #endif | 11351 #endif |
11339 } | 11352 } |