Commit Diff


commit - 4464a8778de8a8d214548b7fe73da64c19b7a71c
commit + fcce05982b4a611d20f05978fbb0819e6163785d
blob - c434c91f640d05bc01a1bbecd036f5cef3a1c2b8
blob + 0f37d715d7fc17f06e76c069f403ef167810634b
--- src/cmd/devdraw/cocoa-screen.m
+++ src/cmd/devdraw/cocoa-screen.m
@@ -118,6 +118,7 @@ static void makewin(char*);
 static void sendmouse(void);
 static void setcursor0(Cursor*);
 static void togglefs(void);
+static void acceptresizing(int);
 
 static NSCursor* makecursor(Cursor*);
 
@@ -163,6 +164,7 @@ static NSCursor* makecursor(Cursor*);
 	return YES;
 }
 - (void)applicationDidBecomeActive:(id)arg{ in.willactivate = 0;}
+- (void)windowWillEnterFullScreen:(id)arg{ acceptresizing(1);}
 - (void)windowDidEnterFullScreen:(id)arg{ win.isnfs = 1; hidebars(1);}
 - (void)windowWillExitFullScreen:(id)arg{ win.isnfs = 0; hidebars(0);}
 - (void)windowDidExitFullScreen:(id)arg
@@ -678,19 +680,44 @@ updatecursor(void)
 }
 
 static void
+acceptresizing(int set)
+{
+	uint old, style;
+
+	old = [WIN styleMask];
+
+	if((old | NSResizableWindowMask) != Winstyle)
+		return;	/* when entering new fullscreen */
+
+	if(set)
+		style = Winstyle;
+	else
+		style = Winstyle & ~NSResizableWindowMask;
+
+	if(style != old)
+		[WIN setStyleMask:style];
+}
+
+static void
 getmousepos(void)
 {
-	NSPoint p;
+	NSPoint p, q;
 
 	p = [WIN mouseLocationOutsideOfEventStream];
-	p = [win.content convertPoint:p fromView:nil];
-	in.mpos.x = round(p.x);
-	in.mpos.y = round(p.y);
+	q = [win.content convertPoint:p fromView:nil];
+	in.mpos.x = round(q.x);
+	in.mpos.y = round(q.y);
 
 	updatecursor();
 
 	if(win.isnfs || win.isofs)
 		hidebars(1);
+	else if(OSX_VERSION>=100700 && [WIN inLiveResize]==0){
+		if(p.x<12 && p.y<12 && p.x>2 && p.y>2)
+			acceptresizing(0);
+		else
+			acceptresizing(1);
+	}
 }
 
 static void