summaryrefslogtreecommitdiff
path: root/usr.bin/kfgwm/kfgwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/kfgwm/kfgwm.c')
-rw-r--r--usr.bin/kfgwm/kfgwm.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/usr.bin/kfgwm/kfgwm.c b/usr.bin/kfgwm/kfgwm.c
index eb28a8e..3240a0b 100644
--- a/usr.bin/kfgwm/kfgwm.c
+++ b/usr.bin/kfgwm/kfgwm.c
@@ -35,14 +35,38 @@
#include <stddef.h>
#include <unistd.h>
+static struct fbattr fbattr;
+static uint32_t *framep;
+
+static void
+test_win(struct kfg_window *root, kfgpos_t x, kfgpos_t y, const char *str)
+{
+ struct kfg_text text;
+ struct kfg_window test_win;
+
+ test_win.x = x;
+ test_win.y = y;
+ test_win.width = 250;
+ test_win.height = 150;
+ test_win.fb_pitch = fbattr.pitch;
+ test_win.framebuf = framep;
+ test_win.bg = KFG_DARK;
+ test_win.border_bg = KFG_RED;
+
+ text.text = str;
+ text.x = 0;
+ text.y = 0;
+
+ kfg_win_draw(root, &test_win);
+ kfg_win_putstr(&test_win, &text);
+}
+
int
main(void)
{
int fb_fd, fbattr_fd, prot;
size_t fb_size;
- uint32_t *framep;
- struct fbattr fbattr;
- struct kfg_window root_win, test_win;
+ struct kfg_window root_win;
fb_fd = open("/dev/fb0", O_RDWR);
if (fb_fd < 0) {
@@ -70,16 +94,8 @@ main(void)
root_win.framebuf = framep;
root_win.bg = KFG_RED;
root_win.border_bg = KFG_RED;
+ test_win(&root_win, 40, 85, "Hello, World!");
+ test_win(&root_win, 150, 20, "Mrow!");
- test_win.x = 150;
- test_win.y = 85;
- test_win.width = 425;
- test_win.height = 350;
- test_win.fb_pitch = fbattr.pitch;
- test_win.framebuf = framep;
- test_win.bg = KFG_DARK;
- test_win.border_bg = KFG_RED;
-
- kfg_win_draw(&root_win, &test_win);
for (;;);
}