@@ -16,6 +16,7 @@ type config struct {
16
16
windowInitializerDeprecated func (* glfw.Window ) error
17
17
windowIconProvider func () ([]image.Image , error )
18
18
windowInitialDimensions windowDimensions
19
+ windowInitialLocations windowLocations
19
20
windowDimensionLimits windowDimensionLimits
20
21
windowMode windowMode
21
22
@@ -30,6 +31,11 @@ type windowDimensions struct {
30
31
height int
31
32
}
32
33
34
+ type windowLocations struct {
35
+ xpos int
36
+ ypos int
37
+ }
38
+
33
39
type windowDimensionLimits struct {
34
40
minWidth int
35
41
minHeight int
@@ -118,6 +124,25 @@ func WindowInitialDimensions(width, height int) Option {
118
124
}
119
125
}
120
126
127
+ // WindowInitialLocations specify the startup's position of the window.
128
+ // Location, in screen coordinates, of the upper-left corner of the client area
129
+ // of the window.
130
+ func WindowInitialLocations (xpos , ypos int ) Option {
131
+ if xpos < 1 {
132
+ fmt .Println ("go-flutter: invalid initial value for xpos location, must be 1 or greater." )
133
+ os .Exit (1 )
134
+ }
135
+ if ypos < 1 {
136
+ fmt .Println ("go-flutter: invalid initial value for ypos location, must be 1 or greater." )
137
+ os .Exit (1 )
138
+ }
139
+
140
+ return func (c * config ) {
141
+ c .windowInitialLocations .xpos = xpos
142
+ c .windowInitialLocations .ypos = ypos
143
+ }
144
+ }
145
+
121
146
// WindowDimensionLimits specify the dimension limits of the window.
122
147
// Does not work when the window is fullscreen or not resizable.
123
148
func WindowDimensionLimits (minWidth , minHeight , maxWidth , maxHeight int ) Option {
0 commit comments