aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr.Sc.KAWAMOTO,Takuji2025-08-02 13:15:06 +0900
committerAlan Third2025-08-11 21:54:58 +0100
commit5b9f4ee76e2acdd56fa6a36d5a6a29d27287c427 (patch)
treee92e045c8bfebbeebcfc44fc5d1d0a76fa3ae119
parent4293a7678b0bf5180a27093c7d65e325b8753354 (diff)
downloademacs-5b9f4ee76e2acdd56fa6a36d5a6a29d27287c427.tar.gz
emacs-5b9f4ee76e2acdd56fa6a36d5a6a29d27287c427.zip
Fix NS frame position update after resize/move
Fixes bug#74074, bug#79164. * src/nsterm.m ([EmacsView windowDidEndLiveResize:]): ([EmacsView updateFramePosition]): New functions. ([EmacsView windowDidMove:]): Move contents of this function into updateFramePosition and call it. Copyright-paperwork-exempt: yes
-rw-r--r--src/nsterm.m63
1 files changed, 37 insertions, 26 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index b006b4d5dd0..5127739e2d9 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6818,6 +6818,11 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action)
6818 6818
6819@implementation EmacsView 6819@implementation EmacsView
6820 6820
6821- (void)windowDidEndLiveResize:(NSNotification *)notification
6822{
6823 [self updateFramePosition];
6824}
6825
6821/* Needed to inform when window closed from lisp. */ 6826/* Needed to inform when window closed from lisp. */
6822- (void) setWindowClosing: (BOOL)closing 6827- (void) setWindowClosing: (BOOL)closing
6823{ 6828{
@@ -7970,6 +7975,37 @@ ns_in_echo_area (void)
7970} 7975}
7971 7976
7972 7977
7978- (void)updateFramePosition
7979{
7980 NSWindow *win = [self window];
7981 NSRect r = [win frame];
7982 NSArray *screens = [NSScreen screens];
7983 NSScreen *screen = [screens objectAtIndex: 0];
7984
7985 if (!emacsframe->output_data.ns)
7986 return;
7987
7988 if (screen != nil)
7989 {
7990 emacsframe->left_pos = (NSMinX (r)
7991 - NS_PARENT_WINDOW_LEFT_POS (emacsframe));
7992 emacsframe->top_pos = (NS_PARENT_WINDOW_TOP_POS (emacsframe)
7993 - NSMaxY (r));
7994
7995 if (emacs_event)
7996 {
7997 struct input_event ie;
7998 EVENT_INIT (ie);
7999 ie.kind = MOVE_FRAME_EVENT;
8000 XSETFRAME (ie.frame_or_window, emacsframe);
8001 XSETINT (ie.x, emacsframe->left_pos);
8002 XSETINT (ie.y, emacsframe->top_pos);
8003 kbd_buffer_store_event (&ie);
8004 }
8005 }
8006}
8007
8008
7973- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize 8009- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
7974/* Normalize frame to gridded text size. */ 8010/* Normalize frame to gridded text size. */
7975{ 8011{
@@ -8304,34 +8340,9 @@ ns_in_echo_area (void)
8304 8340
8305- (void)windowDidMove: sender 8341- (void)windowDidMove: sender
8306{ 8342{
8307 NSWindow *win = [self window];
8308 NSRect r = [win frame];
8309 NSArray *screens = [NSScreen screens];
8310 NSScreen *screen = [screens objectAtIndex: 0];
8311
8312 NSTRACE ("[EmacsView windowDidMove:]"); 8343 NSTRACE ("[EmacsView windowDidMove:]");
8313 8344
8314 if (!emacsframe->output_data.ns) 8345 [self updateFramePosition];
8315 return;
8316
8317 if (screen != nil)
8318 {
8319 emacsframe->left_pos = (NSMinX (r)
8320 - NS_PARENT_WINDOW_LEFT_POS (emacsframe));
8321 emacsframe->top_pos = (NS_PARENT_WINDOW_TOP_POS (emacsframe)
8322 - NSMaxY (r));
8323
8324 if (emacs_event)
8325 {
8326 struct input_event ie;
8327 EVENT_INIT (ie);
8328 ie.kind = MOVE_FRAME_EVENT;
8329 XSETFRAME (ie.frame_or_window, emacsframe);
8330 XSETINT (ie.x, emacsframe->left_pos);
8331 XSETINT (ie.y, emacsframe->top_pos);
8332 kbd_buffer_store_event (&ie);
8333 }
8334 }
8335} 8346}
8336 8347
8337 8348