File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ such third-party acknowledgments.
5151
5252- (void ) makeMainWindowOnMainThread ;
5353- (void ) makeMainWindow ;
54+ - (void ) placeMainWindowOnLargerScreenGivenWidth : (sqInt) width height : (sqInt) height ;
5455- (id ) createPossibleWindow ;
5556- (void ) workerThreadStart ;
5657- (void ) singleThreadStart ;
Original file line number Diff line number Diff line change @@ -64,6 +64,12 @@ - (void) makeMainWindow {
6464 /* get old window size */
6565 width = ((unsigned ) getSavedWindowSize ()) >> 16 ;
6666 height = getSavedWindowSize () & 0xFFFF ;
67+
68+ extern sqInt getFullScreenFlag (void );
69+ if (!getFullScreenFlag ()) {
70+ [self placeMainWindowOnLargerScreenGivenWidth: width height: height];
71+ }
72+
6773 windowBlock = AddWindowBlock ();
6874 windowBlock->handle = (__bridge void *) createdWindow;
6975 windowBlock->context = nil ;
@@ -72,7 +78,7 @@ - (void) makeMainWindow {
7278 setSavedWindowSize ( (width << 16 ) |(height & 0xFFFF ));
7379 windowBlock->width = width;
7480 windowBlock->height = height;
75- extern sqInt getFullScreenFlag ( void );
81+
7682 ioSetFullScreen (getFullScreenFlag ());
7783
7884}
@@ -89,6 +95,8 @@ - (void) makeMainWindowOnMainThread {};
8995
9096- (id ) createPossibleWindow { return NULL ;};
9197
98+ - (void ) placeMainWindowOnLargerScreenWidth : (sqInt) width height : (sqInt) height {};
99+
92100- (void ) workerThreadStart {
93101 // Run the squeak process in a worker thread
94102 squeakThread = [[NSThread alloc ] initWithTarget: self .squeakApplication
Original file line number Diff line number Diff line change @@ -171,6 +171,16 @@ - (id) createPossibleWindow {
171171 return [self window ];
172172}
173173
174+ - (void ) placeMainWindowOnLargerScreenGivenWidth : (sqInt) width height : (sqInt) height {
175+ for (NSScreen *screen in [NSScreen screens ]) {
176+ CGSize screenSize = screen.visibleFrame .size ;
177+ if ((height <= screenSize.height ) && (width <= screenSize.width )) {
178+ self.window .frameOrigin = screen.visibleFrame .origin ;
179+ break ;
180+ }
181+ }
182+ }
183+
174184- (BOOL )application : (NSApplication *)theApplication openFile : (NSString *)fileName {
175185 if (self.checkForFileNameOnFirstParm == YES ) {
176186 self.checkForFileNameOnFirstParm = NO ;
You can’t perform that action at this time.
0 commit comments