Hey, can you add the window's default start position to the screen center in the flutter.WindowInitialLocation function?
I know that InitPluginGLFW is used to gain control over the glfw.Window
I'm not sure if initial location is something that we should force, or is something that maybe the systems' window manager should manage (keeping track of where it was last time). In any case, this could be something for a plugin, yes.
I'm not sure if initial location is something that we should force, or is something that maybe the systems' window manager should manage (keeping track of where it was last time). In any case, this could be something for a plugin, yes.
ok锛孴hank you
If you make such a plugin, please let us know, we could add it to the list of interesting plugins in go-flutter-desktop/plugins.
If you make such a plugin, please let us know, we could add it to the list of interesting plugins in go-flutter-desktop/plugins.
Hmm锛宯o problem
This can be implemented without the use of a plugin.
Tips-and-tricks 2. Set the initial window dimension based on screen resolution
Ref: #267
This can be implemented without the use of a plugin.
Tips-and-tricks 2. Set the initial window dimension based on screen resolution
This solution is better, thanks
Just in case anyone is looking for a quick way to use the above to have a specific initial window size but start the window center of the screen, you can use the following.
package main
// the file window-position-based-on-screen-size.go is used to set the initial
// location of the window regardless of screen resolution.
//
// The following example sets the window to the center of the screen
import (
flutter "github.com/go-flutter-desktop/go-flutter"
"github.com/go-gl/glfw/v3.3/glfw"
)
const windowHeight = 430
const windowWidth = 800
func init() {
// Notice: Code in init() delays first frame!
// Not best practice, you should let go-flutter make this call.
err := glfw.Init()
if err != nil {
panic(err)
}
vidMoce := glfw.GetPrimaryMonitor().GetVideoMode()
options = append(options,
flutter.WindowInitialDimensions(
windowWidth,
windowHeight,
))
options = append(options,
flutter.WindowInitialLocation((vidMoce.Width/2)-(windowWidth/2), (vidMoce.Height/2)-(windowHeight/2)),
)
}
@MostHated Thank you for your contribution
Most helpful comment
Just in case anyone is looking for a quick way to use the above to have a specific initial window size but start the window center of the screen, you can use the following.