Icon style (colorized or grayscale), part 1
This commit is contained in:
@@ -724,7 +724,7 @@ func drawAppGlyph(hdc uintptr, r rect, a appWin) {
|
|||||||
isz := px(16) // the small taskbar icon size
|
isz := px(16) // the small taskbar icon size
|
||||||
if a.icon != 0 {
|
if a.icon != 0 {
|
||||||
cx, cy := center(r)
|
cx, cy := center(r)
|
||||||
pDrawIconEx.Call(hdc, uintptr(cx-isz/2), uintptr(cy-isz/2), a.icon, uintptr(isz), uintptr(isz), 0, 0, diNormal)
|
pDrawIconEx.Call(hdc, uintptr(cx-isz/2), uintptr(cy-isz/2), styledIcon(a.icon), uintptr(isz), uintptr(isz), 0, 0, diNormal)
|
||||||
} else if rs := []rune(a.title); len(rs) > 0 {
|
} else if rs := []rune(a.title); len(rs) > 0 {
|
||||||
pSetBkMode.Call(hdc, transparent)
|
pSetBkMode.Call(hdc, transparent)
|
||||||
pSetTextColor.Call(hdc, rgb(245, 245, 245))
|
pSetTextColor.Call(hdc, rgb(245, 245, 245))
|
||||||
@@ -1218,6 +1218,7 @@ func main() {
|
|||||||
loadOrient()
|
loadOrient()
|
||||||
loadPinned()
|
loadPinned()
|
||||||
loadOrderKeys()
|
loadOrderKeys()
|
||||||
|
loadIconMode()
|
||||||
|
|
||||||
hdc, _, _ := pGetDC.Call(0)
|
hdc, _, _ := pGetDC.Call(0)
|
||||||
dpi, _, _ := pGetDeviceCaps.Call(hdc, logPixelsX)
|
dpi, _, _ := pGetDeviceCaps.Call(hdc, logPixelsX)
|
||||||
|
|||||||
@@ -333,6 +333,9 @@ func refreshApps(refreshIcons bool) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if changed {
|
||||||
|
styleCacheClear() // icon handles can be reused by other icons
|
||||||
|
}
|
||||||
apps = next
|
apps = next
|
||||||
return changed
|
return changed
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ func colorOf(i int) uintptr {
|
|||||||
i = 0
|
i = 0
|
||||||
}
|
}
|
||||||
c := palette[i]
|
c := palette[i]
|
||||||
return rgb(c.r, c.g, c.b)
|
r, g, b := styleColor(c.r, c.g, c.b)
|
||||||
|
return rgb(r, g, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
func logoColor() uintptr { return colorOf(logoIdx) }
|
func logoColor() uintptr { return colorOf(logoIdx) }
|
||||||
@@ -130,6 +131,7 @@ func addColorMenus(menu uintptr) {
|
|||||||
build(menuLogoColorBase, logoIdx, "Windows logo color")
|
build(menuLogoColorBase, logoIdx, "Windows logo color")
|
||||||
build(menuClockColorBase, clockIdx, "Clock color")
|
build(menuClockColorBase, clockIdx, "Clock color")
|
||||||
build(menuIconColorBase, iconIdx, "Tray icon color")
|
build(menuIconColorBase, iconIdx, "Tray icon color")
|
||||||
|
addStyleMenu(menu)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleColorCommand(cmd uintptr) bool {
|
func handleColorCommand(cmd uintptr) bool {
|
||||||
@@ -141,6 +143,8 @@ func handleColorCommand(cmd uintptr) bool {
|
|||||||
clockIdx = int(cmd - menuClockColorBase)
|
clockIdx = int(cmd - menuClockColorBase)
|
||||||
case cmd >= menuIconColorBase && cmd < menuIconColorBase+n:
|
case cmd >= menuIconColorBase && cmd < menuIconColorBase+n:
|
||||||
iconIdx = int(cmd - menuIconColorBase)
|
iconIdx = int(cmd - menuIconColorBase)
|
||||||
|
case handleStyleCommand(cmd):
|
||||||
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user