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

[bug] Broken app scaling with Windows' display scaling above 100% #745

Open
mikigal opened this issue Dec 29, 2023 · 2 comments
Open

[bug] Broken app scaling with Windows' display scaling above 100% #745

mikigal opened this issue Dec 29, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@mikigal
Copy link

mikigal commented Dec 29, 2023

What happend?

When I set display scale in Windows above 100% my app does not scale corretly - window is bigger, but it's content (widgets, fonts, SplitLayouts) does not scale with window size.

scaling_100
scaling_125

Code example

Ful code of GUI: https://github.com/mikigal/Anime4K-GUI/blob/master/gui.go

main.go
g.SingleWindow().Layout(
		g.SplitLayout(g.DirectionVertical, 580,
			g.SplitLayout(g.DirectionHorizontal, 1200,
				g.Layout{
					g.Table().Flags(g.TableFlagsResizable).Rows(buildTableRows()...).Columns(buildTableColumns()...),
					g.Custom(func() {
						if len(animeList) == 0 {
							g.Label("\n\n\n\n\n\n\n                                              Drag n' Drop your anime here").Font(g.AddFont("Arial", 35)).Build()
						}
					}),
				},
				g.Layout{
					g.Label("Settings"),
					g.Label(""),

					g.Label("Target resolution"),
					g.Combo("", resolutionsNames[settings.Resolution], resolutionsNames, &settings.Resolution).Size(400),
					g.Label(""),

					g.Label("Shaders mode"),
					g.Tooltip("Check the project's GitHub page if you're not sure what to choose"),
					g.Combo("", shaders[settings.Shaders].Name, shadersNames, &settings.Shaders).Size(400),
					g.Tooltip("Check the project's GitHub page if you're not sure what to choose"),
					g.Label(""),

					g.Label("Encoder"),
					g.Tooltip("Codec for encoding output file. In most cases GPU based are faster, use CPU mainly if you have slow GPU\n" +
						"AV1 is compatible only with RTX 4000+ and RX 6500XT+"),
					g.Combo("", availableEncoders[settings.Encoder].Name, availableEncodersNames, &settings.Encoder).Size(400),
					g.Tooltip("Codec for encoding output file. In most cases GPU based are faster, use CPU mainly if you have slow GPU\n" +
						"GPU based AV1 is compatible only with RTX 4000+ and RX 6500XT+"),
					g.Label(""),

					g.Label("Output format"),
					g.Combo("", outputFormats[settings.OutputFormat], outputFormats, &settings.OutputFormat).Size(400),
					g.Label(""),

					g.Checkbox("Compatibility mode", &settings.CompatibilityMode),
					g.Tooltip("Should be used only for compatibility troubleshooting, disables most of features"),

					g.Checkbox("Debug mode", &settings.DebugMode),
					g.Tooltip("Show more detailed logs, useful for troubleshooting and debugging"),

					g.Label(""),

					g.Button(buttonLabel).OnClick(handleButton).Size(360, 30),
				},
			),
			g.Layout{
				g.Label("Logs"),
				g.InputTextMultiline(&logs).Flags(g.InputTextFlagsReadOnly).Size(1600, 270),
				g.SplitLayout(g.DirectionHorizontal, 1310,
					g.SplitLayout(g.DirectionHorizontal, 120,
						g.Label("Progress: "+totalProgress),
						g.ProgressBar(progress).Overlay(progressLabel).Size(1170, 20),
					),
					g.SplitLayout(g.DirectionHorizontal, 110,
						g.Label(currentSpeed),
						g.Label(eta),
					),
				),
			},
		),
	)

To Reproduce

  1. Set Windows display scale to 125%
  2. Run above code or my app (https://github.com/mikigal/Anime4K-GUI/releases)

Version

master

OS

Windows 11 23H2

@mikigal mikigal added the bug Something isn't working label Dec 29, 2023
@mikigal mikigal changed the title [bug] Scaling of SplitLayout [bug] Broken app scaling with Windows' display scaling above 100% Dec 29, 2023
@gucio321 gucio321 added the help wanted Extra attention is needed label Feb 4, 2024
@0xkalle
Copy link

0xkalle commented Feb 9, 2024

@mikigal did you try it on 150% yet? The behaviour is not the same. I also read, that on 125% windows API may return a faulty scale, so maybe that is influencing it in the background. See: https://stackoverflow.com/questions/70340316/how-to-get-monitor-resolution-independent-of-scaling (that somment: https://stackoverflow.com/questions/70340316/how-to-get-monitor-resolution-independent-of-scaling#comment124345342_70340316 )

@mikigal
Copy link
Author

mikigal commented Mar 21, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants