Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 1024x576 as an intermediate GUI resolution for smaller screens #3811

Merged
merged 1 commit into from
Dec 4, 2024
Merged
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
10 changes: 6 additions & 4 deletions src/client/gui/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ void main() async {
return screen?.frame.size;
});

final windowSize = (screenSize != null &&
screenSize.width >= 1600 &&
screenSize.height >= 900)
final windowSize = (screenSize != null)
? (screenSize.width >= 1600 && screenSize.height >= 900)
? const Size(1400, 822) // For screens 1600x900 or larger
: const Size(750, 450); // Default window size
: (screenSize.width >= 1280 && screenSize.height >= 720)
? const Size(1024, 576) // For screens 1280x720 or larger
: const Size(750, 450) // Default window size
: const Size(750, 450); // Default window size if screenSize is null
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does it mean if it is null? Should we fallback to the default or middle resolution in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If screenSize is null it means that the plugin cannot get the current screen resolution for some reason. Falling back to the minimum resolution is probably safest if this happens

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why though? Isn't it safer to make a compromise?

Copy link
Contributor Author

@levkropp levkropp Dec 4, 2024

Choose a reason for hiding this comment

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

I can't think of any situations where serving a larger resolution (when you don't know the size of the screen) is safer than serving the minimum resolution

Copy link
Collaborator

@ricab ricab Dec 4, 2024

Choose a reason for hiding this comment

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

Safety is perhaps not the best concept here, but when "the plugin cannot get the current screen resolution for some reason", the most reasonable expectation is still that the user either doesn't have graphics at all, or they have 720p or higher (since most screens today have that). OTOH, the smallest size is our least preferred.

We can deal with this better later.


await windowManager.ensureInitialized();

Expand Down
Loading