Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/gui/macOS/trayaccountpopup/ncaccountactionspopup.mm
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ - (void)resizeToFitPreservingTopEdge:(BOOL)preserveTopEdge topEdge:(CGFloat)topE
}
auto screen = self.screen;
if (!screen) {
screen = NSScreen.mainScreen ?: NSScreen.screens.firstObject;
NSScreen *const mainScreen = NSScreen.mainScreen;
screen = mainScreen ? mainScreen : NSScreen.screens.firstObject;
Comment on lines -210 to +211

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we repeat this a lot, maybe it would be worth just having a small util function to avoid writing lots of

NSScreen *const mainScreen = NSScreen.mainScreen;
screen = mainScreen ? mainScreen : NSScreen.screens.firstObject;

}
if (screen) {
frame.origin = clampedPopupOrigin(frame.origin, frame.size, screen.visibleFrame);
Expand Down
6 changes: 4 additions & 2 deletions src/gui/macOS/trayaccountpopup/trayaccountpopup_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
static NSScreen *nsScreenForQtScreen(QScreen *qtScreen)
{
if (!qtScreen) {
return NSScreen.mainScreen ?: NSScreen.screens.firstObject;
NSScreen *const mainScreen = NSScreen.mainScreen;
return mainScreen ? mainScreen : NSScreen.screens.firstObject;
}

const auto qtScreenName = qtScreen->name().toNSString();
Expand All @@ -36,7 +37,8 @@
return [NSScreen.screens objectAtIndex:screenIndex];
}

return NSScreen.mainScreen ?: NSScreen.screens.firstObject;
NSScreen *const mainScreen = NSScreen.mainScreen;
return mainScreen ? mainScreen : NSScreen.screens.firstObject;
}

namespace OCC {
Expand Down
2 changes: 1 addition & 1 deletion src/gui/systray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void Systray::showWindow(WindowPosition position)
showActivitiesWindow();
}

void Systray::showTrayPopup(WindowPosition position)
void Systray::showTrayPopup([[maybe_unused]] WindowPosition position)
{
if (isOpen()) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/systray.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public slots:
void destroyDialog(QQuickWindow *window) const;

void showWindow(OCC::Systray::WindowPosition position = OCC::Systray::WindowPosition::Default);
void showTrayPopup(OCC::Systray::WindowPosition position = OCC::Systray::WindowPosition::Default);
void showTrayPopup([[maybe_unused]] OCC::Systray::WindowPosition position = OCC::Systray::WindowPosition::Default);
void hideWindow();
void showQMLWindow();
void showActivitiesWindow(int userIndex = -1);
Expand Down
Loading