Removed function call for each function call

live
noah metz 2024-04-23 15:05:25 -06:00
parent 017734e40b
commit f7ef36ba55
2 changed files with 15 additions and 20 deletions

@ -278,17 +278,17 @@ func get_private_key(path string, generate bool) ed25519.PrivateKey {
}
func main_loop(client *pnyx.Client, window ncurses.Window, active *atomic.Bool, packet_chan chan pnyx.Payload, user_chan chan rune) {
max_y := ncurses.GetMaxY.Load()(window)
max_x := ncurses.GetMaxX.Load()(window)
titlebar := ncurses.NewWin.Load()(1, max_x, 0, 0)
channels := ncurses.NewWin.Load()(max_y - 1, max_x / 3, 1, 0)
body := ncurses.NewWin.Load()(max_y - 1, max_x * 2 / 3, 1, max_x / 3)
max_y := ncurses.GetMaxY(window)
max_x := ncurses.GetMaxX(window)
titlebar := ncurses.NewWin(1, max_x, 0, 0)
channels := ncurses.NewWin(max_y - 1, max_x / 3, 1, 0)
body := ncurses.NewWin(max_y - 1, max_x * 2 / 3, 1, max_x / 3)
server_name := client.Connection.RemoteAddr().String()
ncurses.MvWAddStr.Load()(titlebar, 0, 0, fmt.Sprintf("pnyx client %X:%X", client.Key.Public().(ed25519.PublicKey)[:2], client.Session.ID[:2]))
ncurses.MvWAddStr.Load()(body, 0, max_x-len(server_name), server_name)
ncurses.WRefresh.Load()(titlebar)
ncurses.MvWAddStr(titlebar, 0, 0, fmt.Sprintf("pnyx client %X:%X", client.Key.Public().(ed25519.PublicKey)[:2], client.Session.ID[:2]))
ncurses.MvWAddStr(body, 0, max_x-len(server_name), server_name)
ncurses.WRefresh(titlebar)
for active.Load() {
select {
@ -336,11 +336,11 @@ func main_loop(client *pnyx.Client, window ncurses.Window, active *atomic.Bool,
default:
}
case char := <-user_chan:
ncurses.MvWAddStr.Load()(body, 0, 0, string(char))
ncurses.WRefresh.Load()(body)
ncurses.MvWAddStr(body, 0, 0, string(char))
ncurses.WRefresh(body)
ncurses.MvWAddStr.Load()(channels, 0, 0, string(char))
ncurses.WRefresh.Load()(channels)
ncurses.MvWAddStr(channels, 0, 0, string(char))
ncurses.WRefresh(channels)
}
}
}
@ -435,12 +435,7 @@ func main() {
go process_mic(client)
err = ncurses.Init()
if err != nil {
panic(err)
}
window := ncurses.InitScr.Load()()
window := ncurses.InitScr()
go ch_listen(&active, user_chan)
go main_loop(client, window, &active, packet_chan, user_chan)
@ -450,5 +445,5 @@ func main() {
<-os_sigs
active.Store(false)
ncurses.EndWin.Load()()
ncurses.EndWin()
}

@ -1 +1 @@
Subproject commit 10449a124f00077b5ee1b6b50e1b475ec3d66721
Subproject commit 281f038f5f113180749d3af477311cd874208a3e