* Re: master 18ec3fcce9: Restore pending_signals at a point in the DND event loop
[not found] ` <20220417003924.49D86C01684@vcs2.savannah.gnu.org>
@ 2022-04-17 3:21 ` Stefan Monnier
2022-04-17 3:55 ` Po Lu
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2022-04-17 3:21 UTC (permalink / raw)
To: emacs-devel; +Cc: Po Lu
> @@ -9674,7 +9675,12 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
> &next_event, &finish, &hold_quit);
> #endif
> #endif
> + /* The unblock_input below might try to read input, but
> + XTread_socket does nothing inside a drag-and-drop event
> + loop, so don't let it clear the pending_signals flag. */
> + signals_were_pending = pending_signals;
> unblock_input ();
> + pending_signals = signals_were_pending;
>
> if (x_dnd_movement_frame)
> {
This is pretty ugly.
Why is it that it "does nothing"? Any hope we can move this restoration
of `pending_signals` closer to the code that "does nothing"?
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: master 18ec3fcce9: Restore pending_signals at a point in the DND event loop
2022-04-17 3:21 ` master 18ec3fcce9: Restore pending_signals at a point in the DND event loop Stefan Monnier
@ 2022-04-17 3:55 ` Po Lu
2022-04-17 5:21 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Po Lu @ 2022-04-17 3:55 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> This is pretty ugly.
> Why is it that it "does nothing"? Any hope we can move this restoration
> of `pending_signals` closer to the code that "does nothing"?
No, because we don't know the prior value of `pending_signals' in that
code.
In general, the interaction between async input and the event loop run
during a drag is pretty confusing, especially on GTK+. This solves the
last case of SelectionRequest events being mishandled (because the
selection events are being stored in the wrong `hold_quit' buffer)
during a drag-and-drop operation on GTK.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: master 18ec3fcce9: Restore pending_signals at a point in the DND event loop
2022-04-17 3:55 ` Po Lu
@ 2022-04-17 5:21 ` Stefan Monnier
2022-04-17 5:53 ` Po Lu
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2022-04-17 5:21 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel
Po Lu [2022-04-17 11:55:23] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> This is pretty ugly.
>> Why is it that it "does nothing"? Any hope we can move this restoration
>> of `pending_signals` closer to the code that "does nothing"?
> No, because we don't know the prior value of `pending_signals' in that
> code.
How bout the first question?
Also, I'm pretty sure the real answer isn't "no" because we can surely
move it to the place where `pending_signals` is changed and that is closer
at least in terms of "dynamic distance".
> In general, the interaction between async input and the event loop run
> during a drag is pretty confusing, especially on GTK+.
And we should make this complexity much more explicit in the code rather
than add magic hacks linked via occasional comments.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: master 18ec3fcce9: Restore pending_signals at a point in the DND event loop
2022-04-17 5:21 ` Stefan Monnier
@ 2022-04-17 5:53 ` Po Lu
2022-04-20 15:05 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Po Lu @ 2022-04-17 5:53 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Also, I'm pretty sure the real answer isn't "no" because we can surely
> move it to the place where `pending_signals` is changed and that is closer
> at least in terms of "dynamic distance".
Changing `process_pending_signals' to take into account a small
technicality in the X11 drag-and-drop code seems much less clean to me
than three lines of code accompanied by an explaining comment.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: master 18ec3fcce9: Restore pending_signals at a point in the DND event loop
2022-04-17 5:53 ` Po Lu
@ 2022-04-20 15:05 ` Stefan Monnier
2022-04-21 0:29 ` Po Lu
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2022-04-20 15:05 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel
> Changing `process_pending_signals' to take into account a small
> technicality in the X11 drag-and-drop code seems much less clean to me
> than three lines of code accompanied by an explaining comment.
To me, those 3 lines are impenetrable.
So, if you could explain (or show) what it would take to do it more like
what I suggest, maybe I can at least improve the comment.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: master 18ec3fcce9: Restore pending_signals at a point in the DND event loop
2022-04-20 15:05 ` Stefan Monnier
@ 2022-04-21 0:29 ` Po Lu
0 siblings, 0 replies; 6+ messages in thread
From: Po Lu @ 2022-04-21 0:29 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Changing `process_pending_signals' to take into account a small
>> technicality in the X11 drag-and-drop code seems much less clean to me
>> than three lines of code accompanied by an explaining comment.
>
> To me, those 3 lines are impenetrable.
>
> So, if you could explain (or show) what it would take to do it more like
> what I suggest, maybe I can at least improve the comment.
That unblock_input might call XTread_socket, which returns in this
specific case since data is passed from the nested event loop to its
caller via the hold_quit parameter to handle_one_xevent, and the
hold_quit given to the read socket hook is not correct.
So XTread_socket always returns without reading input whenever the
nested event loop is active. This is fine, but pending input might not
be read if the nested event loop stops after that, since
process_pending_input clears pending_signals, even if nothing was
actually read.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-04-21 0:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <165015596397.5558.5393619769224500857@vcs2.savannah.gnu.org>
[not found] ` <20220417003924.49D86C01684@vcs2.savannah.gnu.org>
2022-04-17 3:21 ` master 18ec3fcce9: Restore pending_signals at a point in the DND event loop Stefan Monnier
2022-04-17 3:55 ` Po Lu
2022-04-17 5:21 ` Stefan Monnier
2022-04-17 5:53 ` Po Lu
2022-04-20 15:05 ` Stefan Monnier
2022-04-21 0:29 ` Po Lu
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.