From f7ef36ba55303a9ce1ac7f87a6baf6f2a91f976a Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Tue, 23 Apr 2024 15:05:25 -0600 Subject: [PATCH] Removed function call for each function call --- cmd/client/main.go | 33 ++++++++++++++------------------- go-ncurses | 2 +- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/cmd/client/main.go b/cmd/client/main.go index 5ef3e8d..f265d7d 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -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() } diff --git a/go-ncurses b/go-ncurses index 10449a1..281f038 160000 --- a/go-ncurses +++ b/go-ncurses @@ -1 +1 @@ -Subproject commit 10449a124f00077b5ee1b6b50e1b475ec3d66721 +Subproject commit 281f038f5f113180749d3af477311cd874208a3e