aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2025-02-27 09:53:41 +0800
committerPo Lu2025-02-27 18:18:58 +0800
commita4a458ffa4aaeb988ff4b6e6087c44dfdaf40a0b (patch)
tree6325d0821ee1d21873de9f20877d4d1c93c33f1c /src
parent85a9b916db126add5a5e2bf4b2b9531ab998cad4 (diff)
downloademacs-a4a458ffa4aaeb988ff4b6e6087c44dfdaf40a0b.tar.gz
emacs-a4a458ffa4aaeb988ff4b6e6087c44dfdaf40a0b.zip
Fix drag-and-drop treatment of reused tooltip frames
* src/androidfns.c (Fx_show_tip): Set `tip_window' to that of any reused tooltip frame. * src/haikufns.c (unwind_create_frame): Return whether the frame was destroyed, as on X. (unwind_create_tip_frame, haiku_create_frame, Fx_show_tip): Synchronize with X. (do_unwind_create_frame): New function. (tip_window): Remove unused variable. * src/nsfns.m (tip_window, unwind_create_tip_frame): Remove unused variable `tip_window'. * src/pgtkfns.c (pgtk_create_tip_frame): Rename to pgtk_create_tip_frame. (Fx_show_tip): Adjust accordingly. Set `tip_window' to that of any reused tooltip frame. * src/w32fns.c (Fx_show_tip): * src/xfns.c (Fx_show_tip): Set `tip_window' to that of any reused tooltip frame.
Diffstat (limited to 'src')
-rw-r--r--src/androidfns.c2
-rw-r--r--src/haikufns.c35
-rw-r--r--src/nsfns.m9
-rw-r--r--src/pgtkfns.c7
-rw-r--r--src/w32fns.c5
-rw-r--r--src/xfns.c11
6 files changed, 41 insertions, 28 deletions
diff --git a/src/androidfns.c b/src/androidfns.c
index f8e3d397008..ec8651aafcb 100644
--- a/src/androidfns.c
+++ b/src/androidfns.c
@@ -2449,6 +2449,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
2449 /* Creating the tip frame failed. */ 2449 /* Creating the tip frame failed. */
2450 return unbind_to (count, Qnil); 2450 return unbind_to (count, Qnil);
2451 } 2451 }
2452 else
2453 tip_window = FRAME_ANDROID_WINDOW (XFRAME (tip_frame));
2452 2454
2453 tip_f = XFRAME (tip_frame); 2455 tip_f = XFRAME (tip_frame);
2454 window = FRAME_ROOT_WINDOW (tip_f); 2456 window = FRAME_ROOT_WINDOW (tip_f);
diff --git a/src/haikufns.c b/src/haikufns.c
index 6490a22bd01..298a27ccc02 100644
--- a/src/haikufns.c
+++ b/src/haikufns.c
@@ -53,10 +53,6 @@ Lisp_Object tip_frame;
53/* The X and Y deltas of the last call to `x-show-tip'. */ 53/* The X and Y deltas of the last call to `x-show-tip'. */
54Lisp_Object tip_dx, tip_dy; 54Lisp_Object tip_dx, tip_dy;
55 55
56/* The window-system window corresponding to the frame of the
57 currently visible tooltip. */
58static Window tip_window;
59
60/* A timer that hides or deletes the currently visible tooltip when it 56/* A timer that hides or deletes the currently visible tooltip when it
61 fires. */ 57 fires. */
62static Lisp_Object tip_timer; 58static Lisp_Object tip_timer;
@@ -610,7 +606,7 @@ initial_setup_back_buffer (struct frame *f)
610 unblock_input (); 606 unblock_input ();
611} 607}
612 608
613static void 609static Lisp_Object
614unwind_create_frame (Lisp_Object frame) 610unwind_create_frame (Lisp_Object frame)
615{ 611{
616 struct frame *f = XFRAME (frame); 612 struct frame *f = XFRAME (frame);
@@ -619,22 +615,27 @@ unwind_create_frame (Lisp_Object frame)
619 display is disconnected after the frame has become official, but 615 display is disconnected after the frame has become official, but
620 before x_create_frame removes the unwind protect. */ 616 before x_create_frame removes the unwind protect. */
621 if (!FRAME_LIVE_P (f)) 617 if (!FRAME_LIVE_P (f))
622 return; 618 return Qnil;
623 619
624 /* If frame is ``official'', nothing to do. */ 620 /* If frame is ``official'', nothing to do. */
625 if (NILP (Fmemq (frame, Vframe_list))) 621 if (NILP (Fmemq (frame, Vframe_list)))
626 { 622 {
627 haiku_free_frame_resources (f); 623 haiku_free_frame_resources (f);
628 free_glyphs (f); 624 free_glyphs (f);
625 return Qt;
629 } 626 }
627
628 return Qnil;
630} 629}
631 630
632static void 631static void
633unwind_create_tip_frame (Lisp_Object frame) 632unwind_create_tip_frame (Lisp_Object frame)
634{ 633{
635 unwind_create_frame (frame); 634 Lisp_Object deleted;
636 tip_window = NULL; 635
637 tip_frame = Qnil; 636 deleted = unwind_create_frame (frame);
637 if (deleted)
638 tip_frame = Qnil;
638} 639}
639 640
640static unsigned long 641static unsigned long
@@ -673,6 +674,12 @@ haiku_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval
673 } 674 }
674} 675}
675 676
677static void
678do_unwind_create_frame (Lisp_Object frame)
679{
680 unwind_create_frame (frame);
681}
682
676static Lisp_Object 683static Lisp_Object
677haiku_create_frame (Lisp_Object parms) 684haiku_create_frame (Lisp_Object parms)
678{ 685{
@@ -759,7 +766,7 @@ haiku_create_frame (Lisp_Object parms)
759 FRAME_DISPLAY_INFO (f) = dpyinfo; 766 FRAME_DISPLAY_INFO (f) = dpyinfo;
760 767
761 /* With FRAME_DISPLAY_INFO set up, this unwind-protect is safe. */ 768 /* With FRAME_DISPLAY_INFO set up, this unwind-protect is safe. */
762 record_unwind_protect (unwind_create_frame, frame); 769 record_unwind_protect (do_unwind_create_frame, frame);
763 770
764 /* Set the name; the functions to which we pass f expect the name to 771 /* Set the name; the functions to which we pass f expect the name to
765 be set. */ 772 be set. */
@@ -2504,12 +2511,12 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
2504 break; 2511 break;
2505 } 2512 }
2506 else 2513 else
2507 tip_last_parms = 2514 tip_last_parms
2508 calln (Qassq_delete_all, parm, tip_last_parms); 2515 = calln (Qassq_delete_all, parm, tip_last_parms);
2509 } 2516 }
2510 else 2517 else
2511 tip_last_parms = 2518 tip_last_parms
2512 calln (Qassq_delete_all, parm, tip_last_parms); 2519 = calln (Qassq_delete_all, parm, tip_last_parms);
2513 } 2520 }
2514 2521
2515 /* Now check if every parameter in what is left of 2522 /* Now check if every parameter in what is left of
diff --git a/src/nsfns.m b/src/nsfns.m
index a2c50468cd1..9f52777879c 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -66,10 +66,6 @@ static Lisp_Object tip_frame;
66/* The X and Y deltas of the last call to `x-show-tip'. */ 66/* The X and Y deltas of the last call to `x-show-tip'. */
67static Lisp_Object tip_dx, tip_dy; 67static Lisp_Object tip_dx, tip_dy;
68 68
69/* The window-system window corresponding to the frame of the
70 currently visible tooltip. */
71static NSWindow *tip_window;
72
73/* A timer that hides or deletes the currently visible tooltip when it 69/* A timer that hides or deletes the currently visible tooltip when it
74 fires. */ 70 fires. */
75static Lisp_Object tip_timer; 71static Lisp_Object tip_timer;
@@ -2959,10 +2955,7 @@ unwind_create_tip_frame (Lisp_Object frame)
2959 2955
2960 deleted = unwind_create_frame (frame); 2956 deleted = unwind_create_frame (frame);
2961 if (EQ (deleted, Qt)) 2957 if (EQ (deleted, Qt))
2962 { 2958 tip_frame = Qnil;
2963 tip_window = NULL;
2964 tip_frame = Qnil;
2965 }
2966} 2959}
2967 2960
2968/* Create a frame for a tooltip on the display described by DPYINFO. 2961/* Create a frame for a tooltip on the display described by DPYINFO.
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 73cd6e5695d..6231ef1cb48 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -2646,7 +2646,7 @@ unwind_create_tip_frame (Lisp_Object frame)
2646 when this happens. */ 2646 when this happens. */
2647 2647
2648static Lisp_Object 2648static Lisp_Object
2649x_create_tip_frame (struct pgtk_display_info *dpyinfo, Lisp_Object parms, struct frame *p) 2649pgtk_create_tip_frame (struct pgtk_display_info *dpyinfo, Lisp_Object parms, struct frame *p)
2650{ 2650{
2651 struct frame *f; 2651 struct frame *f;
2652 Lisp_Object frame; 2652 Lisp_Object frame;
@@ -3264,10 +3264,13 @@ Text larger than the specified size is clipped. */)
3264 3264
3265 /* Create a frame for the tooltip, and record it in the global 3265 /* Create a frame for the tooltip, and record it in the global
3266 variable tip_frame. */ 3266 variable tip_frame. */
3267 if (NILP (tip_frame = x_create_tip_frame (FRAME_DISPLAY_INFO (f), parms, f))) 3267 if (NILP ((tip_frame = pgtk_create_tip_frame (FRAME_DISPLAY_INFO (f),
3268 parms, f))))
3268 /* Creating the tip frame failed. */ 3269 /* Creating the tip frame failed. */
3269 return unbind_to (count, Qnil); 3270 return unbind_to (count, Qnil);
3270 } 3271 }
3272 else
3273 tip_window = FRAME_X_WINDOW (XFRAME (tip_frame));
3271 3274
3272 tip_f = XFRAME (tip_frame); 3275 tip_f = XFRAME (tip_frame);
3273 window = FRAME_ROOT_WINDOW (tip_f); 3276 window = FRAME_ROOT_WINDOW (tip_f);
diff --git a/src/w32fns.c b/src/w32fns.c
index 89a4d46240a..17221b73470 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7931,6 +7931,11 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
7931 return unbind_to (count, Qnil); 7931 return unbind_to (count, Qnil);
7932 } 7932 }
7933 } 7933 }
7934 else
7935 /* Required by X11 drag and drop, and left here in the interests of
7936 consistency and in the event drag and drop should be implemented
7937 on W32. */
7938 tip_window = FRAME_W32_WINDOW (XFRAME (tip_frame));
7934 7939
7935 tip_f = XFRAME (tip_frame); 7940 tip_f = XFRAME (tip_frame);
7936 window = FRAME_ROOT_WINDOW (tip_f); 7941 window = FRAME_ROOT_WINDOW (tip_f);
diff --git a/src/xfns.c b/src/xfns.c
index ec7d54180e4..d8a3ce0b3b1 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -9109,12 +9109,12 @@ Text larger than the specified size is clipped. */)
9109 break; 9109 break;
9110 } 9110 }
9111 else 9111 else
9112 tip_last_parms = 9112 tip_last_parms
9113 calln (Qassq_delete_all, parm, tip_last_parms); 9113 = calln (Qassq_delete_all, parm, tip_last_parms);
9114 } 9114 }
9115 else 9115 else
9116 tip_last_parms = 9116 tip_last_parms
9117 calln (Qassq_delete_all, parm, tip_last_parms); 9117 = calln (Qassq_delete_all, parm, tip_last_parms);
9118 } 9118 }
9119 9119
9120 /* Now check if every parameter in what is left of 9120 /* Now check if every parameter in what is left of
@@ -9166,6 +9166,9 @@ Text larger than the specified size is clipped. */)
9166 /* Creating the tip frame failed. */ 9166 /* Creating the tip frame failed. */
9167 return unbind_to (count, Qnil); 9167 return unbind_to (count, Qnil);
9168 } 9168 }
9169 else
9170 /* Required by X11 drag and drop. */
9171 tip_window = FRAME_X_WINDOW (XFRAME (tip_frame));
9169 9172
9170 tip_f = XFRAME (tip_frame); 9173 tip_f = XFRAME (tip_frame);
9171 window = FRAME_ROOT_WINDOW (tip_f); 9174 window = FRAME_ROOT_WINDOW (tip_f);