Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ DESTDIR ?= $(abspath build/dist)

CFLAGS = -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector \
-fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-red-zone \
-isystem $(SDK_PATH)/include -Ilibnovaproto -Ilibtheme -Ilibui -Ilibapp -Ilibwidget -I.
-isystem $(SDK_PATH)/include -Ilibnovaproto -Ilibtheme -Ilibui -Ilibapp -Ilibwidget -Isrc -I.

LDFLAGS = -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 \
--no-dynamic-linker -z text -z max-page-size=0x1000 -e _start \
-L$(SDK_PATH)/lib

LIBS = obj/libnovaproto.a obj/libtheme.a obj/libui.a obj/libapp.a obj/libwidget.a
APPS = nova.elf taskbar.elf wallpaperd.elf about.elf helloworld.elf
APPS = nova.elf taskbar.elf wallpaperd.elf about.elf helloworld.elf terminal.elf

all: bootstrap-sdk
$(MAKE) export-sdk
Expand Down
9 changes: 9 additions & 0 deletions assets/terminal.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Terminal configuration for nova terminal
# Supported keys: font, font_size, fg, bg, cursor
# Colors can be specified as 0xAARRGGBB or decimal.

font=/Library/Fonts/FiraCode-Regular.ttf
font_size=14
fg=0xFFCCCCCC
bg=0xFF1E1E1E
cursor=0xFFFFFFFF
9 changes: 9 additions & 0 deletions libapp/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct NovaApp {
AppTextCallback cb_text;
AppPointerCallback cb_pointer;
AppCloseCallback cb_close;
AppIdleCallback cb_idle;

void *userdata;

Expand Down Expand Up @@ -375,6 +376,10 @@ int app_run(NovaApp *app) {
}
}

if (app->cb_idle) {
app->cb_idle(app);
}

if (app->dirty) {
_do_draw(app);
}
Expand Down Expand Up @@ -426,6 +431,10 @@ void app_on_close(NovaApp *app, AppCloseCallback cb) {
if (app) app->cb_close = cb;
}

void app_on_idle(NovaApp *app, AppIdleCallback cb) {
if (app) app->cb_idle = cb;
}

// WM

void app_set_title(NovaApp *app, const char *title) {
Expand Down
4 changes: 4 additions & 0 deletions libapp/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ typedef void (*AppPointerCallback)(NovaApp *app, int x, int y, uint32_t buttons)
// Return true to allow the close, false to cancel it.
typedef bool (*AppCloseCallback)(NovaApp *app);

// Called once per event-loop iteration (before redraw). Use for polling I/O.
typedef void (*AppIdleCallback)(NovaApp *app);

// Create a new application window with the given title and initial dimensions.
// Loads the system theme automatically. Returns NULL on failure.
NovaApp *app_create(const char *title, uint32_t width, uint32_t height);
Expand All @@ -55,6 +58,7 @@ void app_on_key(NovaApp *app, AppKeyCallback cb);
void app_on_text(NovaApp *app, AppTextCallback cb);
void app_on_pointer(NovaApp *app, AppPointerCallback cb);
void app_on_close(NovaApp *app, AppCloseCallback cb);
void app_on_idle(NovaApp *app, AppIdleCallback cb);

// Change the window title at runtime.
void app_set_title(NovaApp *app, const char *title);
Expand Down
Loading