aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-11-11 16:44:30 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-11-16 18:17:05 +0100
commit08315b0f281d5871ed3dafb1a3ec89bfea33571e (patch)
tree510f844663cd9d34c76369443bab8045a12ef2bd
parentui: remove systray popup menu tunnel list (diff)
downloadwireguard-windows-08315b0f281d5871ed3dafb1a3ec89bfea33571e.tar.xz
wireguard-windows-08315b0f281d5871ed3dafb1a3ec89bfea33571e.zip
ui: use resource numbers instead of resource indices
This makes it stable between Windows versions. HOWEVER! We're still using "1" instead of SHIDI_SHIELD_INTERNAL, because the latter is named instead of numbered. This is a TODO item. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--ui/editdialog.go2
-rw-r--r--ui/iconprovider.go4
-rw-r--r--ui/tray.go2
-rw-r--r--ui/tunnelspage.go10
-rw-r--r--ui/updatepage.go2
5 files changed, 10 insertions, 10 deletions
diff --git a/ui/editdialog.go b/ui/editdialog.go
index ff1ecca9..5c6d0ac0 100644
--- a/ui/editdialog.go
+++ b/ui/editdialog.go
@@ -78,7 +78,7 @@ func newEditDialog(owner walk.Form, tunnel *manager.Tunnel) (*EditDialog, error)
dlg.SetTitle(title)
dlg.SetLayout(layout)
dlg.SetMinMaxSize(walk.Size{500, 400}, walk.Size{0, 0})
- if icon, err := loadSystemIcon("imageres", 109, 32); err == nil {
+ if icon, err := loadSystemIcon("imageres", -114, 32); err == nil {
dlg.SetIcon(icon)
}
diff --git a/ui/iconprovider.go b/ui/iconprovider.go
index 8a5a8265..1fca815d 100644
--- a/ui/iconprovider.go
+++ b/ui/iconprovider.go
@@ -73,11 +73,11 @@ func iconForState(state manager.TunnelState, size int) (icon *walk.Icon, err err
}
switch state {
case manager.TunnelStarted:
- icon, err = loadSystemIcon("imageres", 101, size)
+ icon, err = loadSystemIcon("imageres", -106, size)
case manager.TunnelStopped:
icon, err = walk.NewIconFromResourceIdWithSize(8, walk.Size{size, size}) // TODO: replace with real icon from imageres/shell32
default:
- icon, err = loadSystemIcon("shell32", 238, size) // TODO: this doesn't look that great overlayed on the app icon
+ icon, err = loadSystemIcon("shell32", -16739, size) // TODO: this doesn't look that great overlayed on the app icon
}
if err == nil {
cachedIconsForWidthAndState[widthAndState{size, state}] = icon
diff --git a/ui/tray.go b/ui/tray.go
index 37c3af25..5288d91e 100644
--- a/ui/tray.go
+++ b/ui/tray.go
@@ -113,7 +113,7 @@ func (tray *Tray) onTunnelChange(tunnel *manager.Tunnel, state manager.TunnelSta
tray.ShowCustom(l18n.Sprintf("WireGuard Activated"), l18n.Sprintf("The %s tunnel has been activated.", tunnel.Name), icon)
case manager.TunnelStopped:
- icon, _ := loadSystemIcon("imageres", 26, 128) // TODO: this icon isn't very good...
+ icon, _ := loadSystemIcon("imageres", -31, 128) // TODO: this icon isn't very good...
tray.ShowCustom(l18n.Sprintf("WireGuard Deactivated"), l18n.Sprintf("The %s tunnel has been deactivated.", tunnel.Name), icon)
}
} else if !tray.mtw.Visible() {
diff --git a/ui/tunnelspage.go b/ui/tunnelspage.go
index b9ec9208..d68bf47f 100644
--- a/ui/tunnelspage.go
+++ b/ui/tunnelspage.go
@@ -145,7 +145,7 @@ func (tp *TunnelsPage) CreateToolbar() error {
tp.AddDisposable(addMenu)
importAction := walk.NewAction()
importAction.SetText(l18n.Sprintf("&Import tunnel(s) from file…"))
- importActionIcon, _ := loadSystemIcon("imageres", 3, 16)
+ importActionIcon, _ := loadSystemIcon("imageres", -3, 16)
importAction.SetImage(importActionIcon)
importAction.SetShortcut(walk.Shortcut{walk.ModControl, walk.KeyO})
importAction.SetDefault(true)
@@ -153,13 +153,13 @@ func (tp *TunnelsPage) CreateToolbar() error {
addMenu.Actions().Add(importAction)
addAction := walk.NewAction()
addAction.SetText(l18n.Sprintf("Add &empty tunnel…"))
- addActionIcon, _ := loadSystemIcon("imageres", 2, 16)
+ addActionIcon, _ := loadSystemIcon("imageres", -2, 16)
addAction.SetImage(addActionIcon)
addAction.SetShortcut(walk.Shortcut{walk.ModControl, walk.KeyN})
addAction.Triggered().Attach(tp.onAddTunnel)
addMenu.Actions().Add(addAction)
addMenuAction := walk.NewMenuAction(addMenu)
- addMenuActionIcon, _ := loadSystemIcon("shell32", 149, 16)
+ addMenuActionIcon, _ := loadSystemIcon("shell32", -258, 16)
addMenuAction.SetImage(addMenuActionIcon)
addMenuAction.SetText(l18n.Sprintf("Add Tunnel"))
addMenuAction.SetToolTip(importAction.Text())
@@ -169,7 +169,7 @@ func (tp *TunnelsPage) CreateToolbar() error {
tp.listToolbar.Actions().Add(walk.NewSeparatorAction())
deleteAction := walk.NewAction()
- deleteActionIcon, _ := loadSystemIcon("shell32", 131, 16)
+ deleteActionIcon, _ := loadSystemIcon("shell32", -240, 16)
deleteAction.SetImage(deleteActionIcon)
deleteAction.SetShortcut(walk.Shortcut{0, walk.KeyDelete})
deleteAction.SetToolTip(l18n.Sprintf("Remove selected tunnel(s)"))
@@ -178,7 +178,7 @@ func (tp *TunnelsPage) CreateToolbar() error {
tp.listToolbar.Actions().Add(walk.NewSeparatorAction())
exportAction := walk.NewAction()
- exportActionIcon, _ := loadSystemIcon("imageres", 165, 16) // Or "shell32", 45?
+ exportActionIcon, _ := loadSystemIcon("imageres", -174, 16)
exportAction.SetImage(exportActionIcon)
exportAction.SetToolTip(l18n.Sprintf("Export all tunnels to zip"))
exportAction.Triggered().Attach(tp.onExportTunnels)
diff --git a/ui/updatepage.go b/ui/updatepage.go
index 1ed0b74c..45d09658 100644
--- a/ui/updatepage.go
+++ b/ui/updatepage.go
@@ -60,7 +60,7 @@ func NewUpdatePage() (*UpdatePage, error) {
if err != nil {
return nil, err
}
- updateIcon, _ := loadSystemIcon("shell32", 46, 32)
+ updateIcon, _ := loadSystemIcon("shell32", -47, 32)
button.SetImage(updateIcon)
button.SetText(l18n.Sprintf("Update Now"))