aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-14 14:14:57 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-14 14:18:23 +0200
commit22dfc8ed4cd3835b034df60580e14ca2d6fc7e5f (patch)
tree11e3f5698022ec90971886ff03fa9c4240ae3b6b /ui
parentui: centralize state labels (diff)
downloadwireguard-windows-22dfc8ed4cd3835b034df60580e14ca2d6fc7e5f.tar.xz
wireguard-windows-22dfc8ed4cd3835b034df60580e14ca2d6fc7e5f.zip
ui: show overlay in pinned taskbar
This means the window icon no longer changes, which sucks, especially for servercore, but it means that the taskbar shows something useful on Windows 10. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/managewindow.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/ui/managewindow.go b/ui/managewindow.go
index cd42e58a..a1f9aa83 100644
--- a/ui/managewindow.go
+++ b/ui/managewindow.go
@@ -23,8 +23,7 @@ type ManageTunnelsWindow struct {
logPage *LogPage
updatePage *UpdatePage
- tunnelChangedCB *service.TunnelChangeCallback
- taskbarButtonCreated bool
+ tunnelChangedCB *service.TunnelChangeCallback
}
const (
@@ -142,17 +141,18 @@ func (mtw *ManageTunnelsWindow) updateProgressIndicator(globalState service.Tunn
default:
pi.SetState(walk.PINoProgress)
}
+ if icon, err := iconForState(globalState, mtw.DPI()/6); err == nil { //TODO: calculate DPI dynamically
+ if globalState == service.TunnelStopped {
+ icon = nil
+ }
+ pi.SetOverlayIcon(icon, textForState(globalState, false))
+ }
}
func (mtw *ManageTunnelsWindow) onTunnelChange(tunnel *service.Tunnel, state service.TunnelState, globalState service.TunnelState, err error) {
mtw.Synchronize(func() {
mtw.updateProgressIndicator(globalState)
- icon, err2 := iconWithOverlayForState(globalState, mtw.DPI()/3) //TODO: calculate DPI dynamically
- if err2 == nil {
- mtw.SetIcon(icon)
- }
-
if err != nil && mtw.Visible() {
errMsg := err.Error()
if len(errMsg) > 0 && errMsg[len(errMsg)-1] != '.' {
@@ -204,13 +204,14 @@ func (mtw *ManageTunnelsWindow) WndProc(hwnd win.HWND, msg uint32, wParam, lPara
return 0
case taskbarButtonCreatedMsg:
ret := mtw.FormBase.WndProc(hwnd, msg, wParam, lParam)
- if !mtw.taskbarButtonCreated {
- mtw.taskbarButtonCreated = true
+ go func() {
globalState, err := service.IPCClientGlobalState()
if err == nil {
- mtw.updateProgressIndicator(globalState)
+ mtw.Synchronize(func() {
+ mtw.updateProgressIndicator(globalState)
+ })
}
- }
+ }()
return ret
}