fix program not closed after hit close button

This commit is contained in:
aynakeya
2025-06-15 00:29:16 +08:00
parent dd71c3b9ba
commit c7b70740f6
2 changed files with 5 additions and 1 deletions

View File

@@ -35,7 +35,6 @@ func Initialize() {
logger = global.Logger.WithPrefix("GUI")
black_magic()
logger.Info("Initializing GUI")
_ = os.Setenv("FYNE_FONT", config.GetAssetPath("msyha.ttc"))
if !config.General.UseSystemFonts {
_ = os.Setenv("FYNE_FONT", config.GetAssetPath("msyh.ttc"))
}
@@ -71,6 +70,7 @@ func Initialize() {
MainWindow.Resize(fyne.NewSize(config.General.Width, config.General.Height))
// todo: fix, window were created even if not show. this block gui from closing
// i can't create sub window before the main window shows.
// setupPlayerWindow()
// register error
@@ -99,6 +99,7 @@ func Initialize() {
MainWindow.SetOnClosed(func() {
logger.Infof("GUI closing")
if playerWindow != nil {
logger.Infof("player window closing")
playerWindow.Close()
}
})

View File

@@ -17,6 +17,9 @@ func setupPlayerWindow() {
}
func showPlayerWindow() {
if playerWindow == nil {
setupPlayerWindow()
}
playerWindow.Show()
if playerWindowHandle == 0 {
playerWindowHandle = xfyne.GetWindowHandle(playerWindow)