diff options
author | Benji Dial <benji6283@gmail.com> | 2021-06-21 17:47:13 -0400 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-06-21 17:47:13 -0400 |
commit | f57e2eabe0a10c9732c83532e01654a499fb8dcf (patch) | |
tree | cbf91a23fcdd65e0ea7ed55b0940ca7042d59bef /src/user/meminfo | |
parent | 83835306d57461205a7bcfef9f4c3e06bc504006 (diff) | |
download | portland-os-f57e2eabe0a10c9732c83532e01654a499fb8dcf.tar.gz |
many, many changes; settings is broken
Diffstat (limited to 'src/user/meminfo')
-rw-r--r-- | src/user/meminfo/meminfo.cpp | 39 |
1 files changed, 7 insertions, 32 deletions
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 <raleigh/w/padding.h> -#include <raleigh/w/vbox.h> #include <raleigh/w/label.h> - #include <raleigh/runtime.h> #include <raleigh/window.h> - #include <pland/syscall.h> #include <knob/format.h> -#include <pland/pcrt.h> 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<widget &> 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(); |