tWindow *LastChild;
tWMRenderer *Renderer;
+
+ int Flags;
int X;
int Y;
void *RendererInfo;
+ void *RenderBuffer; //!< Cached copy of the rendered window
};
#endif
/**
* \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
// === IMPORTS ===
extern void WM_Update(void);
extern void Video_Setup(void);
+extern int Renderer_Widget_Init(void);
// === PROTOTYPES ===
void ParseCommandline(int argc, char **argv);
IPC_Init();
Input_Init();
+ Renderer_Widget_Init();
// WM_Update();
// Spawn interface root
} 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);
return 0;
}
-tWindow *Renderer_Class_Create(int Width, int Height, int Flags)
+tWindow *Renderer_Class_Create(int Flags)
{
return WM_CreateWindowStruct(sizeof(tClassfulInfo));
}
#include <wm_renderer.h>
// === 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);
return 0;
}
-tWindow *Renderer_Passthru_Create(int Width, int Height, int Flags)
+tWindow *Renderer_Passthru_Create(int Flags)
{
return NULL;
}
};
// === 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);
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) );
*/
#include <common.h>
#include <wm_renderer.h>
+#include <stdlib.h>
+#include <string.h>
+
+// === 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)