bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54863: 28.1; hook move-frame-functions not working in emacs 28.1


From: Po Lu
Subject: bug#54863: 28.1; hook move-frame-functions not working in emacs 28.1
Date: Tue, 06 Sep 2022 21:35:29 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> With the following patch, the hook fires when I move the frame on Macos.

Nice!  Are the values of the parameters `left' and `top' correct too
once the hook fires?  Converting between the cartesian NS screen
coordinate system and the X one is sometimes tricky, and I don't
completely understand the NS_PARENT_WINDOW_XXX_POS macros.

Thanks.

> diff --git a/src/nsterm.m b/src/nsterm.m
> index 6c6151701b..bc4e072ea0 100644
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -7912,6 +7912,7 @@ - (void)windowDidMove: sender
>    NSRect r = [win frame];
>    NSArray *screens = [NSScreen screens];
>    NSScreen *screen = [screens objectAtIndex: 0];
> +  struct input_event ie;
>  
>    NSTRACE ("[EmacsView windowDidMove:]");
>  
> @@ -7922,12 +7923,14 @@ - (void)windowDidMove: sender
>        emacsframe->left_pos = NSMinX (r) - NS_PARENT_WINDOW_LEFT_POS 
> (emacsframe);
>        emacsframe->top_pos = NS_PARENT_WINDOW_TOP_POS (emacsframe) - NSMaxY 
> (r);
>  
> -      // FIXME: after event part below didExitFullScreen is not received
> -      // if (emacs_event)
> -      //   {
> -      //     emacs_event->kind = MOVE_FRAME_EVENT;
> -      //     EV_TRAILER ((id)nil);
> -      //   }
> +      if (emacs_event)
> +     {
> +      ie.kind = MOVE_FRAME_EVENT;
> +      XSETFRAME (ie.frame_or_window, emacsframe);
> +      XSETINT (ie.x, emacsframe->left_pos);
> +      XSETINT (ie.y, emacsframe->top_pos);
> +      kbd_buffer_store_event (&ie);
> +     }
>      }
>  }
>  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]