From: John Hodge Date: Fri, 4 Nov 2011 06:04:41 +0000 (+0800) Subject: Usermode/AxWin3 - Implemented WM_CreateWindow X-Git-Tag: rel0.14~153 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=0b1cdd6b52e410ad8784eaf37c24141e947d1091;p=tpg%2Facess2.git Usermode/AxWin3 - Implemented WM_CreateWindow --- diff --git a/Usermode/Applications/axwin3_src/WM/include/wm_internals.h b/Usermode/Applications/axwin3_src/WM/include/wm_internals.h index 43c8db5d..51c43f33 100644 --- a/Usermode/Applications/axwin3_src/WM/include/wm_internals.h +++ b/Usermode/Applications/axwin3_src/WM/include/wm_internals.h @@ -19,6 +19,8 @@ struct sWindow tWindow *LastChild; tWMRenderer *Renderer; + + int Flags; int X; int Y; @@ -27,6 +29,7 @@ struct sWindow void *RendererInfo; + void *RenderBuffer; //!< Cached copy of the rendered window }; #endif diff --git a/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h b/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h index 8e828eb7..afed38c6 100644 --- a/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h +++ b/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h @@ -25,14 +25,12 @@ struct sWMRenderer /** * \brief Initialise a window structure for the renderer - * \param W Width of the new window - * \param H Height of the new window * \param Flags Flags for the window * \return malloc()'d window structure, or NULL on error - * \note Only the fields \a W and \a H need be filled in the window - * structure, the rest will be filled by the caller. + * \note \a Flags is provided for convinience, the caller will + * set the copy in the window structure. */ - tWindow *(*CreateWindow)(int W, int H, int Flags); + tWindow *(*CreateWindow)(int Flags); /** * \brief Redraw a window on the screen diff --git a/Usermode/Applications/axwin3_src/WM/main.c b/Usermode/Applications/axwin3_src/WM/main.c index c6a45463..0b63a183 100644 --- a/Usermode/Applications/axwin3_src/WM/main.c +++ b/Usermode/Applications/axwin3_src/WM/main.c @@ -13,6 +13,7 @@ // === IMPORTS === extern void WM_Update(void); extern void Video_Setup(void); +extern int Renderer_Widget_Init(void); // === PROTOTYPES === void ParseCommandline(int argc, char **argv); @@ -53,6 +54,7 @@ int main(int argc, char *argv[]) IPC_Init(); Input_Init(); + Renderer_Widget_Init(); // WM_Update(); // Spawn interface root diff --git a/Usermode/Applications/axwin3_src/WM/renderer_classes.c b/Usermode/Applications/axwin3_src/WM/renderer_classes.c index 2448c63f..439adaae 100644 --- a/Usermode/Applications/axwin3_src/WM/renderer_classes.c +++ b/Usermode/Applications/axwin3_src/WM/renderer_classes.c @@ -16,7 +16,7 @@ typedef struct sClassfulInfo } tClassfulInfo; // === PROTOTYPES === -tWindow *Renderer_Class_Create(int Width, int Height, int Flags); +tWindow *Renderer_Class_Create(int Flags); void Renderer_Class_Redraw(tWindow *Window); int Renderer_Class_HandleMessage(tWindow *Target, int Msg, int Len, void *Data); @@ -36,7 +36,7 @@ int Renderer_Class_Init(void) return 0; } -tWindow *Renderer_Class_Create(int Width, int Height, int Flags) +tWindow *Renderer_Class_Create(int Flags) { return WM_CreateWindowStruct(sizeof(tClassfulInfo)); } diff --git a/Usermode/Applications/axwin3_src/WM/renderer_passthru.c b/Usermode/Applications/axwin3_src/WM/renderer_passthru.c index d18dc40d..6e16e6a2 100644 --- a/Usermode/Applications/axwin3_src/WM/renderer_passthru.c +++ b/Usermode/Applications/axwin3_src/WM/renderer_passthru.c @@ -9,7 +9,7 @@ #include // === PROTOTYPES === -tWindow *Renderer_Passthru_Create(int Width, int Height, int Flags); +tWindow *Renderer_Passthru_Create(int Flags); void Renderer_Passthru_Redraw(tWindow *Window); int Renderer_Passthru_HandleMessage(tWindow *Target, int Msg, int Len, void *Data); @@ -27,7 +27,7 @@ int Renderer_Passthru_Init(void) return 0; } -tWindow *Renderer_Passthru_Create(int Width, int Height, int Flags) +tWindow *Renderer_Passthru_Create(int Flags) { return NULL; } diff --git a/Usermode/Applications/axwin3_src/WM/renderer_widget.c b/Usermode/Applications/axwin3_src/WM/renderer_widget.c index 32d1a97f..7f0cb0ea 100644 --- a/Usermode/Applications/axwin3_src/WM/renderer_widget.c +++ b/Usermode/Applications/axwin3_src/WM/renderer_widget.c @@ -61,7 +61,7 @@ struct sWidgetWin }; // === PROTOTYPES === -tWindow *Renderer_Widget_Create(int Width, int Height, int Flags); +tWindow *Renderer_Widget_Create(int Flags); void Renderer_Widget_Redraw(tWindow *Window); int Renderer_Widget_HandleMessage(tWindow *Target, int Msg, int Len, void *Data); @@ -81,7 +81,7 @@ int Renderer_Widget_Init(void) return 0; } -tWindow *Renderer_Widget_Create(int Width, int Height, int Flags) +tWindow *Renderer_Widget_Create(int Flags) { // TODO: Add info return WM_CreateWindowStruct( sizeof(tWidgetWin) ); diff --git a/Usermode/Applications/axwin3_src/WM/wm.c b/Usermode/Applications/axwin3_src/WM/wm.c index 3b60d1ab..355229df 100644 --- a/Usermode/Applications/axwin3_src/WM/wm.c +++ b/Usermode/Applications/axwin3_src/WM/wm.c @@ -7,30 +7,48 @@ */ #include #include +#include +#include + +// === GLOBALS === +tWMRenderer *gpWM_Renderers; // === CODE === void WM_RegisterRenderer(tWMRenderer *Renderer) { - UNIMPLEMENTED(); + // TODO: Catch re-adding the first somehow? + if(Renderer->Next) return; + Renderer->Next = gpWM_Renderers; + gpWM_Renderers = Renderer; } tWindow *WM_CreateWindow(tWindow *Parent, int Flags, const char *RendererName) { - UNIMPLEMENTED(); + tWMRenderer *renderer; + tWindow *ret; // - Get Renderer + for( renderer = gpWM_Renderers; renderer; renderer = renderer->Next ) + { + if(strcmp(RendererName, renderer->Name) == 0) + break; + } + if(renderer == NULL) + return NULL; // - Call create window function + ret = renderer->CreateWindow(Flags); // - Fill common fields on that + ret->Flags = Flags; // - Return! - return NULL; + return ret; } tWindow *WM_CreateWindowStruct(size_t ExtraSize) { - return NULL; + return calloc( sizeof(tWindow) + ExtraSize, 1 ); } void WM_Render_FilledRect(tWindow *Window, tColour Colour, int X, int Y, int W, int H)