diff options
author | Benji Dial <benji6283@gmail.com> | 2021-01-24 12:00:11 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-01-24 12:00:11 -0500 |
commit | bce944d1498eaa3b6940ee234c863b3548a66b37 (patch) | |
tree | ea40c087ab4f0f236aee8d158cf68550f5209f72 /src/user/meminfo | |
parent | ca731aa747214919df7b3dfe3478dbe787ce5b68 (diff) | |
download | portland-os-bce944d1498eaa3b6940ee234c863b3548a66b37.tar.gz |
graphics!
Diffstat (limited to 'src/user/meminfo')
-rw-r--r-- | src/user/meminfo/meminfo.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/user/meminfo/meminfo.c b/src/user/meminfo/meminfo.c index dd1d371..124a136 100644 --- a/src/user/meminfo/meminfo.c +++ b/src/user/meminfo/meminfo.c @@ -1,19 +1,30 @@ -#include <pland/syscall.h> -#include <knob/user.h> -#include <knob/format.h> - -void main() { - char nbuf[11]; +#include <popups/info.h> - tell_user_sz("Kernel dynamic memory remaining: "); - - itosz(_kernel_dynamic_area_left() * 4, nbuf); - tell_user_sz(nbuf); - tell_user_sz("k\n"); +#include <pland/syscall.h> - tell_user_sz("Userspace memory remaining: "); +static const struct key_packet meminfo_quits[] = { + { .key_id = KEY_ESCAPE, .modifiers = NO_MODS }, + { .key_id = KEY_F5, .modifiers = NO_MODS }, + { .key_id = 0 } +}; - itosz(_total_userspace_left() * 4, nbuf); - tell_user_sz(nbuf); - tell_user_sz("k\n"); +void main() { + struct popup p; +redo: + info_popupf(&p, + "kernel memory free: %uk\n" + "userspace memory free: %uk / %uk\n" + "Escape to quit, F5 to refresh.", + 0x10, 0x08, + _kernel_dynamic_area_left() * 4, + _total_userspace_left() * 4, + _total_userspace_size() * 4 + ); + //hacky, i should really make info_popup take an arg + p.quit_binds = meminfo_quits; + make_modal(&p); + if (p.quit_as.key_id == KEY_F5) + //i should make popups have changable text + //(make a new pixbuf but reuse the window) + goto redo; }
\ No newline at end of file |