Fix Motif DND after atom ownership is lost due to frame destruction

* src/xterm.c (xm_get_drag_atom_1): Record owner.
(x_free_frame_resources): Clear drag atom if owner was freed.
* src/xterm.h (struct x_display_info): New field
`motif_drag_atom_owner'.
This commit is contained in:
Po Lu 2022-06-16 13:58:39 +08:00
parent 054832c9e1
commit 55e9d729ca
2 changed files with 10 additions and 0 deletions

View file

@ -2281,6 +2281,7 @@ xm_get_drag_atom_1 (struct x_display_info *dpyinfo,
}
dpyinfo->motif_drag_atom_time = dpyinfo->last_user_time;
dpyinfo->motif_drag_atom_owner = source_frame;
XUngrabServer (dpyinfo->display);
return atom;
@ -25310,6 +25311,12 @@ x_free_frame_resources (struct frame *f)
g_object_unref (FRAME_OUTPUT_DATA (f)->scrollbar_foreground_css_provider);
#endif
if (f == dpyinfo->motif_drag_atom_owner)
{
dpyinfo->motif_drag_atom_owner = NULL;
dpyinfo->motif_drag_atom = None;
}
if (f == dpyinfo->x_focus_frame)
dpyinfo->x_focus_frame = 0;
if (f == dpyinfo->x_focus_event_frame)

View file

@ -576,6 +576,9 @@ struct x_display_info
/* When it was owned. */
Time motif_drag_atom_time;
/* The frame that currently owns `motif_drag_atom'. */
struct frame *motif_drag_atom_owner;
/* Extended window manager hints, Atoms supported by the window manager and
atoms for setting the window type. */
Atom Xatom_net_supported, Xatom_net_supporting_wm_check;