summaryrefslogtreecommitdiff
path: root/src/user/meminfo/meminfo.c
blob: 4dbd6bfd64bd244117a58159c447fd700a2fe565 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <popups/info.h>

#include <pland/syscall.h>

static const struct key_packet meminfo_quits[] = {
  { .key_id = KEY_ESCAPE, .modifiers = NO_MODS },
  { .key_id = KEY_F5,     .modifiers = NO_MODS },
  { .key_id = 0 }
};

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, 0x07,
    _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;
}