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) { 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_y := ncurses.GetMaxY(window)
max_x := ncurses.GetMaxX.Load()(window) max_x := ncurses.GetMaxX(window)
titlebar := ncurses.NewWin.Load()(1, max_x, 0, 0) titlebar := ncurses.NewWin(1, max_x, 0, 0)
channels := ncurses.NewWin.Load()(max_y - 1, max_x / 3, 1, 0) channels := ncurses.NewWin(max_y - 1, max_x / 3, 1, 0)
body := ncurses.NewWin.Load()(max_y - 1, max_x * 2 / 3, 1, max_x / 3) body := ncurses.NewWin(max_y - 1, max_x * 2 / 3, 1, max_x / 3)
server_name := client.Connection.RemoteAddr().String() 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(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.MvWAddStr(body, 0, max_x-len(server_name), server_name)
ncurses.WRefresh.Load()(titlebar) ncurses.WRefresh(titlebar)
for active.Load() { for active.Load() {
select { select {
@ -336,11 +336,11 @@ func main_loop(client *pnyx.Client, window ncurses.Window, active *atomic.Bool,
default: default:
} }
case char := <-user_chan: case char := <-user_chan:
ncurses.MvWAddStr.Load()(body, 0, 0, string(char)) ncurses.MvWAddStr(body, 0, 0, string(char))
ncurses.WRefresh.Load()(body) ncurses.WRefresh(body)
ncurses.MvWAddStr.Load()(channels, 0, 0, string(char)) ncurses.MvWAddStr(channels, 0, 0, string(char))
ncurses.WRefresh.Load()(channels) ncurses.WRefresh(channels)
} }
} }
} }
@ -435,12 +435,7 @@ func main() {
go process_mic(client) go process_mic(client)
err = ncurses.Init() window := ncurses.InitScr()
if err != nil {
panic(err)
}
window := ncurses.InitScr.Load()()
go ch_listen(&active, user_chan) go ch_listen(&active, user_chan)
go main_loop(client, window, &active, packet_chan, user_chan) go main_loop(client, window, &active, packet_chan, user_chan)
@ -450,5 +445,5 @@ func main() {
<-os_sigs <-os_sigs
active.Store(false) active.Store(false)
ncurses.EndWin.Load()() ncurses.EndWin()
} }

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