aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/managewindow.go
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
commit43708b6af9f4bb3f1b1ca603521171acd57cc820 (patch)
tree11e3f5698022ec90971886ff03fa9c4240ae3b6b /ui/managewindow.go
parentui: centralize state labels (diff)
downloadwireguard-windows-43708b6af9f4bb3f1b1ca603521171acd57cc820.tar.xz
wireguard-windows-43708b6af9f4bb3f1b1ca603521171acd57cc820.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.
Diffstat (limited to 'ui/managewindow.go')
-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
}