aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMarvin Borner2020-08-22 19:44:49 +0200
committerMarvin Borner2020-08-22 19:44:49 +0200
commit8bb7b5cceaaf96a5dd6321d35aae28748896d87b (patch)
tree9a4103fb1da636fdf0c5ec8f04425c0c388f527d /apps
parent424dc57424ee17de77d689443f95d2e1bed72f4a (diff)
Added *very* basic polling ipc
Diffstat (limited to 'apps')
-rw-r--r--apps/Makefile2
-rw-r--r--apps/init.c3
-rw-r--r--apps/test.c12
-rw-r--r--apps/wm.c18
4 files changed, 30 insertions, 5 deletions
diff --git a/apps/Makefile b/apps/Makefile
index 6a6e52c..4c26468 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -1,6 +1,6 @@
# MIT License, Copyright (c) 2020 Marvin Borner
-COBJS = init.o wm.o
+COBJS = init.o wm.o test.o
CC = ../cross/opt/bin/i686-elf-gcc
LD = ../cross/opt/bin/i686-elf-ld
OC = ../cross/opt/bin/i686-elf-objcopy
diff --git a/apps/init.c b/apps/init.c
index ba3e15a..f00110e 100644
--- a/apps/init.c
+++ b/apps/init.c
@@ -10,5 +10,6 @@ int main(int argc, char **argv)
printf("[%s loaded]\n", argv[0]);
int wm = exec("/wm", "wm", argv[1], NULL);
- return wm;
+ int test = exec("/test", "test", NULL);
+ return wm + test;
}
diff --git a/apps/test.c b/apps/test.c
new file mode 100644
index 0000000..8004b34
--- /dev/null
+++ b/apps/test.c
@@ -0,0 +1,12 @@
+#include <def.h>
+#include <gui.h>
+#include <print.h>
+
+int main()
+{
+ print("[test loaded]\n");
+ gui_new_window();
+ while (1) {
+ };
+ return 0;
+}
diff --git a/apps/wm.c b/apps/wm.c
index f3ac901..5896e92 100644
--- a/apps/wm.c
+++ b/apps/wm.c
@@ -34,9 +34,21 @@ int main(int argc, char **argv)
gui_init("/font/spleen-16x32.psfu");
gui_write(vbe, 50, 50, text, "hallo");
- event_map(EVENT_KEYBOARD, onkey);
-
- while (1) {
+ //event_map(EVENT_KEYBOARD, onkey); // TODO: Fix events
+
+ struct message *msg;
+ while (1) { // TODO: Remove continuous polling?
+ if (!(msg = msg_receive()))
+ continue;
+
+ switch (msg->type) {
+ case MSG_NEW_WINDOW:
+ printf("New window for pid %d\n", msg->src);
+ break;
+ default:
+ printf("Unknown WM request!");
+ }
};
+
return 0;
}