Commit 6516d10a authored by Adrian Robert's avatar Adrian Robert

* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and

	     don't update the NSWindow itself.
  	   (EmacsView-windowWillUseStandardFrame:defaultFrame:): Improve
	    state detection and store user rect ourselves. (Bug #3581)
parent 7107c29e
......@@ -9,6 +9,10 @@
* nsterm.m (ns_no_defaults): Remove.
(ns_term_init): Switch ns_no_defaults -> inhibit_x_resources.
(ns_use_qd_smoothing): Remove legacy variable.
(EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
don't update the NSWindow itself.
(EmacsView-windowWillUseStandardFrame:defaultFrame:): Improve
state detection and store user rect ourselves. (Bug #3581)
* nsfont.m (nsfont_draw) [NS_IMPL_COCOA]: Don't use
ns_use_qd_smoothing.
......
......@@ -1089,6 +1089,7 @@ Free a pool and temporary objects it refers to (callable from C)
if (xoff < 100)
f->left_pos = 100; /* don't overlap menu */
#endif
if (view != nil && (screen = [[view window] screen]))
[[view window] setFrameTopLeftPoint:
NSMakePoint (SCREENMAXBOUND (f->left_pos),
......@@ -5191,7 +5192,6 @@ - (void)windowDidMove: sender
NSWindow *win = [self window];
NSRect r = [win frame];
NSScreen *screen = [win screen];
NSRect sr = [screen frame];
NSTRACE (windowDidMove);
......@@ -5199,21 +5199,24 @@ - (void)windowDidMove: sender
return;
if (screen != nil)
{
emacsframe->left_pos = r.origin.x; /* - sr.origin.x; */
emacsframe->top_pos = sr.size.height -
(r.origin.y + r.size.height); /* + sr.origin.y; */
emacsframe->left_pos = r.origin.x;
emacsframe->top_pos =
[screen frame].size.height - (r.origin.y + r.size.height);
}
}
#ifdef NS_IMPL_COCOA
/* if we don't do this manually, the window will resize but not move */
/* Called AFTER method below, but before our windowWillResize call there leads
to windowDidResize -> x_set_window_size. Update emacs' notion of frame
location so set_window_size moves the frame. */
- (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame
{
NSTRACE (windowShouldZoom);
[[self window] setFrame: newFrame display: NO];
emacsframe->left_pos = (int)newFrame.origin.x;
emacsframe->top_pos = [[sender screen] frame].size.height
- (newFrame.origin.y+newFrame.size.height);
return YES;
}
#endif
/* Override to do something slightly nonstandard, but nice. First click on
......@@ -5223,16 +5226,27 @@ - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender
defaultFrame:(NSRect)defaultFrame
{
NSRect result = [sender frame];
static NSRect ns_userRect = { 0, 0, 0, 0 };
NSTRACE (windowWillUseStandardFrame);
if (result.size.height == defaultFrame.size.height) {
result = defaultFrame;
} else {
result.size.height = defaultFrame.size.height;
result.origin.y = defaultFrame.origin.y;
}
if (abs (defaultFrame.size.height - result.size.height)
> FRAME_LINE_HEIGHT (emacsframe))
{
/* first click */
ns_userRect = result;
result.size.height = defaultFrame.size.height;
result.origin.y = defaultFrame.origin.y;
}
else
{
if (abs (defaultFrame.size.width - result.size.width)
> FRAME_COLUMN_WIDTH (emacsframe))
result = defaultFrame; /* second click */
else
result = ns_userRect.size.height ? ns_userRect : result; /* restore */
}
/* A windowWillResize does not get generated on Tiger or Leopard. */
[self windowWillResize: sender toSize: result.size];
return result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment