Skip to content

Commit 4f08e1e

Browse files
committed
feat: rollback the way to set CENTER. (doesn't work on Wayland)
1 parent e548e52 commit 4f08e1e

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

main.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ func setupWindow(title string) *gtk.Window {
5353
win.SetTitle(title)
5454
win.SetDecorated(false)
5555
win.SetDefaultSize(windowWidth, windowHeight)
56+
win.SetPosition(gtk.WIN_POS_CENTER)
5657
win.Connect("destroy", func() {
5758
gtk.MainQuit()
5859
})
5960
win.Connect("focus-out-event", func(widget *gtk.Window, event *gdk.Event) bool {
6061
gtk.MainQuit()
6162
return false // Continue with the default behavior
6263
})
63-
moveWinToCenter(win, windowWidth, windowHeight)
6464

6565
// vertical button box
6666
mainBox, err := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 2)
@@ -124,18 +124,6 @@ func setupWindow(title string) *gtk.Window {
124124
return win
125125
}
126126

127-
func moveWinToCenter(win *gtk.Window, width int, height int) {
128-
screen, _ := gdk.ScreenGetDefault()
129-
display, _ := screen.GetDisplay()
130-
monitor, _ := display.GetPrimaryMonitor()
131-
screenWidth := monitor.GetGeometry().GetWidth()
132-
screenHeight := monitor.GetGeometry().GetHeight()
133-
134-
posX := (screenWidth - width) / 2
135-
posY := (screenHeight - height) / 2
136-
win.Move(posX, posY)
137-
}
138-
139127
func getProfiles(profilesIniPath string) []string {
140128
profilesCfg, err := ini.Load(profilesIniPath)
141129
if err != nil {

0 commit comments

Comments
 (0)