From 6a360f51012db5eb7c6a72436f4387100a5c658c Mon Sep 17 00:00:00 2001 From: cuu Date: Tue, 24 Jan 2023 14:47:42 +0800 Subject: [PATCH] Revert "fix" This reverts commit ed2454ea646d4cbcfacc763590aeb40b328a4e09. --- Menu/GameShell/10_Settings/About/about.go | 3 +- .../10_Settings/Airplane/plugin_init.go | 3 +- .../10_Settings/Bluetooth/plugin_init.go | 3 +- .../10_Settings/Brightness/plugin_init.go | 3 +- .../10_Settings/ButtonsLayout/plugin_init.go | 3 +- .../10_Settings/GateWay/plugin_init.go | 3 +- .../10_Settings/Languages/plugin_init.go | 3 +- .../GameShell/10_Settings/Lima/plugin_init.go | 3 +- .../10_Settings/PowerOFF/plugin_init.go | 3 +- .../10_Settings/PowerOptions/plugin_init.go | 3 +- Menu/GameShell/10_Settings/Settings.go | 3 +- .../10_Settings/Sound/plugin_init.go | 3 +- .../10_Settings/Storage/plugin_init.go | 3 +- .../10_Settings/TimeZone/plugin_init.go | 3 +- .../10_Settings/Update/plugin_init.go | 3 +- .../GameShell/10_Settings/Wifi/plugin_init.go | 6 +- Menu/GameShell/10_Settings/Wifi/wifi.go | 21 ++++-- Menu/GameShell/21_Warehouse/plugin_init.go | 3 +- Menu/GameShell/97_MusicPlayer/plugin_init.go | 3 +- Menu/GameShell/98_TinyCloud/plugin_init.go | 3 +- Menu/GameShell/99_PowerOFF/plugin_init.go | 3 +- main.go | 10 ++- .../gameshell/titlebar_icons/battery.png | Bin 1274 -> 0 bytes sysgo/UI/Emulator/emulator.go | 3 +- sysgo/UI/UI.go | 10 +-- sysgo/UI/fullscreen.go | 2 +- sysgo/UI/main_screen.go | 4 +- sysgo/UI/title_bar.go | 64 ++++++++---------- sysgo/UI/util_funcs.go | 7 +- 29 files changed, 104 insertions(+), 80 deletions(-) delete mode 100644 skin/default/sysgo/gameshell/titlebar_icons/battery.png diff --git a/Menu/GameShell/10_Settings/About/about.go b/Menu/GameShell/10_Settings/About/about.go index c0e5469..597f7c7 100644 --- a/Menu/GameShell/10_Settings/About/about.go +++ b/Menu/GameShell/10_Settings/About/about.go @@ -414,7 +414,8 @@ func (self *AboutPlugin) Init(main_screen *UI.MainScreen) { func (self *AboutPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushPage(self.Page) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Airplane/plugin_init.go b/Menu/GameShell/10_Settings/Airplane/plugin_init.go index d2981ea..31d006f 100644 --- a/Menu/GameShell/10_Settings/Airplane/plugin_init.go +++ b/Menu/GameShell/10_Settings/Airplane/plugin_init.go @@ -30,7 +30,8 @@ func (self *AirplanePlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.AirplanePage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Bluetooth/plugin_init.go b/Menu/GameShell/10_Settings/Bluetooth/plugin_init.go index 6fedc2f..a9e89c3 100644 --- a/Menu/GameShell/10_Settings/Bluetooth/plugin_init.go +++ b/Menu/GameShell/10_Settings/Bluetooth/plugin_init.go @@ -121,7 +121,8 @@ func (self *BluetoothPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.BluetoothPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Brightness/plugin_init.go b/Menu/GameShell/10_Settings/Brightness/plugin_init.go index 53ca21d..5c47552 100644 --- a/Menu/GameShell/10_Settings/Brightness/plugin_init.go +++ b/Menu/GameShell/10_Settings/Brightness/plugin_init.go @@ -33,7 +33,8 @@ func (self *BrightnessPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.BrightnessPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/ButtonsLayout/plugin_init.go b/Menu/GameShell/10_Settings/ButtonsLayout/plugin_init.go index 4fe3aed..4ec217a 100644 --- a/Menu/GameShell/10_Settings/ButtonsLayout/plugin_init.go +++ b/Menu/GameShell/10_Settings/ButtonsLayout/plugin_init.go @@ -30,7 +30,8 @@ func (self *ButtonsLayoutPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.ButtonsLayoutPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/GateWay/plugin_init.go b/Menu/GameShell/10_Settings/GateWay/plugin_init.go index 3efc93b..8ee9cc0 100644 --- a/Menu/GameShell/10_Settings/GateWay/plugin_init.go +++ b/Menu/GameShell/10_Settings/GateWay/plugin_init.go @@ -30,7 +30,8 @@ func (self *GatewayPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.Page1st) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Languages/plugin_init.go b/Menu/GameShell/10_Settings/Languages/plugin_init.go index a92baaa..1099e42 100644 --- a/Menu/GameShell/10_Settings/Languages/plugin_init.go +++ b/Menu/GameShell/10_Settings/Languages/plugin_init.go @@ -30,7 +30,8 @@ func (self *LanguagesPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.LanguagesPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Lima/plugin_init.go b/Menu/GameShell/10_Settings/Lima/plugin_init.go index 8055ac6..d33f2f5 100644 --- a/Menu/GameShell/10_Settings/Lima/plugin_init.go +++ b/Menu/GameShell/10_Settings/Lima/plugin_init.go @@ -30,7 +30,8 @@ func (self *LimaPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.GPUDriverPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/PowerOFF/plugin_init.go b/Menu/GameShell/10_Settings/PowerOFF/plugin_init.go index 6f95534..8c60de1 100644 --- a/Menu/GameShell/10_Settings/PowerOFF/plugin_init.go +++ b/Menu/GameShell/10_Settings/PowerOFF/plugin_init.go @@ -30,7 +30,8 @@ func (self *PowerOFFPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.PowerOFFPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/PowerOptions/plugin_init.go b/Menu/GameShell/10_Settings/PowerOptions/plugin_init.go index 45593b9..2223ebc 100644 --- a/Menu/GameShell/10_Settings/PowerOptions/plugin_init.go +++ b/Menu/GameShell/10_Settings/PowerOptions/plugin_init.go @@ -30,7 +30,8 @@ func (self *PowerOptionsPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.PowerOptionsPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Settings.go b/Menu/GameShell/10_Settings/Settings.go index 911429e..b99bbaf 100644 --- a/Menu/GameShell/10_Settings/Settings.go +++ b/Menu/GameShell/10_Settings/Settings.go @@ -307,7 +307,8 @@ func (self *SettingsPlugin) Init(main_screen *UI.MainScreen) { func (self *SettingsPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushPage(self.Page) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Sound/plugin_init.go b/Menu/GameShell/10_Settings/Sound/plugin_init.go index fd9a173..a462459 100644 --- a/Menu/GameShell/10_Settings/Sound/plugin_init.go +++ b/Menu/GameShell/10_Settings/Sound/plugin_init.go @@ -34,7 +34,8 @@ func (self *SoundPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.SoundPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Storage/plugin_init.go b/Menu/GameShell/10_Settings/Storage/plugin_init.go index cc4cdbe..bec9469 100644 --- a/Menu/GameShell/10_Settings/Storage/plugin_init.go +++ b/Menu/GameShell/10_Settings/Storage/plugin_init.go @@ -29,7 +29,8 @@ func (self *StoragePlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.StoragePage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/TimeZone/plugin_init.go b/Menu/GameShell/10_Settings/TimeZone/plugin_init.go index 8c5f97a..620f25f 100644 --- a/Menu/GameShell/10_Settings/TimeZone/plugin_init.go +++ b/Menu/GameShell/10_Settings/TimeZone/plugin_init.go @@ -30,7 +30,8 @@ func (self *TimeZonePlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.TimeZonePage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Update/plugin_init.go b/Menu/GameShell/10_Settings/Update/plugin_init.go index 5abfdcc..8e73bb0 100644 --- a/Menu/GameShell/10_Settings/Update/plugin_init.go +++ b/Menu/GameShell/10_Settings/Update/plugin_init.go @@ -20,7 +20,8 @@ func (self *UpdatePlugin) Init(main_screen *UI.MainScreen) { func (self *UpdatePlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushPage(self.Page) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Wifi/plugin_init.go b/Menu/GameShell/10_Settings/Wifi/plugin_init.go index 2c9f5e6..6211651 100644 --- a/Menu/GameShell/10_Settings/Wifi/plugin_init.go +++ b/Menu/GameShell/10_Settings/Wifi/plugin_init.go @@ -49,8 +49,10 @@ func (self *WifiPlugin) Init(main_screen *UI.MainScreen) { func (self *WifiPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { - main_screen.PushPage(self.ScanPage) - main_screen.Refresh() + main_screen.PushCurPage() + main_screen.SetCurPage(self.ScanPage) + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/10_Settings/Wifi/wifi.go b/Menu/GameShell/10_Settings/Wifi/wifi.go index c3408e4..e13b231 100644 --- a/Menu/GameShell/10_Settings/Wifi/wifi.go +++ b/Menu/GameShell/10_Settings/Wifi/wifi.go @@ -372,6 +372,7 @@ type WifiList struct { Connecting bool Scanning bool + ShowingMessageBox bool MsgBox *WifiListMessageBox ConnectTry int @@ -401,7 +402,14 @@ func NewWifiList() *WifiList { func (self *WifiList) ShowBox(msg string) { self.MsgBox.Text = msg - self.Screen.ShowMsg(msg,1) + self.ShowingMessageBox = true + self.Screen.ShowMsg(msg,0) +} + +func (self *WifiList) HideBox() { + self.Draw() + self.ShowingMessageBox = false + self.Screen.SwapAndShow() } func (self *WifiList) GenNetworkList() { @@ -444,7 +452,7 @@ func (self *WifiList) GenNetworkList() { li_idx++ } } - + self.WifiScanFinished() self.PsIndex = 0 @@ -487,7 +495,9 @@ func (self *WifiList) WifiScanFinished() { self.ResetPageSelector() self.Scanning = false + self.HideBox() + self.BlockingUI = false fmt.Println("dbus says scan finished") } @@ -498,7 +508,8 @@ func (self *WifiList) WifiScanStarted() { } self.Scanning = true - self.ShowBox("Wifi scanning") + self.ShowBox("Wifi scanning...") + self.BlockingUI = true fmt.Println("dbus says start scan") } @@ -591,7 +602,7 @@ func (self *WifiList) ConfigWireless(password string) { ssid := self.MyList[self.PsIndex].Essid fmt.Println(ssid) fmt.Println(password) - self.ShowBox("Connecting") + self.ShowBox("Connecting...") self.Connecting = true cli := fmt.Sprintf("sudo nmcli dev wifi connect %s password \"%s\"", ssid, password) @@ -663,6 +674,7 @@ func (self *WifiList) ScrollDown() { } func (self *WifiList) AbortedAndReturnToUpLevel() { + self.HideBox() self.Screen.FootBar.ResetNavText() self.ReturnToUpLevelPage() @@ -727,7 +739,6 @@ func (self *WifiList) KeyDown(ev *event.Event) { if ev.Data["Key"] == UI.CurKeys["X"] { self.Rescan(false) - self.Screen.Refresh() } if ev.Data["Key"] == UI.CurKeys["Y"] { diff --git a/Menu/GameShell/21_Warehouse/plugin_init.go b/Menu/GameShell/21_Warehouse/plugin_init.go index 524e6bc..2863288 100644 --- a/Menu/GameShell/21_Warehouse/plugin_init.go +++ b/Menu/GameShell/21_Warehouse/plugin_init.go @@ -32,7 +32,8 @@ func (self *WareHousePlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.MainPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/97_MusicPlayer/plugin_init.go b/Menu/GameShell/97_MusicPlayer/plugin_init.go index f8cce2c..444b93f 100644 --- a/Menu/GameShell/97_MusicPlayer/plugin_init.go +++ b/Menu/GameShell/97_MusicPlayer/plugin_init.go @@ -35,7 +35,8 @@ func (self *MusicPlayerPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.MusicPlayerPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/98_TinyCloud/plugin_init.go b/Menu/GameShell/98_TinyCloud/plugin_init.go index d72d36c..c5c9d2f 100644 --- a/Menu/GameShell/98_TinyCloud/plugin_init.go +++ b/Menu/GameShell/98_TinyCloud/plugin_init.go @@ -30,7 +30,8 @@ func (self *TinyCloudPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.MainPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/Menu/GameShell/99_PowerOFF/plugin_init.go b/Menu/GameShell/99_PowerOFF/plugin_init.go index 6f95534..8c60de1 100644 --- a/Menu/GameShell/99_PowerOFF/plugin_init.go +++ b/Menu/GameShell/99_PowerOFF/plugin_init.go @@ -30,7 +30,8 @@ func (self *PowerOFFPlugin) Run(main_screen *UI.MainScreen) { if main_screen != nil { main_screen.PushCurPage() main_screen.SetCurPage(self.PowerOFFPage) - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() } } diff --git a/main.go b/main.go index 99b0b10..1c4fd3e 100644 --- a/main.go +++ b/main.go @@ -122,7 +122,8 @@ func RestoreLastBackLightBrightness(main_screen *UI.MainScreen) bool { if main_screen.CounterScreen.Counting == true { main_screen.CounterScreen.StopCounter() - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() return false } @@ -220,7 +221,7 @@ func AutoRedraw(main_screen *UI.MainScreen) { for { if main_screen.TitleBar.InLowBackLight < 0 { - UI.DisplayFlip() + UI.SwapAndShow() } gotime.Sleep(650 * gotime.Millisecond) } @@ -323,7 +324,10 @@ func run() int { sound_patch.Parent = main_screen sound_patch.Init() - main_screen.Refresh() + main_screen.Draw() + main_screen.SwapAndShow() + + UI.SwapAndShow() //fmt.Println(main_screen) event.AllocEvents(5) diff --git a/skin/default/sysgo/gameshell/titlebar_icons/battery.png b/skin/default/sysgo/gameshell/titlebar_icons/battery.png deleted file mode 100644 index 12cf126614395b57782b41e7bb02b0696ca875ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1274 zcmeAS@N?(olHy`uVBq!ia0vp^LJSOyVI0grR`5F8)j*0R-O<;Pfnj4m_n$;oAYUQb zBgmJ5p-PQ`p`nF=;TKS-;RORjsR0ASs{{rHs~HRo;stYd1=;`&Dh%)maRn;)|NsB` z_3Qs@YXM2h0nosq2!P(liXeWuef##jdGqGZo$KS{GhxDnl9H12^z`Y|r&m=~?b@{q z7=YKVUF+)V`u_d<*|TRqeE4wq@ZtOS?>~S3yu7^p)TvW*=F9;GEYK*R75mB_B?DPW zB|(0{Aj73jqCeBk-%K{>{K!`XGzDk~&^)l2KtnPQZ@Tz-G0+mm zByV>Y#{W#Z_kbMs5>H=O_UDWe%my5Lny()M3JD}9`jr7`VEO`MAjQDI8Xb2EsP&Jh zi(^Q{;kVbrgAX}~v^_j}uX_1SX%4eD3GP6qxl+@OsUKeV?tXmcou$%?2#+VbYxE{P zo$F)L;xfapyr`;b(PhpOHP3XWx!xtuWhx~rS$BPiW%|U<)TlkN#!*w^L*>D(2CVDz z4?JCZ+q%O2~9oI7N(WDd!ZqMc&Uf zngiWJPMvX@GM8D?oIkKG$Wc+@=^WP&QI&)oYHc@*S>t%<^fNQfziO`|8#$Tqzr) zZs&xpZdKl`v%UPprr0IdKVCVxVzP3y_}t!_x>u`i=}r(je(^GQwdJpXL*MFpLuC(y zW(OR4<>=zPVbx_*pA#LYXReTn4qcvIl5>Z(%6Gys&wxX|Cq%q%824tlJr13^{Z0@2 z-lu7@AI#64RgUrq>2*2vQhfRa{wO!j@G!x(D|fA`uD#2f;XKWpRoj*Tf-cO#k zT5a*(i`Tw=6I(F1pu&B@U4y%N?$tftOq_rBe6zH&SYj>k=mY2fciIlROV+J#h*vu; zDEs5L#O>2uliK$(+C2FjTpaq`Q1*xTw`|V;&R5^pJo%S-Rle?tNw}$=oaNcj-foNf zz^}{qGhK0t|G`zksQRX1My&L=gTUmVTH+c}l9E`GYL#4+3Zxi}42+C*4GeV+%tH(f utqcsUOpLV+46F 0 { time.BlockDelay(blocktime) - self.Refresh() + self.CurrentPage.Draw() + self.SwapAndShow() } } diff --git a/sysgo/UI/title_bar.go b/sysgo/UI/title_bar.go index 5694826..4ce9165 100644 --- a/sysgo/UI/title_bar.go +++ b/sysgo/UI/title_bar.go @@ -110,8 +110,6 @@ type TitleBar struct { TitleFont *ttf.Font TimeFont *ttf.Font - - updateScreen chan bool } func NewTitleBar() *TitleBar { @@ -138,16 +136,13 @@ func NewTitleBar() *TitleBar { t.TimeFont = Fonts["varela12"] t.InLowBackLight = -1 - - t.updateScreen = make(chan bool,1) - return t } func (self *TitleBar) Redraw() { self.UpdateDownloadStatus() - DisplayFlip() + SwapAndShow() } func (self *TitleBar) UpdateDownloadStatus() { @@ -181,7 +176,7 @@ func (self *TitleBar) RoundRobinCheck() { self.CheckBluetooth() self.UpdateWifiStrength() self.UpdateDownloadStatus() - self.Refresh() + SwapAndShow() } else if self.InLowBackLight >= 0 { self.InLowBackLight += 1 @@ -192,7 +187,6 @@ func (self *TitleBar) RoundRobinCheck() { self.UpdateWifiStrength() self.UpdateDownloadStatus() self.InLowBackLight = 0 // reset - self.Refresh() } } @@ -299,6 +293,8 @@ func (self *TitleBar) SetSoundVolume(vol int) { func (self *TitleBar) CheckBatteryStat() { bat_segs := [][]int{[]int{0, 6}, []int{7, 15}, []int{16, 20}, []int{21, 30}, []int{31, 50}, []int{51, 60}, []int{61, 80}, []int{81, 90}, []int{91, 100}} + self.Icons["battery"] = self.Icons["battery_unknown"] + if FileExists(sysgo.Battery) == false { return } @@ -341,11 +337,14 @@ func (self *TitleBar) CheckBatteryStat() { break } } + if val, ok := bat_uevent["POWER_SUPPLY_STATUS"]; ok { if val == "Charging" { - self.Icons["battery"].SetIconIndex(1+cap_ge) + self.Icons["battery_charging"].SetIconIndex(cap_ge) + self.Icons["battery"] = self.Icons["battery_charging"] } else { - self.Icons["battery"].SetIconIndex(1+9+cap_ge) + self.Icons["battery_discharging"].SetIconIndex(cap_ge) + self.Icons["battery"] = self.Icons["battery_discharging"] } } @@ -393,13 +392,29 @@ func (self *TitleBar) Init(main_screen *MainScreen) { self.Icons["wifistatus"] = icon_wifi_status + battery_charging := NewTitleBarIconItem() + battery_charging.MyType = ICON_TYPES["STAT"] + battery_charging.Parent = self + battery_charging.ImageName = self.icon_base_path + "withcharging.png" + battery_charging.Adjust(start_x+self.IconWidth+self.IconWidth+8, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2, self.IconWidth, self.IconHeight, 0) + + self.Icons["battery_charging"] = battery_charging + + battery_discharging := NewTitleBarIconItem() + battery_discharging.MyType = ICON_TYPES["STAT"] + battery_discharging.Parent = self + battery_discharging.ImageName = self.icon_base_path + "without_charging.png" + battery_discharging.Adjust(start_x+self.IconWidth+self.IconWidth+8, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2, self.IconWidth, self.IconHeight, 0) + + self.Icons["battery_discharging"] = battery_discharging + battery_unknown := NewTitleBarIconItem() battery_unknown.MyType = ICON_TYPES["STAT"] battery_unknown.Parent = self - battery_unknown.ImageName = self.icon_base_path + "battery.png" + battery_unknown.ImageName = self.icon_base_path + "battery_unknown.png" battery_unknown.Adjust(start_x+self.IconWidth+self.IconWidth+8, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2, self.IconWidth, self.IconHeight, 0) - self.Icons["battery"] = battery_unknown + self.Icons["battery_unknown"] = battery_unknown self.CheckBatteryStat() @@ -478,12 +493,6 @@ func (self *TitleBar) ClearCanvas() { self.Icons["round_corners"].SetIconIndex(1) self.Icons["round_corners"].Draw() - go func() { - sdl.Do(func() { - self.RefreshLoop() - }) - }() - } func (self *TitleBar) UpdateTimeLocation() { @@ -567,22 +576,3 @@ func (self *TitleBar) Draw(title string) { title_text_surf.Free() time_text_surf.Free() } - -func (self *TitleBar) Refresh() { - self.updateScreen <- true -} - -func (self *TitleBar) RefreshLoop() { -L: - for { - select { - case v:= <- self.updateScreen: - if v == true { - DisplayFlip() - } - if v== false { - break L - } - } - } -} diff --git a/sysgo/UI/util_funcs.go b/sysgo/UI/util_funcs.go index 7158426..1c40e75 100644 --- a/sysgo/UI/util_funcs.go +++ b/sysgo/UI/util_funcs.go @@ -128,15 +128,10 @@ func ReplaceSuffix(orig_file_str string, new_ext string) string { return orig_file_str // failed just return back where it came } -func DisplayFlip() { +func SwapAndShow() { display.Flip() } -func AsyncDisplayFlip() { - display.ASync(func() { - display.Flip() - }) -} func ReadLines(path string) (lines []string, err error) { var ( file *os.File