[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2c30614: Fix initial frame resizing issue on NS (bug#40200)
From: |
Alan Third |
Subject: |
master 2c30614: Fix initial frame resizing issue on NS (bug#40200) |
Date: |
Sun, 3 May 2020 12:16:23 -0400 (EDT) |
branch: master
commit 2c306146d2a4a12b291ab81ed4ff2968a9ba22e6
Author: Alan Third <address@hidden>
Commit: Alan Third <address@hidden>
Fix initial frame resizing issue on NS (bug#40200)
* src/nsterm.m ([EmacsView viewDidResize:]): Don't try to determine
the old size when not drawing to the buffer.
---
src/nsterm.m | 51 +++++++++++++++++++++------------------------------
1 file changed, 21 insertions(+), 30 deletions(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index a8f7540..1953138 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7335,48 +7335,39 @@ not_in_argv (NSString *arg)
- (void)viewDidResize:(NSNotification *)notification
{
NSRect frame = [self frame];
- int oldw, oldh, neww, newh;
+ int neww, newh;
if (! FRAME_LIVE_P (emacsframe))
return;
+ NSTRACE ("[EmacsView viewDidResize]");
+
+ neww = (int)NSWidth (frame);
+ newh = (int)NSHeight (frame);
+ NSTRACE_SIZE ("New size", NSMakeSize (neww, newh));
+
#ifdef NS_DRAW_TO_BUFFER
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
if ([self wantsUpdateLayer])
{
-#endif
CGFloat scale = [[self window] backingScaleFactor];
- oldw = (CGFloat)CGBitmapContextGetWidth (drawingBuffer) / scale;
- oldh = (CGFloat)CGBitmapContextGetHeight (drawingBuffer) / scale;
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
- }
- else
- {
-#endif
-#endif /* NS_DRAW_TO_BUFFER */
-#if !defined (NS_DRAW_TO_BUFFER) || MAC_OS_X_VERSION_MIN_REQUIRED < 101400
- oldw = FRAME_PIXEL_WIDTH (emacsframe);
- oldh = FRAME_PIXEL_HEIGHT (emacsframe);
-#endif
-#if defined (NS_DRAW_TO_BUFFER) && MAC_OS_X_VERSION_MIN_REQUIRED < 101400
- }
-#endif
-
- neww = (int)NSWidth (frame);
- newh = (int)NSHeight (frame);
+ int oldw = (CGFloat)CGBitmapContextGetWidth (drawingBuffer) / scale;
+ int oldh = (CGFloat)CGBitmapContextGetHeight (drawingBuffer) / scale;
- NSTRACE ("[EmacsView viewDidResize]");
+ NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));
- /* Don't want to do anything when the view size hasn't changed. */
- if ((oldh == newh && oldw == neww))
- {
- NSTRACE_MSG ("No change");
- return;
+ /* Don't want to do anything when the view size hasn't changed. */
+ if ((oldh == newh && oldw == neww))
+ {
+ NSTRACE_MSG ("No change");
+ return;
+ }
}
+#endif
- NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));
- NSTRACE_SIZE ("New size", NSMakeSize (neww, newh));
-
+ /* I'm not sure if it's safe to call this every time the view
+ changes size, as Emacs may already know about the change.
+ Unfortunately there doesn't seem to be a bullet-proof method of
+ determining whether we need to call it or not. */
change_frame_size (emacsframe,
FRAME_PIXEL_TO_TEXT_WIDTH (emacsframe, neww),
FRAME_PIXEL_TO_TEXT_HEIGHT (emacsframe, newh),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 2c30614: Fix initial frame resizing issue on NS (bug#40200),
Alan Third <=