SIGWINCH works on background and libnotify widgets
This commit is contained in:
parent
b373eab346
commit
54bbe72aa8
|
@ -46,15 +46,27 @@ func doMouseClick(w int, h int) {
|
||||||
log.Log(INFO, "click() check if", w, h, "is the libnotify menu")
|
log.Log(INFO, "click() check if", w, h, "is the libnotify menu")
|
||||||
if me.notify.menu.tk != nil && me.notify.menu.tk.gocuiSize.inRect(w, h) {
|
if me.notify.menu.tk != nil && me.notify.menu.tk.gocuiSize.inRect(w, h) {
|
||||||
log.Log(GOCUI, "click() is libnotify menu!")
|
log.Log(GOCUI, "click() is libnotify menu!")
|
||||||
|
if me.notify.menu.active {
|
||||||
|
log.Info("show notify menu here")
|
||||||
|
setNotifyMenuText("[X]")
|
||||||
|
me.notify.menu.active = false
|
||||||
|
} else {
|
||||||
|
log.Info("hide notify menu here")
|
||||||
|
setNotifyMenuText("[ ]")
|
||||||
|
me.notify.menu.active = true
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if me.notify.clock.tk != nil && me.notify.clock.tk.gocuiSize.inRect(w, h) {
|
||||||
|
log.Log(GOCUI, "click() is the clock!")
|
||||||
if me.showHelp {
|
if me.showHelp {
|
||||||
log.Info("show help")
|
log.Info("show help")
|
||||||
showHelp()
|
showHelp()
|
||||||
setNotifyMenuText("[X]")
|
|
||||||
} else {
|
} else {
|
||||||
log.Info("hide help")
|
log.Info("hide help")
|
||||||
hideHelp()
|
hideHelp()
|
||||||
setNotifyMenuText("[ ]")
|
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
3
init.go
3
init.go
|
@ -191,7 +191,8 @@ func initPlugin() {
|
||||||
me.notify.clock.offsetH = 1
|
me.notify.clock.offsetH = 1
|
||||||
|
|
||||||
me.notify.menu.wId = -6
|
me.notify.menu.wId = -6
|
||||||
me.notify.menu.offsetH = 0
|
me.notify.menu.offsetW = 4
|
||||||
|
me.notify.menu.offsetH = 1
|
||||||
|
|
||||||
me.notify.help.wId = -7
|
me.notify.help.wId = -7
|
||||||
me.notify.help.offsetH = 3
|
me.notify.help.offsetH = 3
|
||||||
|
|
35
libnotify.go
35
libnotify.go
|
@ -105,12 +105,15 @@ func libNotifyUpdate() {
|
||||||
// check for SIGWINCH. If so, move the libnotify clock
|
// check for SIGWINCH. If so, move the libnotify clock
|
||||||
w, h := me.baseGui.Size()
|
w, h := me.baseGui.Size()
|
||||||
if me.winchW != w || me.winchH != h {
|
if me.winchW != w || me.winchH != h {
|
||||||
|
me.winchW = w
|
||||||
|
me.winchH = h
|
||||||
log.Info("handle SIGWINCH!", w, h)
|
log.Info("handle SIGWINCH!", w, h)
|
||||||
me.notify.clock.tk.MoveToOffset(w-me.notify.clock.offsetW, me.notify.clock.offsetH)
|
me.notify.clock.tk.MoveToOffset(w-me.notify.clock.offsetW, me.notify.clock.offsetH)
|
||||||
me.notify.clock.tk.Hide()
|
me.notify.clock.tk.Hide()
|
||||||
me.notify.clock.tk.Show()
|
me.notify.clock.tk.Show()
|
||||||
me.winchW = w
|
|
||||||
me.winchH = h
|
sigWinchBG()
|
||||||
|
sigWinchMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the time
|
// update the time
|
||||||
|
@ -237,15 +240,15 @@ func hardDrawAtgocuiSize(tk *guiWidget) {
|
||||||
log.Verbose("hardDrawAtgocuiSize() err ok widget", tk.cuiName, a, b, c, d, tk.v.Name())
|
log.Verbose("hardDrawAtgocuiSize() err ok widget", tk.cuiName, a, b, c, d, tk.v.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the "BG" widget and set it to the background on the very very bottom
|
func sigWinchMenu() {
|
||||||
func setBottomBG() {
|
w, _ := me.baseGui.Size()
|
||||||
if me.BG.tk == nil {
|
me.notify.menu.tk.MoveToOffset(w-me.notify.menu.offsetW, me.notify.menu.offsetH)
|
||||||
log.Info("background tk widget not initialized")
|
me.notify.menu.tk.Hide()
|
||||||
return
|
me.notify.menu.tk.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func sigWinchBG() {
|
||||||
tk := me.BG.tk
|
tk := me.BG.tk
|
||||||
// log.Info("found BG. setting to bottom", tk.cuiName)
|
|
||||||
if tk.v == nil {
|
|
||||||
w, h := me.baseGui.Size()
|
w, h := me.baseGui.Size()
|
||||||
a := -1
|
a := -1
|
||||||
b := -1
|
b := -1
|
||||||
|
@ -258,7 +261,19 @@ func setBottomBG() {
|
||||||
log.Log(ERROR, "drawView() internal plugin error err = nil")
|
log.Log(ERROR, "drawView() internal plugin error err = nil")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("background tk View not initialized")
|
log.Info("background resized to", a, b, c, d)
|
||||||
|
}
|
||||||
|
|
||||||
|
// find the "BG" widget and set it to the background on the very very bottom
|
||||||
|
func setBottomBG() {
|
||||||
|
if me.BG.tk == nil {
|
||||||
|
log.Info("background tk widget not initialized")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
tk := me.BG.tk
|
||||||
|
// log.Info("found BG. setting to bottom", tk.cuiName)
|
||||||
|
if tk.v == nil {
|
||||||
|
sigWinchBG()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if me.dark {
|
if me.dark {
|
||||||
|
|
|
@ -150,6 +150,7 @@ type internalTK struct {
|
||||||
type libnotify struct {
|
type libnotify struct {
|
||||||
clock internalTK // widget for the clock
|
clock internalTK // widget for the clock
|
||||||
menu internalTK // libnotify menu icon
|
menu internalTK // libnotify menu icon
|
||||||
|
menuWindow internalTK // libnotify menu window
|
||||||
window internalTK // the libnotify menu
|
window internalTK // the libnotify menu
|
||||||
help internalTK // the help menu
|
help internalTK // the help menu
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue