]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
当gtk全部关闭时停止应用
authorqydysky <qydysky@foxmail.com>
Tue, 29 Dec 2020 14:48:00 +0000 (22:48 +0800)
committerqydysky <qydysky@foxmail.com>
Tue, 29 Dec 2020 14:48:00 +0000 (22:48 +0800)
Reply/gtk.go
bili_danmu.go

index 1287efc0d90cf428ce6a468993331e7a8225bca6..837e6ada47ba1c319e8f2b893dfbb50b72d5b883 100644 (file)
@@ -353,7 +353,7 @@ func Gtk_danmu() {
                                        grid0.InsertRow(loc);
                                        grid0.Attach(tmp_list.img, 0, loc, 1, 1)
                                        grid0.Attach(tmp_list.text, 1, loc, 1, 1)
-                                       win.ShowAll()
+                                       if Gtk_on {win.ShowAll()}
                                        return
                                }
                                /*
@@ -397,7 +397,7 @@ func Gtk_danmu() {
                                // grid0.Attach(tmp_list1.text, 1, loc, 1, 1)
                        }
 
-                       win.ShowAll()
+                       if Gtk_on {win.ShowAll()}
                }
 
                //先展示弹幕信息窗
@@ -570,6 +570,7 @@ func Gtk_danmu() {
        application.Connect("shutdown", func() {
                log.Println("application shutdown")     
                Gtk_on = false
+               c.Danmu_Main_mq.Push_tag(`gtk_close`,nil)
        })
 
        application.Run(nil)
index 987e385b371a63b1fb107fc499c39c1fce0e6a25..a110772bd1f8bc5e92dfca0e1fd56b4449bdc15b 100644 (file)
@@ -79,6 +79,10 @@ func Demo(roomid ...int) {
                                }
                                return false
                        },
+                       `gtk_close`:func(data interface{})(bool){//gtk关闭信号
+                               interrupt <- os.Interrupt
+                               return false
+                       },
                })
 
                <-change_room_chan