From: John Hodge Date: Sun, 30 Oct 2011 13:37:41 +0000 (+0800) Subject: Usermode/AxWin3 - Working on the libaxwin3 API X-Git-Tag: rel0.14~166 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=e2eba65d40020e9f0ee28ad512ce56d74f656689;p=tpg%2Facess2.git Usermode/AxWin3 - Working on the libaxwin3 API --- diff --git a/Usermode/Applications/axwin3_src/WM/main.c b/Usermode/Applications/axwin3_src/WM/main.c index 2ae11aa7..51c8c586 100644 --- a/Usermode/Applications/axwin3_src/WM/main.c +++ b/Usermode/Applications/axwin3_src/WM/main.c @@ -21,7 +21,6 @@ const char *gsMouseDevice = NULL; int giScreenWidth = 640; int giScreenHeight = 480; -uint32_t *gpScreenBuffer = NULL; int giTerminalFD = -1; int giMouseFD = -1; diff --git a/Usermode/Applications/axwin3_src/WM/renderer_widget.c b/Usermode/Applications/axwin3_src/WM/renderer_widget.c index 94840d35..43d39c10 100644 --- a/Usermode/Applications/axwin3_src/WM/renderer_widget.c +++ b/Usermode/Applications/axwin3_src/WM/renderer_widget.c @@ -254,25 +254,19 @@ void Widget_UpdatePosition(tElement *Element) // --- Helpers --- -tElement *_GetElementById(tWidgetWin *Info, uint32_t ID) +tElement *Widget_GetElementById(tWidgetWin *Info, uint32_t ID) { tElement *ele; - int num; if( ID < Info->TableSize ) return Info->ElementTable[ID]; - while( ID >= Info->TableSize ) { - num ++; - ID -= Info->TableSize; - } - - ele = Info->ElementTable[num]; - while(num-- && ele) ele = ele->ListNext; + ele = Info->ElementTable[ID % Info->TableSize]; + while(ele && ele->ID != ID) ele = ele->ListNext; return ele; } // --- Message Handlers --- -void _NewWidget(tWidgetWin *Info, size_t Len, tWidgetMsg_Create *Msg) +void Widget_NewWidget(tWidgetWin *Info, size_t Len, tWidgetMsg_Create *Msg) { const int max_debugname_len = Len - sizeof(tWidgetMsg_Create); tElement *parent; @@ -293,9 +287,11 @@ int Renderer_Widget_HandleMessage(tWindow *Target, int Msg, int Len, void *Data) tWidgetWin *info = Target->RendererInfo; switch(Msg) { + // New Widget case MSG_WIDGET_CREATE: - _NewWidget(info, Len, Data); + Widget_NewWidget(info, Len, Data); return 0; + // default: return 1; // Unhandled } diff --git a/Usermode/Libraries/libaxwin3.so_src/Makefile b/Usermode/Libraries/libaxwin3.so_src/Makefile new file mode 100644 index 00000000..9a7a79e7 --- /dev/null +++ b/Usermode/Libraries/libaxwin3.so_src/Makefile @@ -0,0 +1,13 @@ +# Acess 2 - AxWin GUI Library +# + +include ../Makefile.cfg + +CPPFLAGS += +CFLAGS += -Wall +LDFLAGS += -lc -soname libaxwin3.so + +OBJ = main.o msg.o r_widget.o +BIN = libaxwin3.so + +include ../Makefile.tpl diff --git a/Usermode/Libraries/libaxwin3.so_src/main.c b/Usermode/Libraries/libaxwin3.so_src/main.c new file mode 100644 index 00000000..a71a662b --- /dev/null +++ b/Usermode/Libraries/libaxwin3.so_src/main.c @@ -0,0 +1,20 @@ +/* + * AxWin3 Interface Library + * - By John Hodge (thePowersGang) + * + * main.c + * - Entrypoint and setup + */ +#include + +// === CODE === +int SoMain(void *Base, int argc, const char *argv[], const char **envp) +{ + // TODO: Parse the environment for the AXWIN3_PID variable + return 0; +} + +void AxWin3_Connect(const char *ServerDesc) +{ + // TODO: Handle Message passing, Local UDP and TCP streams +} diff --git a/Usermode/Libraries/libaxwin3.so_src/msg.c b/Usermode/Libraries/libaxwin3.so_src/msg.c new file mode 100644 index 00000000..e69de29b diff --git a/Usermode/Libraries/libaxwin3.so_src/r_widget.c b/Usermode/Libraries/libaxwin3.so_src/r_widget.c new file mode 100644 index 00000000..e69de29b diff --git a/Usermode/include/axwin3/axwin.h b/Usermode/include/axwin3/axwin.h new file mode 100644 index 00000000..359f4e6b --- /dev/null +++ b/Usermode/include/axwin3/axwin.h @@ -0,0 +1,23 @@ +/* + * Acess2 GUI Version 3 (AxWin3) + * - By John Hodge (thePowersGang) + * + * axwin.h + * - Core API Header + */ +#ifndef _AXWIN3_AXWIN_H_ +#define _AXWIN3_AXWIN_H_ + +typedef void *tHWND; + +extern void AxWin3_Connect(const char *ServerDesc); + +extern tHWND AxWin3_CreateWindow(tHWND Parent, const char *Renderer, int Flags); +extern void AxWin3_DestroyWindow(tHWND Window); + +extern void AxWin3_SendMessage(tHWND Window, int Length, void *Data); +extern void AxWin3_SetWindowPos(tHWND Window, int X, int Y, int W, int H); +extern void AxWin3_SetWindowShown(tHWND Window, int bShow); + +#endif +