summaryrefslogtreecommitdiff
path: root/usr.bin/kfgwm/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/kfgwm/window.c')
-rw-r--r--usr.bin/kfgwm/window.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/usr.bin/kfgwm/window.c b/usr.bin/kfgwm/window.c
index 8954553..3908302 100644
--- a/usr.bin/kfgwm/window.c
+++ b/usr.bin/kfgwm/window.c
@@ -32,6 +32,7 @@
#include <sys/param.h>
#include <kfg/window.h>
#include <kfg/font.h>
+#include <stdlib.h>
#include <stddef.h>
#include <string.h>
@@ -158,6 +159,34 @@ kfg_win_draw(struct kfg_window *parent, struct kfg_window *wp)
return 0;
}
+/*
+ * Create a new default window
+ *
+ * @x: X position for this window
+ * @y: Y position for this window
+ * @w: Window width
+ * @h: Window height
+ */
+struct kfg_window *
+kfg_win_new(struct kfg_window *parent, kfgpos_t x, kfgpos_t y)
+{
+ struct kfg_window *wp;
+
+ if ((wp = malloc(sizeof(*wp))) == NULL) {
+ return NULL;
+ }
+
+ wp->x = x;
+ wp->y = y;
+ wp->width = 250;
+ wp->height = 150;
+ wp->fb_pitch = parent->fb_pitch;
+ wp->framebuf = parent->framebuf;
+ wp->bg = KFG_DARK;
+ wp->border_bg = KFG_RED;
+ return wp;
+}
+
int
kfg_win_putstr(struct kfg_window *wp, struct kfg_text *tp)
{