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, 12 Apr 2022 16:14:52 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

martin rudalics <rudalics@gmx.at> writes:

>> i have a hook function attached to 'move-frame-functions'.  however, in
>>   emacs 28.1, this hook does not seem to fire at all.
>>
>>
>> In GNU Emacs 28.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60
>> Version 10.14.6 (Build 18G95))
>>   of 2022-04-04 built on builder10-14.lan
>> Windowing system distributor 'Apple', version 10.3.2113
>> System Description:  macOS 12.2.1
>
> A couple of days ago John Yates told me that
>
> (add-hook
>  'move-frame-functions
>  (lambda (frame)
>    (message "Frame %s moved to %s" frame (frame-position frame))))
>
> doesn't work for him with a pgtk build either.  So I suspect that this
> never worked on macOS.
>
> martin

It's because the responsible code was commented out, probably sometime
after the release of 27.1.  Please try the following patch (I suspect
the didExitFullScreen bug alluded to in the comment is also related to
using emacs_event somehow):

diff --git a/src/nsterm.m b/src/nsterm.m
index 550f29212e..ed7ee1401b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7243,6 +7243,7 @@ - (void)windowDidMove: sender
   NSRect r = [win frame];
   NSArray *screens = [NSScreen screens];
   NSScreen *screen = [screens objectAtIndex: 0];
+  struct input_event ie;
 
   NSTRACE ("[EmacsView windowDidMove:]");
 
@@ -7253,12 +7254,10 @@ - (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);
-      //   }
+      ie.kind = MOVE_FRAME_EVENT;
+      XSETFRAME (ie.frame_or_window, emacsframe);
+      XSETINT (ie.x, emacsframe->left_pos);
+      XSETINT (ie.y, emacsframe->top_pos);
     }
 }




reply via email to

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