Skip to content

Commit

Permalink
fix bug with slideshow window size when changing from window to fulls…
Browse files Browse the repository at this point in the history
…creen on a screen different from the main window
  • Loading branch information
gobbledegook committed Dec 14, 2023
1 parent 6725292 commit abd581c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions SlideshowWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ - (void)setFullscreenMode:(BOOL)b {
if (b) {
self.styleMask = NSWindowStyleMaskBorderless;
self.collectionBehavior = NSWindowCollectionBehaviorTransient|NSWindowCollectionBehaviorParticipatesInCycle|NSWindowCollectionBehaviorFullScreenNone;
if (self.visible)
[self configureScreen];
} else {
self.styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable;
self.collectionBehavior = NSWindowCollectionBehaviorParticipatesInCycle|NSWindowCollectionBehaviorFullScreenNone;
Expand Down Expand Up @@ -222,16 +224,16 @@ - (NSString *)currentShortFilename {

- (void)configureScreen
{
NSScreen *mainScreen = [NSScreen mainScreen];
NSRect screenRect = mainScreen.frame;
NSScreen *myScreen = self.visible ? self.screen : NSScreen.mainScreen;
NSRect screenRect = myScreen.frame;
NSRect boundingRect = screenRect;
if (@available(macOS 12.0, *)) {
CGFloat inset = mainScreen.safeAreaInsets.top;
CGFloat inset = myScreen.safeAreaInsets.top;
if (inset) {
boundingRect.size.height -= inset;
}
}
oldScreen = mainScreen;
oldScreen = myScreen;
NSSize oldSize = imgCache.boundingSize;
if (oldSize.width < boundingRect.size.width
|| oldSize.height < boundingRect.size.height) {
Expand Down

0 comments on commit abd581c

Please sign in to comment.