diff options
| -rw-r--r-- | bar/bar.go | 32 |
1 files changed, 3 insertions, 29 deletions
@@ -16,16 +16,10 @@ import ( var bars map[int]*bar -type drawinfo struct { - State *bspc.State - Blocks *status.Blocks -} - type bar struct { id int w *drw.Window i *image.RGBA - redraw chan drawinfo } func create(state *bspc.State, id int) (error) { @@ -60,27 +54,10 @@ func (b *bar) init(id int, state *bspc.State) error { rect := image.Rect(0, 0, int(mon.Rectangle.Width), int(config.H)) b.i = image.NewRGBA(rect) - b.redraw = make(chan drawinfo, 20) - - go func(){ - for d := range b.redraw { - // Gobble up excess redraws - gobble: for { - select { - case d = <- b.redraw: - default: break gobble - } - } - - b.draw(d) - } - }() - return nil } func (b *bar) destroy(state *bspc.State) { - close(b.redraw) mon, _ := b.getmon(state) if (mon != nil) { mon.TopPadding(0) @@ -99,13 +76,10 @@ func (b *bar) drawRect(x, y, w, h int, c color.Color, fill bool) { drw.DrawRect(b.i, x, y, w, h, c, fill) } -func (b bar) draw(d drawinfo) { +func (b bar) draw(state *bspc.State, blocks *status.Blocks) { var bg color.Color var filled bool - state := d.State - blocks := d.Blocks - mon, err := b.getmon(state) if err != nil { return @@ -247,12 +221,12 @@ func init() { } case blocks = <- status.NewBlocks: for _, b := range bars { - b.redraw <- drawinfo{state, blocks} + b.draw(state, blocks) } case state = <- NewState: finalstate = state for _, b := range bars { - b.redraw <- drawinfo{state, blocks} + b.draw(state, blocks) } } } |