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

Window not shown when SetFixedSize is used without Resize #2784

Closed
kheyse-oqton opened this issue Feb 15, 2022 · 13 comments
Closed

Window not shown when SetFixedSize is used without Resize #2784

kheyse-oqton opened this issue Feb 15, 2022 · 13 comments
Assignees
Labels
blocker Items that would block a forthcoming release bug Something isn't working

Comments

@kheyse-oqton
Copy link

Describe the bug:

Window not shown when SetFixedSize is used without Resize.
Adding a call to Resize shows the window.

Seems to be a regression since 2.0.x

Discussion on https://gophers.slack.com/archives/CB4QUBXGQ/p1644939596121299

Example code:

package main

import (
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Hello")

	hello := widget.NewLabel("Hello Fyne!")
	w.SetContent(container.NewVBox(
		hello,
		widget.NewButton("Hi!", func() {
			hello.SetText("Welcome :)")
		}),
	))
	w.SetFixedSize(true)

	w.ShowAndRun()
}

Device (please complete the following information):

  • OS: Mac os
  • Version: 12.2.1 on an M1
  • Go version: 1.17.6
  • Fyne version: 2.1.2
@kheyse-oqton kheyse-oqton added the unverified A bug that has been reported but not verified label Feb 15, 2022
@andydotxyz
Copy link
Member

Not showing may be macOS specific, but similarly there are errors on Linux, as shown:

> go run .                                                                                                                                                                                          ~/Code/Fyne/defyne git:main@8aaec13
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  12 (X_ConfigureWindow)
  Value in failed request:  0x0
  Serial number of failed request:  274
  Current serial number in output stream:  284
exit status 1

Overall it seems we missed FixedSize with no Resize call in our window refactor tests...

@andydotxyz andydotxyz added blocker Items that would block a forthcoming release bug Something isn't working and removed unverified A bug that has been reported but not verified labels Feb 15, 2022
@andydotxyz andydotxyz added this to the Fixes (v2.1.x) milestone Feb 15, 2022
@kheyse-oqton
Copy link
Author

I missed this in my original ticket, but on mac there is no error nor any log output. The ShowAndRun() function just "blocks" like it normally would, and returns when you quit the app. So no crash at all.

@andydotxyz
Copy link
Member

Thanks, #2794 should fix it, if you could test that would be helpful as I only have a Linux computer to hand just now.

@kheyse-oqton
Copy link
Author

I'd like to test it, but could you help we with how i set up my application to use this specific branch of the fyne library?

@andydotxyz
Copy link
Member

Usually a replace directive in your go.mod is easiest if you are testing with your own app.
I’ll try to dig out the exact format.

@andydotxyz andydotxyz self-assigned this Feb 17, 2022
@andydotxyz
Copy link
Member

It's now on the release/v2.1.x branch for testing, so you can just use version 0d0e999 to test it.

@kheyse-oqton
Copy link
Author

sorry i'm really not familiar with how to do this.
I tried go get github.com/fyne-io/fyne@0d0e999 but received invalid version: go.mod has post-v1 module path "fyne.io/fyne/v2" at revision 0d0e9995c778

@Jacalz
Copy link
Member

Jacalz commented Feb 18, 2022

I think go get fyne.io/fyne/v2@0d0e999 should do the job for you.

@kheyse-oqton
Copy link
Author

This gives:

go get: github.com/fyne-io/fyne/v2@v2.1.2-rc2.0.20220218010450-0d0e9995c778: parsing go.mod:
	module declares its path as: fyne.io/fyne/v2
	        but was required as: github.com/fyne-io/fyne/v2

@Jacalz
Copy link
Member

Jacalz commented Feb 18, 2022

Ah, I see. I was a bit too fast with the copy-paste. You should never use github.com for Fyne. Always fyne.io, hence use go get fyne.io/fyne/v2@0d0e999 instead.

@kheyse-oqton
Copy link
Author

That works thanks!
Indeed the window is visible now.
But I got a new problem with the window not adapting to the size of an Image i show in it

	header := canvas.NewImageFromResource(resourceHeaderSvg)
	header.FillMode = canvas.ImageFillOriginal

Screenshot 2022-02-18 at 11 12 08

instead of

Screenshot 2022-02-18 at 11 12 36

This problem only occurs with SetFixedSize(true)

Do you want me to report this as a new problem or not?

@andydotxyz
Copy link
Member

Thanks for the report @kheyse-oqton, there is a complication with "ImageFillOriginal" that means Minimum size is not known fast enough. I think this probably requires a new issue as it is due to the MinSize increasing after first draw, so a more complicated solution will be required.

@kheyse-oqton
Copy link
Author

New ticket #2800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Items that would block a forthcoming release bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants