diff options
author | Marvin Borner | 2021-03-24 22:18:41 +0100 |
---|---|---|
committer | Marvin Borner | 2021-03-24 22:18:41 +0100 |
commit | d2ddd2f279733ec382941b85acd8557cb8f61ec9 (patch) | |
tree | c41ce180bcc984c4e39033ec34eb1ca8789375ca /libgui/inc | |
parent | 48852d97c6a506b3876b139ceb7fde203b9205c2 (diff) |
Huge GUI improvements
Diffstat (limited to 'libgui/inc')
-rw-r--r-- | libgui/inc/gui.h | 12 | ||||
-rw-r--r-- | libgui/inc/msg.h | 46 |
2 files changed, 37 insertions, 21 deletions
diff --git a/libgui/inc/gui.h b/libgui/inc/gui.h index d160333..a3f74f8 100644 --- a/libgui/inc/gui.h +++ b/libgui/inc/gui.h @@ -4,14 +4,10 @@ #define GUI_H #include <def.h> -#include <gfx.h> +#include <errno.h> -struct gui_window { - u32 id; - struct context ctx; -}; - -s32 gui_new_window(struct gui_window *win); -s32 gui_redraw_window(u32 id); +res gui_new_window(void); +res gui_redraw_window(u32 id); +void gui_loop(void); #endif diff --git a/libgui/inc/msg.h b/libgui/inc/msg.h index 150c42d..0e85d5a 100644 --- a/libgui/inc/msg.h +++ b/libgui/inc/msg.h @@ -6,15 +6,28 @@ #include <def.h> #include <gfx.h> +#define MSG_PING_SEND 0x07734 +#define MSG_PING_RECV 0x7474 + #define MSG_MAGIC 0x42042069 #define MSG_SUCCESS (1 << 29) #define MSG_FAILURE (1 << 30) +enum message_state { + MSG_GO_ON, + MSG_NEED_ANSWER, +}; + struct message_header { u32 magic; u32 src; u32 type; - u32 size; + enum message_state state; +}; + +struct message_ping { + struct message_header header; + u32 ping; }; struct message_new_window { @@ -29,23 +42,30 @@ struct message_redraw_window { u32 id; }; -enum message_type { - // GFX // TODO: Remove - GFX_NEW_CONTEXT, - GFX_REDRAW, - GFX_REDRAW_FOCUSED, +struct message_destroy_window { + struct message_header header; + u32 id; +}; + +struct message_mouse { + struct message_header header; + vec2 pos; + struct { + u8 click : 1; + } bits; +}; - // GUI +enum message_type { + GUI_PING, GUI_NEW_WINDOW, GUI_REDRAW_WINDOW, - GUI_KILL, - GUI_KEYBOARD, + GUI_DESTROY_WINDOW, + GUI_MOUSE, - GUI_RESIZE, - GUI_MAX + GUI_KEYBOARD, }; -int msg_send(u32 pid, enum message_type type, void *data, u32 size); -int msg_receive(void *buf, u32 size); +res msg_send(u32 pid, enum message_type type, void *data, u32 size); +res msg_receive(void *buf, u32 size); #endif |