- (void)viewDidResize:(NSNotification *)notification
{
NSRect frame = [self frame];
- int neww, newh;
+ int neww, newh, oldw, oldh;
if (! FRAME_LIVE_P (emacsframe))
return;
neww = (int)NSWidth (frame);
newh = (int)NSHeight (frame);
+ oldw = FRAME_PIXEL_WIDTH (emacsframe);
+ oldh = FRAME_PIXEL_HEIGHT (emacsframe);
+
NSTRACE_SIZE ("New size", NSMakeSize (neww, newh));
+ 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;
+ }
#ifdef NS_DRAW_TO_BUFFER
if ([self wantsUpdateLayer])
{
- CGFloat scale = [[self window] backingScaleFactor];
- NSSize size = [surface getSize];
- int oldw = size.width / scale;
- int oldh = size.height / scale;
-
- 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;
- }
-
[surface release];
surface = nil;
}
#endif
- /* 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, neww, newh, false, YES, false);
SET_FRAME_GARBAGED (emacsframe);