From f57e2eabe0a10c9732c83532e01654a499fb8dcf Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 21 Jun 2021 17:47:13 -0400 Subject: many, many changes; settings is broken --- src/user/meminfo/meminfo.cpp | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) (limited to 'src/user/meminfo/meminfo.cpp') diff --git a/src/user/meminfo/meminfo.cpp b/src/user/meminfo/meminfo.cpp index 03f7ae9..c750e8b 100644 --- a/src/user/meminfo/meminfo.cpp +++ b/src/user/meminfo/meminfo.cpp @@ -1,49 +1,24 @@ -#include -#include #include - #include #include - #include #include -#include using namespace raleigh; -label *kmem; -label *umem; +label *l; void refresh(window_tag_t) { - char *const kstr = format("kernel memory free: %uk", _kernel_dynamic_area_left() * 4); - char *const ustr = format("userspace memory free: %uk / %uk", _total_userspace_left() * 4, _total_userspace_size() * 4); - - kmem->change_value(kstr); - umem->change_value(ustr); - - free_block(kstr); - free_block(ustr); + char *fmt = format("Kernel memory free: %ukB\nUser memory free: %ukB\nF5 to refresh, Alt+F4 to quit", _kernel_dynamic_area_left() * 4, _total_userspace_left() * 4); + l->change_value(fmt); + free_block(fmt); } void main() { - kmem = new label(""); - umem = new label(""); - label msg("press Alt+F4 to quit, or F5 to refresh"); - - padding pkmem(*kmem, 1); - padding pumem(*umem, 1); - padding pmsg(msg, 1); - - dllist ll; - ll.add_front(pmsg); - ll.add_front(pumem); - ll.add_front(pkmem); - vbox box(ll); - - padding pbox(box, 3); - window w(pbox); - w.add_keybind((struct key_packet){.key_id = key_packet::KEY_F5, .modifiers = key_packet::NO_MODS}, &refresh); + l = new label(""); + window w(*l); + w.add_keybind((key_packet){.key_id = key_packet::KEY_F5, .modifiers = key_packet::NO_MODS}, &refresh); refresh(0); w.show(); -- cgit v1.2.3