diff options
author | Benji Dial <benji6283@gmail.com> | 2021-03-03 22:43:17 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-03-03 22:43:17 -0500 |
commit | 81df4702c424f91cca5570ab2554d1d4cbae534d (patch) | |
tree | aa8704b2fdf7a4bd79d85f480dc9fd8f8db02547 /src/user/mdemo | |
parent | 43693f88c79467b741b3f899799082e791656d1b (diff) | |
download | portland-os-81df4702c424f91cca5570ab2554d1d4cbae534d.tar.gz |
64kiB kernel area, ps/2 mouse support, signed decimals in knob format
Diffstat (limited to 'src/user/mdemo')
-rw-r--r-- | src/user/mdemo/main.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/user/mdemo/main.c b/src/user/mdemo/main.c new file mode 100644 index 0000000..fc7de80 --- /dev/null +++ b/src/user/mdemo/main.c @@ -0,0 +1,42 @@ +#include <pland/syscall.h> +#include <popups/info.h> + +#define TEXT_COLOR ((_pixel_t){.r = 0x00, .g = 0x00, .b = 0x00}) +#define BG_COLOR ((_pixel_t){.r = 0xbf, .g = 0xbf, .b = 0xbf}) + +static const char *const mb_names[] = { + "left", "right", "middle" +}; + +void main() { + struct popup main_win; + info_popup(&main_win, "Click me!", TEXT_COLOR, BG_COLOR); + + while (1) { + struct window_action winact; + _get_win_action(main_win.handle, &winact); + + switch (winact.action_type) { + struct popup modal; + case NOT_READY: + _wait_for_action(); + _yield_task(); + continue; + + case KEY_DOWN: + return; + + case MOUSE_DOWN: + info_popupf(&modal, + "Got %s click at (%d, %d)!", + TEXT_COLOR, BG_COLOR, + mb_names[winact.as_mouse.which], + winact.as_mouse.x, winact.as_mouse.y); + make_modal(&modal); + continue; + + default: + continue; + } + } +}
\ No newline at end of file |