Closed akiradk closed 3 months ago
I had a user test this on Ubuntu 22.04 and their response was:
did the "open 10 times" test - 8 times the window was fine, 9th time it had the rendering problem
Is this actually more reliable for you than the initial workaround, since it seems to be pretty much doing the same thing? Maybe we need to try a larger size difference when we subtract down the desired size, like 4 pixels?
I had a user test this on Ubuntu 22.04 and their response was:
did the "open 10 times" test - 8 times the window was fine, 9th time it had the rendering problem
Is this actually more reliable for you than the initial workaround, since it seems to be pretty much doing the same thing? Maybe we need to try a larger size difference when we subtract down the desired size, like 4 pixels?
Hmmmm well i think that would just push the issue in front of us 🤔 since the loop brakes on 5 tries if the window is not within delta at that point something else is keeping it from getting there 🤔
Perhaps the call to x11 is no getting trough to the daemon in some scenario 🤔 ??
Just out of interest, what desktop resolution and window size of the program was the user running? could perhaps be some strange +/- half a pixel that the system cant quite delta itself out of or something to that effect??
@akiradk Can you test this on your system and see if it works reliably? https://github.com/dweymouth/supersonic/pull/460
@akiradk Can you test this on your system and see if it works reliably? #460
@dweymouth no dice sadly, still the same issue :( but i do like the approach i must admit :)
I went and did a go install after i pulled the branch, let me know if you need me to do anything else than that to get i working like you intend :)
@akiradk If you don't mind and feel up to it, since you are setup to build from source, you could try adding a short sleep or retry logic similarly to the original workaround - I dug into Fyne code and found that the ProcessResized call is the first Fyne code invoked by the windowing system in response to the X11 resize event. So bypassing the X11 hack should be just as effective, with appropriate sleep/retries (and should hopefully work for native Wayland too)
The issue does not reproduce on my Ubuntu system, which does make it very frustrating to debug :(
@dweymouth i will give it a try tomorrow if i have the time, but what i have gotten to work is a reeeealy silly workaround 😅
I ran a script that opened a built version with this diff in it then closing it again after 3 sec and the looping over that 10 times, it worked every time for a multiple of times, think i have opened that build about 50 times or so and it worked fine every time 😃
Try it and see what you find 😃
diff --git a/main.go b/main.go
index ba54ce3..0faa941 100644
--- a/main.go
+++ b/main.go
@@ -11,6 +11,7 @@ import (
"github.com/dweymouth/supersonic/res"
"github.com/dweymouth/supersonic/ui"
+ "fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/lang"
)
@@ -62,14 +63,12 @@ func main() {
// slightly hacky workaround for https://github.com/fyne-io/fyne/issues/4964
workaroundWindowSize := sync.OnceFunc(func() {
s := mainWindow.DesiredSize()
- scale := mainWindow.Window.Canvas().Scale()
- s.Width *= scale
- s.Height *= scale
- // exported in Supersonic Fyne fork
- mainWindow.Window.ProcessResized(int(s.Width), int(s.Height))
+ mainWindow.Window.Resize(fyne.NewSize(s.Width+1,s.Height)) //+1 width
+ mainWindow.Window.Resize(fyne.NewSize(s.Width-1,s.Height)) // back to desired size
})
fyneApp.Lifecycle().SetOnEnteredForeground(func() {
workaroundWindowSize()
})
mainWindow.ShowAndRun()
At this point, really silly workarounds are great if they work! I updated the other PR #460 with this approach, plus adding sleeps because the above diff didn't seem to work on another user's system.. I'm awaiting testing results from them but we'll see...
Adding sleeps between the resizes in your diff above worked for the other user too, so I think we're good for now!
Pull request for issue https://github.com/dweymouth/supersonic/issues/452
The idea is to go ahead and just do the resizing if the delta is not returning true.
You can see when the app open that the ui scales to fit the window, but its a small price to pay for it to fit correctly at startup :)
Hope i did the PR correctly, first time doing a PR :P