Subject: bug#36269: bug#28620: Mouse drag event records wrong window for release when crossing frames

From: Eli Zaretskii <[email-masked]>
Date: Sat, 27 Jul 2019 13:08:52 +0300

> From: martin rudalics <[email-masked]>
> Date: Sat, 27 Jul 2019 11:26:47 +0200
> 
> I tried to address this problem in the attached patch.  Tested with
> GTK, Lucid, Motif and Windows builds.  Since my GNUstep Emacs is
> currently broken, somebody please verify that it does something
> reasonable (if anything at all) on MacOS.  Otherwise, I'd need help
> from people working there.
> 
> The patch should also fix the mouse drag and drop region vs. mouse
> avoidance mode problem.  Please someone verify that it does TRT now.

Thanks, a few minor comments below.

> +  /* If forced to complete the update, no input is pending or we are
> +     tracking the mouse do the update.  */

Commas missing here.  Should be

  /* If forced to complete the update, no input is pending, or we are
     tracking the mouse, do the update.  */

> -	  /* If this event is on a different frame, return a switch-frame this
> -	     time, and leave the event in the queue for next time.  */
> +	  /* If this event is on a different frame, return a
> +	     switch-frame this time and leave the event in the queue

A comma missing before "and".

> @@ -3995,7 +3992,7 @@ kbd_buffer_get_event (KBOARD **kbp,
>        }
>      }
>    /* Try generating a mouse motion event.  */
> -  else if (!NILP (do_mouse_tracking) && some_mouse_moved ())
> +  else if (some_mouse_moved ())

Can't we have mouse motion events outside track-mouse?

> +  DEFVAR_LISP ("track-mouse", track_mouse,
> +	       doc: /* Non-nil means generate motion events for mouse motion.
> +The sepecial values 'dragging' and 'dropping' assert that the moue
       ^^^^^^^^                                                  ^^^^
Typos.

Also, the quoting in doc strings should be `like this'.

> +      /* While dropping use the last mouse frame only if there is no
> +	 currently focused frame.  */

A comma missing before "use".

There's too much of whitespace changes in the rest of the patch,
making it very hard to review.  Can you show the patch without
whitespace differences?

Thanks.