Usermode/AxWin3 - Working on the libaxwin3 API
authorJohn Hodge <[email protected]>
Sun, 30 Oct 2011 13:37:41 +0000 (21:37 +0800)
committerJohn Hodge <[email protected]>
Sun, 30 Oct 2011 13:37:41 +0000 (21:37 +0800)
Usermode/Applications/axwin3_src/WM/main.c
Usermode/Applications/axwin3_src/WM/renderer_widget.c
Usermode/Libraries/libaxwin3.so_src/Makefile [new file with mode: 0644]
Usermode/Libraries/libaxwin3.so_src/main.c [new file with mode: 0644]
Usermode/Libraries/libaxwin3.so_src/msg.c [new file with mode: 0644]
Usermode/Libraries/libaxwin3.so_src/r_widget.c [new file with mode: 0644]
Usermode/include/axwin3/axwin.h [new file with mode: 0644]

index 2ae11aa..51c8c58 100644 (file)
@@ -21,7 +21,6 @@ const char    *gsMouseDevice = NULL;
 
  int   giScreenWidth = 640;
  int   giScreenHeight = 480;
-uint32_t       *gpScreenBuffer = NULL;
 
  int   giTerminalFD = -1;
  int   giMouseFD = -1;
index 94840d3..43d39c1 100644 (file)
@@ -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 (file)
index 0000000..9a7a79e
--- /dev/null
@@ -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 (file)
index 0000000..a71a662
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * AxWin3 Interface Library
+ * - By John Hodge (thePowersGang)
+ *
+ * main.c
+ * - Entrypoint and setup
+ */
+#include <axwin3/axwin.h>
+
+// === 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 (file)
index 0000000..e69de29
diff --git a/Usermode/Libraries/libaxwin3.so_src/r_widget.c b/Usermode/Libraries/libaxwin3.so_src/r_widget.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Usermode/include/axwin3/axwin.h b/Usermode/include/axwin3/axwin.h
new file mode 100644 (file)
index 0000000..359f4e6
--- /dev/null
@@ -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
+

UCC git Repository :: git.ucc.asn.au