From: John Hodge Date: Thu, 27 Oct 2011 12:20:17 +0000 (+0800) Subject: Usermode/AxWin3 - Fiddling X-Git-Tag: rel0.14~187 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=28484b80f5d1e5f9e502f66484ada925ff833891;p=tpg%2Facess2.git Usermode/AxWin3 - Fiddling --- diff --git a/Usermode/Applications/axwin3_src/WM/include/renderer_classful.h b/Usermode/Applications/axwin3_src/WM/include/renderer_classful.h new file mode 100644 index 00000000..5e93de8e --- /dev/null +++ b/Usermode/Applications/axwin3_src/WM/include/renderer_classful.h @@ -0,0 +1,20 @@ +/* + * Acess2 Window Manager v3 (axwin3) + * - By John Hodge (thePowersGang) + * + * include/renderer_classful.h + * - Classful renderer messages + */ +#ifndef _RENDERER_CLASSFUL_H_ +#define _RENDERER_CLASSFUL_H_ + +#include "wm_messages.h" + +enum eWM_Classful_Messages +{ + MSG_CLASSFUL_SETBGCOLOUR = WNDMSG_CLASS_MIN, + MSG_CLASSFUL_SETTEXT +}; + +#endif + diff --git a/Usermode/Applications/axwin3_src/WM/include/wm_internals.h b/Usermode/Applications/axwin3_src/WM/include/wm_internals.h new file mode 100644 index 00000000..b5aa9780 --- /dev/null +++ b/Usermode/Applications/axwin3_src/WM/include/wm_internals.h @@ -0,0 +1,28 @@ +/* + * Acess2 Window Manager v3 (axwin3) + * - By John Hodge (thePowersGang) + * + * include/wm_internals.h + * - Window management internal definitions + */ +#ifndef _WM_INTERNALS_H_ +#define _WM_INTERNALS_H_ + +#include + +struct sWindow +{ + uint32_t ID; + tWMRenderer *Renderer; + + int X; + int Y; + int W; + int H; + + void *RendererInfo; + +}; + +#endif + diff --git a/Usermode/Applications/axwin3_src/WM/include/wm_messages.h b/Usermode/Applications/axwin3_src/WM/include/wm_messages.h new file mode 100644 index 00000000..0bebfdad --- /dev/null +++ b/Usermode/Applications/axwin3_src/WM/include/wm_messages.h @@ -0,0 +1,30 @@ +/* + * Acess2 Window Manager v3 (axwin3) + * - By John Hodge (thePowersGang) + * + * include/wm_messages.h + * - Core window messages + */ +#ifndef _WM_MESSAGES_H_ +#define _WM_MESSAGES_H_ + +enum eWM_WindowMessages +{ + WNDMSG_NULL, + + WNDMSG_CREATE, + WNDMSG_DESTROY, + WNDMSG_FOCUS, // Called on change + WNDMSG_SHOW, // Called on change + + WNDMSG_MOUSEMOVE, + WNDMSG_MOUSEBTN, + WNDMSG_KEYDOWN, + WNDMSG_KEYFIRE, + WNDMSG_KEYUP, + + WNDMSG_CLASS_MIN = 0x1000, + WNDMSG_CLASS_MAX = 0x2000, +}; + +#endif diff --git a/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h b/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h index 165d38a9..8e828eb7 100644 --- a/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h +++ b/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h @@ -1,14 +1,15 @@ /* -* Acess2 Window Manager v3 (axwin3) -* - By John Hodge (thePowersGang) -* -* include/wm_renderer.h -* - Window renderer API -*/ + * Acess2 Window Manager v3 (axwin3) + * - By John Hodge (thePowersGang) + * + * include/wm_renderer.h + * - Window renderer API + */ #ifndef _WM_RENDERER_H_ #define _WM_RENDERER_H_ #include +#include struct sWMRenderer { @@ -50,6 +51,7 @@ struct sWMRenderer * \param MessageID Implementation defined message ID (usually the command) * \param Length Length of the buffer \a Data * \param Data Implementation defined data buffer + * \return Boolean failure (0: Handled, 1: Unhandled) */ int (*HandleMessage)(tWindow *Window, int MessageID, int Length, void *Data); }; diff --git a/Usermode/Applications/axwin3_src/WM/renderer_classes.c b/Usermode/Applications/axwin3_src/WM/renderer_classes.c index 7eea9ac4..dfa447e9 100644 --- a/Usermode/Applications/axwin3_src/WM/renderer_classes.c +++ b/Usermode/Applications/axwin3_src/WM/renderer_classes.c @@ -7,6 +7,13 @@ */ #include #include +#include + +// === TYPES === +typedef struct sClassfulInfo +{ + tColour BGColour; +} tClassfulInfo; // === PROTOTYPES === tWindow *Renderer_Class_Create(int Width, int Height, int Flags); @@ -31,12 +38,12 @@ int Renderer_Class_Init(void) tWindow *Renderer_Class_Create(int Width, int Height, int Flags) { - // TODO: Add info - return WM_CreateWindowStruct(0); + return WM_CreateWindowStruct(sizeof(tClassfulInfo)); } void Renderer_Class_Redraw(tWindow *Window) { + tClassfulInfo *info = Window->RendererInfo; Render_DrawFilledRect(Window, info->BGColour, 0, 0, Window->W, Window->H); } @@ -48,11 +55,15 @@ int Renderer_Class_HandleMessage(tWindow *Target, int Msg, int Len, void *Data) case MSG_CLASSFUL_SETBGCOLOUR: if( Len != sizeof(uint32_t) ) return -1; info->BGColour = *(uint32_t*)Data; - break; + return 0; case MSG_CLASSFUL_SETTEXT: - break; + return -1; + + // Anything else is unhandled + default: + return 1; } } diff --git a/Usermode/Applications/axwin3_src/WM/renderer_passthru.c b/Usermode/Applications/axwin3_src/WM/renderer_passthru.c index a75484cf..d18dc40d 100644 --- a/Usermode/Applications/axwin3_src/WM/renderer_passthru.c +++ b/Usermode/Applications/axwin3_src/WM/renderer_passthru.c @@ -8,12 +8,17 @@ #include #include +// === PROTOTYPES === +tWindow *Renderer_Passthru_Create(int Width, int Height, int Flags); +void Renderer_Passthru_Redraw(tWindow *Window); + int Renderer_Passthru_HandleMessage(tWindow *Target, int Msg, int Len, void *Data); + // === GLOBALS === tWMRenderer gRenderer_Passthru = { .Name = "Passthru", .CreateWindow = Renderer_Passthru_Create, .Redraw = Renderer_Passthru_Redraw, - .SendMessage = Renderer_Passthru_SendMessage + .HandleMessage = Renderer_Passthru_HandleMessage }; // === CODE === @@ -22,4 +27,19 @@ int Renderer_Passthru_Init(void) return 0; } +tWindow *Renderer_Passthru_Create(int Width, int Height, int Flags) +{ + return NULL; +} + +void Renderer_Passthru_Redraw(tWindow *Window) +{ + +} + +int Renderer_Passthru_HandleMessage(tWindow *Target, int Msg, int Len, void *Data) +{ + return 1; +} + diff --git a/Usermode/Applications/axwin3_src/WM/renderer_widget.c b/Usermode/Applications/axwin3_src/WM/renderer_widget.c index 7407e5fd..94f983da 100644 --- a/Usermode/Applications/axwin3_src/WM/renderer_widget.c +++ b/Usermode/Applications/axwin3_src/WM/renderer_widget.c @@ -41,7 +41,7 @@ int Renderer_Widget_Init(void) tWindow *Renderer_Widget_Create(int Width, int Height, int Flags) { // TODO: Add info - return WM_CreateWindowStruct(tWidgetWin_Info); + return WM_CreateWindowStruct( sizeof(tWidgetWin) ); } void Renderer_Widget_Redraw(tWindow *Window) @@ -50,10 +50,11 @@ void Renderer_Widget_Redraw(tWindow *Window) int Renderer_Widget_HandleMessage(tWindow *Target, int Msg, int Len, void *Data) { - tClassfulInfo *info = Target->RendererInfo; + tWidgetWin *info = Target->RendererInfo; switch(Msg) { - + default: + return 1; // Unhandled } }