[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/ns/refactor df9a612 03/12: Change NS port resize detection
From: |
Alan Third |
Subject: |
scratch/ns/refactor df9a612 03/12: Change NS port resize detection |
Date: |
Sat, 24 Jul 2021 11:40:03 -0400 (EDT) |
branch: scratch/ns/refactor
commit df9a61299a2631166281feb859598a29c2d32ea5
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>
Change NS port resize detection
* src/nsterm.m ([EmacsView windowDidResize:]): Remove function, it's
not performing a useful function any more.
([EmacsView viewDidResize]):
([EmacsView resizeWithOldSuperviewSize:]): Replace viewDidResize with
resizeWithOldSuperviewSize.
([EmacsView initFrameFromEmacs:]): Remove the view resize notification
as we don't need it any more.
---
src/nsterm.m | 82 +++++++++++-------------------------------------------------
1 file changed, 15 insertions(+), 67 deletions(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index 1600460..2e351cd 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7040,43 +7040,6 @@ not_in_argv (NSString *arg)
}
-- (void)windowDidResize: (NSNotification *)notification
-{
- NSTRACE ("[EmacsView windowDidResize:]");
- if (!FRAME_LIVE_P (emacsframe))
- {
- NSTRACE_MSG ("Ignored (frame dead)");
- return;
- }
- if (emacsframe->output_data.ns->in_animation)
- {
- NSTRACE_MSG ("Ignored (in animation)");
- return;
- }
-
- if (! [self fsIsNative])
- {
- NSWindow *theWindow = [notification object];
- /* We can get notification on the non-FS window when in
- fullscreen mode. */
- if ([self window] != theWindow) return;
- }
-
- NSTRACE_RECT ("frame", [[notification object] frame]);
-
-#ifdef NS_IMPL_GNUSTEP
- NSWindow *theWindow = [notification object];
-
- /* In GNUstep, at least currently, it's possible to get a didResize
- without getting a willResize, therefore we need to act as if we got
- the willResize now. */
- NSSize sz = [theWindow frame].size;
- sz = [self windowWillResize: theWindow toSize: sz];
-#endif /* NS_IMPL_GNUSTEP */
-
- ns_send_appdefined (-1);
-}
-
#ifdef NS_IMPL_COCOA
- (void)viewDidEndLiveResize
{
@@ -7094,38 +7057,30 @@ not_in_argv (NSString *arg)
#endif /* NS_IMPL_COCOA */
-- (void)viewDidResize:(NSNotification *)notification
+- (void)resizeWithOldSuperviewSize: (NSSize)oldSize
{
- NSRect frame = [self frame];
- int neww, newh, oldw, oldh;
+ NSRect frame;
+ int width, height;
- if (! FRAME_LIVE_P (emacsframe))
- return;
+ NSTRACE ("[EmacsView resizeWithOldSuperviewSize:]");
- NSTRACE ("[EmacsView viewDidResize]");
+ [super resizeWithOldSuperviewSize:oldSize];
- neww = (int)NSWidth (frame);
- newh = (int)NSHeight (frame);
- oldw = FRAME_PIXEL_WIDTH (emacsframe);
- oldh = FRAME_PIXEL_HEIGHT (emacsframe);
+ if (! FRAME_LIVE_P (emacsframe))
+ return;
- /* Don't want to do anything when the view size hasn't changed. */
- if (emacsframe->new_size_p
- ? (newh == emacsframe->new_height
- && neww == emacsframe->new_width)
- : (oldh == newh && oldw == neww))
- {
- NSTRACE_MSG ("No change");
- return;
- }
+ frame = [self frame];
+ width = (int)NSWidth (frame);
+ height = (int)NSHeight (frame);
- NSTRACE_SIZE ("New size", NSMakeSize (neww, newh));
- NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));
+ NSTRACE_SIZE ("New size", NSMakeSize (width, height));
+ NSTRACE_SIZE ("Original size", size);
- change_frame_size (emacsframe, neww, newh, false, YES, false);
+ change_frame_size (emacsframe, width, height, false, YES, false);
SET_FRAME_GARBAGED (emacsframe);
cancel_mouse_face (emacsframe);
+ ns_send_appdefined (-1);
}
@@ -7289,7 +7244,7 @@ not_in_argv (NSString *arg)
/* These settings mean AppKit will retain the contents of the frame
on resize. Unfortunately it also means the frame will not be
automatically marked for display, but we can do that ourselves in
- viewDidResize. */
+ resizeWithOldSuperviewSize. */
[self setWantsLayer:YES];
[self setLayerContentsRedrawPolicy:
NSViewLayerContentsRedrawOnSetNeedsDisplay];
@@ -7313,13 +7268,6 @@ not_in_argv (NSString *arg)
[NSApp registerServicesMenuSendTypes: ns_send_types
returnTypes: [NSArray array]];
- /* Set up view resize notifications. */
- [self setPostsFrameChangedNotifications:YES];
- [[NSNotificationCenter defaultCenter]
- addObserver:self
- selector:@selector (viewDidResize:)
- name:NSViewFrameDidChangeNotification object:nil];
-
ns_window_num++;
return self;
}
- branch scratch/ns/refactor created (now 0132e0a), Alan Third, 2021/07/24
- scratch/ns/refactor db055f9 01/12: Simplify macOS drawing code, Alan Third, 2021/07/24
- scratch/ns/refactor 361d043 11/12: Convert fringe bitmaps to vectors on NS port, Alan Third, 2021/07/24
- scratch/ns/refactor 7b255dc 07/12: Fix some macOS problems, Alan Third, 2021/07/24
- scratch/ns/refactor dee3be7 08/12: * src/nsterm.m (ns_set_frame_alpha): Enable alpha on GNUstep., Alan Third, 2021/07/24
- scratch/ns/refactor d9fd86c2 02/12: Tidy up NS port OS window handling, Alan Third, 2021/07/24
- scratch/ns/refactor 94b4470 06/12: Move parent frame setting code into EmacsWindow, Alan Third, 2021/07/24
- scratch/ns/refactor 8d0fb51 04/12: Fix macOS live resize drawing, Alan Third, 2021/07/24
- scratch/ns/refactor df9a612 03/12: Change NS port resize detection,
Alan Third <=
- scratch/ns/refactor 0132e0a 12/12: Fix image crash on macOS (bug#49688), Alan Third, 2021/07/24
- scratch/ns/refactor 93b18cc 09/12: Simplify NS sizing and positioning code, Alan Third, 2021/07/24
- scratch/ns/refactor 6f4f66d 05/12: Move NS port toolbar handling to the window, Alan Third, 2021/07/24
- scratch/ns/refactor 8d34954 10/12: Fix NS inset rectangle corners, Alan Third, 2021/07/24