unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: James Ahlborn <jahlborn@getguru.com>, 54863@debbugs.gnu.org
Subject: bug#54863: 28.1; hook move-frame-functions not working in emacs 28.1
Date: Tue, 12 Apr 2022 16:14:52 +0800	[thread overview]
Message-ID: <87r162wweb.fsf@yahoo.com> (raw)
In-Reply-To: <0ee6195e-4561-d9ff-e30b-68707ce14b9e@gmx.at> (martin rudalics's message of "Tue, 12 Apr 2022 09:45:02 +0200")

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	other threads:[~2022-04-12  8:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 20:18 bug#54863: 28.1; hook move-frame-functions not working in emacs 28.1 James Ahlborn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-12  7:45 ` martin rudalics
2022-04-12  8:14   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-09-06 11:20     ` Lars Ingebrigtsen
2022-09-06 12:13       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-06 13:24         ` Lars Ingebrigtsen
2022-09-06 13:35           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-06 13:40             ` Lars Ingebrigtsen
2022-09-07  1:05               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-07 12:51                 ` Lars Ingebrigtsen
2022-04-12 21:25 ` James Ahlborn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-13  8:45   ` martin rudalics
2022-04-13 13:07     ` James Ahlborn via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r162wweb.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=54863@debbugs.gnu.org \
    --cc=jahlborn@getguru.com \
    --cc=luangruo@yahoo.com \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).