Usermode/AxWin3 - Moved interface library to Applications tree
authorJohn Hodge <[email protected]>
Fri, 4 Nov 2011 11:12:04 +0000 (19:12 +0800)
committerJohn Hodge <[email protected]>
Fri, 4 Nov 2011 11:12:04 +0000 (19:12 +0800)
16 files changed:
Makefile
Usermode/Applications/axwin3_src/Makefile
Usermode/Applications/axwin3_src/libaxwin3.so_src/Makefile [new file with mode: 0644]
Usermode/Applications/axwin3_src/libaxwin3.so_src/include/internal.h [new file with mode: 0644]
Usermode/Applications/axwin3_src/libaxwin3.so_src/include/ipc.h [new file with mode: 0644]
Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c [new file with mode: 0644]
Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c [new file with mode: 0644]
Usermode/Applications/axwin3_src/libaxwin3.so_src/r_widget.c [new file with mode: 0644]
Usermode/Applications/axwin3_src/libaxwin3.so_src/wm.c [new file with mode: 0644]
Usermode/Libraries/libaxwin3.so_src/Makefile [deleted file]
Usermode/Libraries/libaxwin3.so_src/include/internal.h [deleted file]
Usermode/Libraries/libaxwin3.so_src/include/ipc.h [deleted file]
Usermode/Libraries/libaxwin3.so_src/main.c [deleted file]
Usermode/Libraries/libaxwin3.so_src/msg.c [deleted file]
Usermode/Libraries/libaxwin3.so_src/r_widget.c [deleted file]
Usermode/Libraries/libaxwin3.so_src/wm.c [deleted file]

index d317164..9821d16 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ SUBMAKE = $(MAKE) --no-print-directory
 
 USRLIBS := crt0.o acess.ld ld-acess.so libgcc.so libc.so
 USRLIBS += libreadline.so libnet.so liburi.so
-USRLIBS += libaxwin2.so libaxwin3.so libimage_sif.so
+USRLIBS += libaxwin2.so libimage_sif.so
 
 USRAPPS := init login CLIShell cat ls mount
 USRAPPS += bomb
index 3523ded..59ab3cd 100644 (file)
@@ -1,6 +1,6 @@
 
 NAME = AxWin3
-DIRS = WM Interface
+DIRS = WM libaxwin3.so_src Interface
 
 SUBMAKE = $(MAKE) --no-print-directory
 
diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/Makefile b/Usermode/Applications/axwin3_src/libaxwin3.so_src/Makefile
new file mode 100644 (file)
index 0000000..6e6c3e5
--- /dev/null
@@ -0,0 +1,13 @@
+# Acess 2 - AxWin GUI Library
+#
+
+include ../../../Libraries/Makefile.cfg
+
+CPPFLAGS +=
+CFLAGS   += -Wall
+LDFLAGS  += -lc -soname libaxwin3.so
+
+OBJ = main.o msg.o wm.o r_widget.o
+BIN = libaxwin3.so
+
+include ../../../Libraries/Makefile.tpl
diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/include/internal.h b/Usermode/Applications/axwin3_src/libaxwin3.so_src/include/internal.h
new file mode 100644 (file)
index 0000000..52910bd
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Acess2 Window Manager v3
+ * - By John Hodge (thePowersGang)
+ *
+ * internal.h
+ * - Internal definitions
+ */
+#ifndef _INTERNAL_H_
+#define _INTERNAL_H_
+
+struct sAxWin3_Window
+{
+       uint32_t        ServerID;
+       tAxWin3_WindowMessageHandler    Handler;
+       
+       char    Data[];
+};
+
+extern const char      *gsAxWin3_int_ServerDesc;
+
+extern tAxWin_IPCMessage       *AxWin3_int_AllocateIPCMessage(tHWND Window, int Message, int Flags, int ExtraBytes);
+extern void    AxWin3_int_SendIPCMessage(tAxWin_IPCMessage *Msg);
+extern tAxWin_IPCMessage       *AxWin3_int_GetIPCMessage(void);
+
+#endif
+
diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/include/ipc.h b/Usermode/Applications/axwin3_src/libaxwin3.so_src/include/ipc.h
new file mode 100644 (file)
index 0000000..3686593
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * Acess2 Window Manager v3
+ * - By John Hodge (thePowersGang)
+ *
+ * ipcmessages.h
+ * - IPC Message format definition
+ */
+#ifndef _IPCMESSAGES_LIB_H_
+#define _IPCMESSAGES_LIB_H_
+
+#include "../../WM/include/ipcmessages.h"
+
+#endif
+
diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c b/Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c
new file mode 100644 (file)
index 0000000..3fba042
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * AxWin3 Interface Library
+ * - By John Hodge (thePowersGang)
+ *
+ * main.c
+ * - Entrypoint and setup
+ */
+#include <axwin3/axwin.h>
+#include "include/ipc.h"
+#include "include/internal.h"
+
+// === CODE ===
+int SoMain(void *Base, int argc, const char *argv[], const char **envp)
+{
+       // TODO: Parse the environment for the AXWIN3_SERVER variable
+       gsAxWin3_int_ServerDesc = getenv("AXWIN3_SERVER");
+       return 0;
+}
+
+void AxWin3_MainLoop(void)
+{
+       tAxWin_IPCMessage       *msg;
+        int    bExit = 0;      
+
+       while(!bExit)
+       {
+               msg = AxWin3_int_GetIPCMessage();
+               
+               // TODO: Handle message
+       }
+}
+
diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c b/Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c
new file mode 100644 (file)
index 0000000..76b38c2
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * AxWin3 Interface Library
+ * - By John Hodge (thePowersGang)
+ *
+ * msg.c
+ * - Message handling / IPC
+ */
+#include <axwin3/axwin.h>
+#include <acess/sys.h>
+#include <string.h>
+#include <stdlib.h>
+#include "include/ipc.h"
+#include "include/internal.h"
+
+// === CONSTANTS ===
+enum eConnectionType
+{
+       CONNTYPE_SENDMESSAGE,
+       CONNTYPE_UDP,
+       CONNTYPE_TCP
+};
+
+// === GLOBALS ===
+enum eConnectionType   giConnectionType;
+int    giConnectionNum;        // FD or PID
+char   gaAxWin3_int_UDPHeader[] = {5,16,0,0};  // Port 4101
+ int   giAxWin3_int_UDPHeaderLen = sizeof(gaAxWin3_int_UDPHeader);
+const char     *gsAxWin3_int_ServerDesc;
+tAxWin3_MessageCallback        gAxWin3_MessageCallback;
+
+// === CODE ===
+void AxWin3_Connect(const char *ServerDesc)
+{
+       _SysDebug("ServerDesc = %s", ServerDesc);
+       if( !ServerDesc )
+       {
+               ServerDesc = gsAxWin3_int_ServerDesc;
+       }
+       _SysDebug("ServerDesc = %s", ServerDesc);
+       if( !ServerDesc )
+       {
+               // TODO: Error out
+               return ;
+       }
+       switch(ServerDesc[0])
+       {
+       case '1': case '2': case '3': case '4': case '5':
+       case '6': case '7': case '8': case '9': case '0':
+               giConnectionType = CONNTYPE_SENDMESSAGE;
+               giConnectionNum = atoi(ServerDesc);
+               break;
+       case 'u':
+               while(*ServerDesc && *ServerDesc != ':')        ServerDesc ++;
+               ServerDesc ++;
+               // TODO: Open socket and create UDP header
+               break;
+       case 't':
+               while(*ServerDesc && *ServerDesc != ':')        ServerDesc ++;
+               ServerDesc ++;
+               // TODO: Open socket
+               break;
+       }
+}
+
+tAxWin3_MessageCallback AxWin3_SetMessageCallback(tAxWin3_MessageCallback Callback)
+{
+       tAxWin3_MessageCallback old = gAxWin3_MessageCallback;
+       gAxWin3_MessageCallback = Callback;
+       return old;
+}
+
+tAxWin_IPCMessage *AxWin3_int_AllocateIPCMessage(tHWND Window, int Message, int Flags, int ExtraBytes)
+{
+       tAxWin_IPCMessage       *ret;
+
+       ret = malloc( sizeof(tAxWin_IPCMessage) + ExtraBytes );
+       ret->Flags = Flags;
+       ret->ID = Message;
+       if(Window)
+               ret->Window = Window->ServerID;
+       else
+               ret->Window = -1;
+       ret->Size = ExtraBytes;
+       return ret;
+}
+
+void AxWin3_int_SendIPCMessage(tAxWin_IPCMessage *Msg)
+{
+        int    size = sizeof(tAxWin_IPCMessage) + Msg->Size;
+       switch(giConnectionType)
+       {
+       case CONNTYPE_SENDMESSAGE:
+               SysSendMessage(giConnectionNum, size, Msg);
+               break;
+       case CONNTYPE_UDP: {
+               // Create UDP header
+               char    tmpbuf[giAxWin3_int_UDPHeaderLen + size];
+               memcpy(tmpbuf, gaAxWin3_int_UDPHeader, giAxWin3_int_UDPHeaderLen);
+               memcpy(tmpbuf + giAxWin3_int_UDPHeaderLen, Msg, size);
+               write(giConnectionNum, tmpbuf, sizeof(tmpbuf));
+               }
+               break;
+       case CONNTYPE_TCP:
+               write(giConnectionNum, Msg, size);
+               break;
+       default:
+               break;
+       }
+}
+
+tAxWin_IPCMessage *AxWin3_int_GetIPCMessage(void)
+{
+        int    len;
+       tAxWin_IPCMessage       *ret = NULL;
+       switch(giConnectionType)
+       {
+       case CONNTYPE_SENDMESSAGE:
+               // TODO: Less hack, I need a version of select for GetMessage etc
+               if(SysGetMessage(NULL, NULL) == 0)      sleep();
+               while(SysGetMessage(NULL, NULL))
+               {
+                       pid_t   tid;
+                       len = SysGetMessage(&tid, NULL);
+                       // Check if the message came from the server
+                       if(tid != giConnectionNum)
+                       {
+                               // If not, pass the buck (or ignore)
+                               if( gAxWin3_MessageCallback )
+                                       gAxWin3_MessageCallback(tid, len);
+                               else
+                                       SysGetMessage(NULL, GETMSG_IGNORE);
+                               continue ;
+                       }
+                       
+                       // If it's from the server, allocate a buffer and return it
+                       ret = malloc(len);
+                       if(ret == NULL) return NULL;
+                       SysGetMessage(NULL, ret);
+                       break;
+               }
+               break;
+       default:
+               // TODO: Implement
+               _SysDebug("TODO: Implement AxWin3_int_GetIPCMessage for TCP/UDP");
+               break;
+       }
+
+       // No message?
+       if( ret == NULL )
+               return NULL;
+
+       // TODO: Sanity checks, so a stupid server can't crash us
+
+       return ret;
+}
+
diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/r_widget.c b/Usermode/Applications/axwin3_src/libaxwin3.so_src/r_widget.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/wm.c b/Usermode/Applications/axwin3_src/libaxwin3.so_src/wm.c
new file mode 100644 (file)
index 0000000..9f15ad7
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * AxWin3 Interface Library
+ * - By John Hodge (thePowersGang)
+ *
+ * wm.c
+ * - Core window management functions
+ */
+#include <axwin3/axwin.h>
+#include <stdlib.h>
+#include <string.h>
+#include "include/ipc.h"
+#include "include/internal.h"
+
+#define WINDOWS_PER_ALLOC      (63)
+
+typedef struct sWindowBlock    tWindowBlock;
+
+typedef struct sAxWin3_Window  tWindow;
+
+// === STRUCTURES ===
+struct sWindowBlock
+{
+       tWindowBlock    *Next;
+       tWindow *Windows[WINDOWS_PER_ALLOC];
+};
+
+// === GLOBALS ===
+ int   giAxWin3_LowestFreeWinID;
+ int   giAxWin3_HighestUsedWinID;
+tWindowBlock   gAxWin3_WindowList;
+
+// === CODE ===
+tWindow *AxWin3_int_CreateWindowStruct(uint32_t ServerID, int ExtraBytes)
+{
+       tWindow *ret;
+       
+       ret = calloc(sizeof(tWindow) + ExtraBytes, 1);
+       ret->ServerID = ServerID;
+
+       return ret;
+}
+
+tWindow *AxWin3_int_AllocateWindowInfo(int DataBytes, int *WinID)
+{
+        int    idx, newWinID;
+       tWindowBlock *block, *prev;
+       tWindow *ret;   
+
+       block = &gAxWin3_WindowList;
+       newWinID = giAxWin3_LowestFreeWinID;
+       for( idx = 0; block; newWinID ++ )
+       {
+               if( block->Windows[idx] == NULL )
+                       break;
+               idx ++;
+               if(idx == WINDOWS_PER_ALLOC) {
+                       prev = block;
+                       block = block->Next;
+                       idx = 0;
+               }
+       }
+       
+       if( !block )
+       {
+               block = calloc(sizeof(tWindowBlock), 1);
+               prev->Next = block;
+               idx = 0;
+       }
+       
+       ret = block->Windows[idx] = AxWin3_int_CreateWindowStruct(newWinID, DataBytes);
+       if(newWinID > giAxWin3_HighestUsedWinID)
+               giAxWin3_HighestUsedWinID = newWinID;
+       if(newWinID == giAxWin3_LowestFreeWinID)
+               giAxWin3_HighestUsedWinID ++;
+
+       if(WinID)       *WinID = newWinID;
+
+       return ret;
+}
+
+tHWND AxWin3_CreateWindow(
+       tHWND Parent, const char *Renderer, int Flags,
+       int DataBytes, void **DataPtr,
+       tAxWin3_WindowMessageHandler MessageHandler
+       )
+{
+       tWindow *ret;
+        int    newWinID;
+        int    dataSize = sizeof(tIPCMsg_CreateWin) + strlen(Renderer) + 1;
+       tAxWin_IPCMessage       *msg;
+       tIPCMsg_CreateWin       *create_win;
+
+       // Allocate a window ID
+       ret = AxWin3_int_AllocateWindowInfo(DataBytes, &newWinID);
+       if(!ret)        return NULL;
+       ret->Handler = MessageHandler;
+
+       // Create message
+       msg = AxWin3_int_AllocateIPCMessage(Parent, IPCMSG_CREATEWIN, 0, dataSize);
+       create_win = (void*)msg->Data;  
+       create_win->NewWinID = newWinID;
+       create_win->Flags = Flags;
+       strcpy(create_win->Renderer, Renderer);
+
+       // Send and clean up
+       AxWin3_int_SendIPCMessage(msg);
+       free(msg);
+
+       // TODO: Detect and handle possible errors
+
+       // Return success
+       if(DataPtr)     *DataPtr = ret->Data;
+       return ret;
+}
+
+void AxWin3_DestroyWindow(tHWND Window)
+{
+       tAxWin_IPCMessage       *msg;
+       
+       msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_DESTROYWIN, 0, 0);
+       AxWin3_int_SendIPCMessage(msg);
+       free(msg);
+}
+
+void AxWin3_ShowWindow(tHWND Window, int bShow)
+{
+       tAxWin_IPCMessage       *msg;
+       tIPCMsg_ShowWindow      *info;
+
+       msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_SHOWWINDOW, 0, sizeof(*info));
+       info = (void*)msg->Data;
+       info->bShow = !!bShow;
+       
+       AxWin3_int_SendIPCMessage(msg);
+       
+       free(msg);
+}
+
+void AxWin3_SetWindowPos(tHWND Window, short X, short Y, short W, short H)
+{
+       tAxWin_IPCMessage       *msg;
+       tIPCMsg_SetWindowPos    *info;
+       
+       msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_SETWINPOS, 0, sizeof(*info));
+       info = (void*)msg->Data;
+
+       info->Fields = 0xF;
+       info->X = X;    info->Y = Y;
+       info->W = W;    info->H = H;
+
+       AxWin3_int_SendIPCMessage(msg); 
+       free(msg);
+}
+
+void AxWin3_MoveWindow(tHWND Window, short X, short Y)
+{
+       tAxWin_IPCMessage       *msg;
+       tIPCMsg_SetWindowPos    *info;
+       
+       msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_SETWINPOS, 0, sizeof(*info));
+       info = (void*)msg->Data;
+
+       info->Fields = 0x3;
+       info->X = X;
+       info->Y = Y;
+       
+       AxWin3_int_SendIPCMessage(msg);
+       
+       free(msg);
+}
+
+void AxWin3_ResizeWindow(tHWND Window, short W, short H)
+{
+       tAxWin_IPCMessage       *msg;
+       tIPCMsg_SetWindowPos    *info;
+       
+       msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_SETWINPOS, 0, sizeof(*info));
+       info = (void*)msg->Data;
+
+       info->Fields = 0xC;
+       info->W = W;
+       info->H = H;
+       
+       AxWin3_int_SendIPCMessage(msg);
+       
+       free(msg);
+}
+
diff --git a/Usermode/Libraries/libaxwin3.so_src/Makefile b/Usermode/Libraries/libaxwin3.so_src/Makefile
deleted file mode 100644 (file)
index 8a910ab..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Acess 2 - AxWin GUI Library
-#
-
-include ../Makefile.cfg
-
-CPPFLAGS +=
-CFLAGS   += -Wall
-LDFLAGS  += -lc -soname libaxwin3.so
-
-OBJ = main.o msg.o wm.o r_widget.o
-BIN = libaxwin3.so
-
-include ../Makefile.tpl
diff --git a/Usermode/Libraries/libaxwin3.so_src/include/internal.h b/Usermode/Libraries/libaxwin3.so_src/include/internal.h
deleted file mode 100644 (file)
index 52910bd..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Acess2 Window Manager v3
- * - By John Hodge (thePowersGang)
- *
- * internal.h
- * - Internal definitions
- */
-#ifndef _INTERNAL_H_
-#define _INTERNAL_H_
-
-struct sAxWin3_Window
-{
-       uint32_t        ServerID;
-       tAxWin3_WindowMessageHandler    Handler;
-       
-       char    Data[];
-};
-
-extern const char      *gsAxWin3_int_ServerDesc;
-
-extern tAxWin_IPCMessage       *AxWin3_int_AllocateIPCMessage(tHWND Window, int Message, int Flags, int ExtraBytes);
-extern void    AxWin3_int_SendIPCMessage(tAxWin_IPCMessage *Msg);
-extern tAxWin_IPCMessage       *AxWin3_int_GetIPCMessage(void);
-
-#endif
-
diff --git a/Usermode/Libraries/libaxwin3.so_src/include/ipc.h b/Usermode/Libraries/libaxwin3.so_src/include/ipc.h
deleted file mode 100644 (file)
index 8cbe20d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Acess2 Window Manager v3
- * - By John Hodge (thePowersGang)
- *
- * ipcmessages.h
- * - IPC Message format definition
- */
-#ifndef _IPCMESSAGES_LIB_H_
-#define _IPCMESSAGES_LIB_H_
-
-#include "../../../Applications/axwin3_src/WM/include/ipcmessages.h"
-
-#endif
-
diff --git a/Usermode/Libraries/libaxwin3.so_src/main.c b/Usermode/Libraries/libaxwin3.so_src/main.c
deleted file mode 100644 (file)
index 3fba042..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * AxWin3 Interface Library
- * - By John Hodge (thePowersGang)
- *
- * main.c
- * - Entrypoint and setup
- */
-#include <axwin3/axwin.h>
-#include "include/ipc.h"
-#include "include/internal.h"
-
-// === CODE ===
-int SoMain(void *Base, int argc, const char *argv[], const char **envp)
-{
-       // TODO: Parse the environment for the AXWIN3_SERVER variable
-       gsAxWin3_int_ServerDesc = getenv("AXWIN3_SERVER");
-       return 0;
-}
-
-void AxWin3_MainLoop(void)
-{
-       tAxWin_IPCMessage       *msg;
-        int    bExit = 0;      
-
-       while(!bExit)
-       {
-               msg = AxWin3_int_GetIPCMessage();
-               
-               // TODO: Handle message
-       }
-}
-
diff --git a/Usermode/Libraries/libaxwin3.so_src/msg.c b/Usermode/Libraries/libaxwin3.so_src/msg.c
deleted file mode 100644 (file)
index 76b38c2..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * AxWin3 Interface Library
- * - By John Hodge (thePowersGang)
- *
- * msg.c
- * - Message handling / IPC
- */
-#include <axwin3/axwin.h>
-#include <acess/sys.h>
-#include <string.h>
-#include <stdlib.h>
-#include "include/ipc.h"
-#include "include/internal.h"
-
-// === CONSTANTS ===
-enum eConnectionType
-{
-       CONNTYPE_SENDMESSAGE,
-       CONNTYPE_UDP,
-       CONNTYPE_TCP
-};
-
-// === GLOBALS ===
-enum eConnectionType   giConnectionType;
-int    giConnectionNum;        // FD or PID
-char   gaAxWin3_int_UDPHeader[] = {5,16,0,0};  // Port 4101
- int   giAxWin3_int_UDPHeaderLen = sizeof(gaAxWin3_int_UDPHeader);
-const char     *gsAxWin3_int_ServerDesc;
-tAxWin3_MessageCallback        gAxWin3_MessageCallback;
-
-// === CODE ===
-void AxWin3_Connect(const char *ServerDesc)
-{
-       _SysDebug("ServerDesc = %s", ServerDesc);
-       if( !ServerDesc )
-       {
-               ServerDesc = gsAxWin3_int_ServerDesc;
-       }
-       _SysDebug("ServerDesc = %s", ServerDesc);
-       if( !ServerDesc )
-       {
-               // TODO: Error out
-               return ;
-       }
-       switch(ServerDesc[0])
-       {
-       case '1': case '2': case '3': case '4': case '5':
-       case '6': case '7': case '8': case '9': case '0':
-               giConnectionType = CONNTYPE_SENDMESSAGE;
-               giConnectionNum = atoi(ServerDesc);
-               break;
-       case 'u':
-               while(*ServerDesc && *ServerDesc != ':')        ServerDesc ++;
-               ServerDesc ++;
-               // TODO: Open socket and create UDP header
-               break;
-       case 't':
-               while(*ServerDesc && *ServerDesc != ':')        ServerDesc ++;
-               ServerDesc ++;
-               // TODO: Open socket
-               break;
-       }
-}
-
-tAxWin3_MessageCallback AxWin3_SetMessageCallback(tAxWin3_MessageCallback Callback)
-{
-       tAxWin3_MessageCallback old = gAxWin3_MessageCallback;
-       gAxWin3_MessageCallback = Callback;
-       return old;
-}
-
-tAxWin_IPCMessage *AxWin3_int_AllocateIPCMessage(tHWND Window, int Message, int Flags, int ExtraBytes)
-{
-       tAxWin_IPCMessage       *ret;
-
-       ret = malloc( sizeof(tAxWin_IPCMessage) + ExtraBytes );
-       ret->Flags = Flags;
-       ret->ID = Message;
-       if(Window)
-               ret->Window = Window->ServerID;
-       else
-               ret->Window = -1;
-       ret->Size = ExtraBytes;
-       return ret;
-}
-
-void AxWin3_int_SendIPCMessage(tAxWin_IPCMessage *Msg)
-{
-        int    size = sizeof(tAxWin_IPCMessage) + Msg->Size;
-       switch(giConnectionType)
-       {
-       case CONNTYPE_SENDMESSAGE:
-               SysSendMessage(giConnectionNum, size, Msg);
-               break;
-       case CONNTYPE_UDP: {
-               // Create UDP header
-               char    tmpbuf[giAxWin3_int_UDPHeaderLen + size];
-               memcpy(tmpbuf, gaAxWin3_int_UDPHeader, giAxWin3_int_UDPHeaderLen);
-               memcpy(tmpbuf + giAxWin3_int_UDPHeaderLen, Msg, size);
-               write(giConnectionNum, tmpbuf, sizeof(tmpbuf));
-               }
-               break;
-       case CONNTYPE_TCP:
-               write(giConnectionNum, Msg, size);
-               break;
-       default:
-               break;
-       }
-}
-
-tAxWin_IPCMessage *AxWin3_int_GetIPCMessage(void)
-{
-        int    len;
-       tAxWin_IPCMessage       *ret = NULL;
-       switch(giConnectionType)
-       {
-       case CONNTYPE_SENDMESSAGE:
-               // TODO: Less hack, I need a version of select for GetMessage etc
-               if(SysGetMessage(NULL, NULL) == 0)      sleep();
-               while(SysGetMessage(NULL, NULL))
-               {
-                       pid_t   tid;
-                       len = SysGetMessage(&tid, NULL);
-                       // Check if the message came from the server
-                       if(tid != giConnectionNum)
-                       {
-                               // If not, pass the buck (or ignore)
-                               if( gAxWin3_MessageCallback )
-                                       gAxWin3_MessageCallback(tid, len);
-                               else
-                                       SysGetMessage(NULL, GETMSG_IGNORE);
-                               continue ;
-                       }
-                       
-                       // If it's from the server, allocate a buffer and return it
-                       ret = malloc(len);
-                       if(ret == NULL) return NULL;
-                       SysGetMessage(NULL, ret);
-                       break;
-               }
-               break;
-       default:
-               // TODO: Implement
-               _SysDebug("TODO: Implement AxWin3_int_GetIPCMessage for TCP/UDP");
-               break;
-       }
-
-       // No message?
-       if( ret == NULL )
-               return NULL;
-
-       // TODO: Sanity checks, so a stupid server can't crash us
-
-       return ret;
-}
-
diff --git a/Usermode/Libraries/libaxwin3.so_src/r_widget.c b/Usermode/Libraries/libaxwin3.so_src/r_widget.c
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/Usermode/Libraries/libaxwin3.so_src/wm.c b/Usermode/Libraries/libaxwin3.so_src/wm.c
deleted file mode 100644 (file)
index 9f15ad7..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * AxWin3 Interface Library
- * - By John Hodge (thePowersGang)
- *
- * wm.c
- * - Core window management functions
- */
-#include <axwin3/axwin.h>
-#include <stdlib.h>
-#include <string.h>
-#include "include/ipc.h"
-#include "include/internal.h"
-
-#define WINDOWS_PER_ALLOC      (63)
-
-typedef struct sWindowBlock    tWindowBlock;
-
-typedef struct sAxWin3_Window  tWindow;
-
-// === STRUCTURES ===
-struct sWindowBlock
-{
-       tWindowBlock    *Next;
-       tWindow *Windows[WINDOWS_PER_ALLOC];
-};
-
-// === GLOBALS ===
- int   giAxWin3_LowestFreeWinID;
- int   giAxWin3_HighestUsedWinID;
-tWindowBlock   gAxWin3_WindowList;
-
-// === CODE ===
-tWindow *AxWin3_int_CreateWindowStruct(uint32_t ServerID, int ExtraBytes)
-{
-       tWindow *ret;
-       
-       ret = calloc(sizeof(tWindow) + ExtraBytes, 1);
-       ret->ServerID = ServerID;
-
-       return ret;
-}
-
-tWindow *AxWin3_int_AllocateWindowInfo(int DataBytes, int *WinID)
-{
-        int    idx, newWinID;
-       tWindowBlock *block, *prev;
-       tWindow *ret;   
-
-       block = &gAxWin3_WindowList;
-       newWinID = giAxWin3_LowestFreeWinID;
-       for( idx = 0; block; newWinID ++ )
-       {
-               if( block->Windows[idx] == NULL )
-                       break;
-               idx ++;
-               if(idx == WINDOWS_PER_ALLOC) {
-                       prev = block;
-                       block = block->Next;
-                       idx = 0;
-               }
-       }
-       
-       if( !block )
-       {
-               block = calloc(sizeof(tWindowBlock), 1);
-               prev->Next = block;
-               idx = 0;
-       }
-       
-       ret = block->Windows[idx] = AxWin3_int_CreateWindowStruct(newWinID, DataBytes);
-       if(newWinID > giAxWin3_HighestUsedWinID)
-               giAxWin3_HighestUsedWinID = newWinID;
-       if(newWinID == giAxWin3_LowestFreeWinID)
-               giAxWin3_HighestUsedWinID ++;
-
-       if(WinID)       *WinID = newWinID;
-
-       return ret;
-}
-
-tHWND AxWin3_CreateWindow(
-       tHWND Parent, const char *Renderer, int Flags,
-       int DataBytes, void **DataPtr,
-       tAxWin3_WindowMessageHandler MessageHandler
-       )
-{
-       tWindow *ret;
-        int    newWinID;
-        int    dataSize = sizeof(tIPCMsg_CreateWin) + strlen(Renderer) + 1;
-       tAxWin_IPCMessage       *msg;
-       tIPCMsg_CreateWin       *create_win;
-
-       // Allocate a window ID
-       ret = AxWin3_int_AllocateWindowInfo(DataBytes, &newWinID);
-       if(!ret)        return NULL;
-       ret->Handler = MessageHandler;
-
-       // Create message
-       msg = AxWin3_int_AllocateIPCMessage(Parent, IPCMSG_CREATEWIN, 0, dataSize);
-       create_win = (void*)msg->Data;  
-       create_win->NewWinID = newWinID;
-       create_win->Flags = Flags;
-       strcpy(create_win->Renderer, Renderer);
-
-       // Send and clean up
-       AxWin3_int_SendIPCMessage(msg);
-       free(msg);
-
-       // TODO: Detect and handle possible errors
-
-       // Return success
-       if(DataPtr)     *DataPtr = ret->Data;
-       return ret;
-}
-
-void AxWin3_DestroyWindow(tHWND Window)
-{
-       tAxWin_IPCMessage       *msg;
-       
-       msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_DESTROYWIN, 0, 0);
-       AxWin3_int_SendIPCMessage(msg);
-       free(msg);
-}
-
-void AxWin3_ShowWindow(tHWND Window, int bShow)
-{
-       tAxWin_IPCMessage       *msg;
-       tIPCMsg_ShowWindow      *info;
-
-       msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_SHOWWINDOW, 0, sizeof(*info));
-       info = (void*)msg->Data;
-       info->bShow = !!bShow;
-       
-       AxWin3_int_SendIPCMessage(msg);
-       
-       free(msg);
-}
-
-void AxWin3_SetWindowPos(tHWND Window, short X, short Y, short W, short H)
-{
-       tAxWin_IPCMessage       *msg;
-       tIPCMsg_SetWindowPos    *info;
-       
-       msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_SETWINPOS, 0, sizeof(*info));
-       info = (void*)msg->Data;
-
-       info->Fields = 0xF;
-       info->X = X;    info->Y = Y;
-       info->W = W;    info->H = H;
-
-       AxWin3_int_SendIPCMessage(msg); 
-       free(msg);
-}
-
-void AxWin3_MoveWindow(tHWND Window, short X, short Y)
-{
-       tAxWin_IPCMessage       *msg;
-       tIPCMsg_SetWindowPos    *info;
-       
-       msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_SETWINPOS, 0, sizeof(*info));
-       info = (void*)msg->Data;
-
-       info->Fields = 0x3;
-       info->X = X;
-       info->Y = Y;
-       
-       AxWin3_int_SendIPCMessage(msg);
-       
-       free(msg);
-}
-
-void AxWin3_ResizeWindow(tHWND Window, short W, short H)
-{
-       tAxWin_IPCMessage       *msg;
-       tIPCMsg_SetWindowPos    *info;
-       
-       msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_SETWINPOS, 0, sizeof(*info));
-       info = (void*)msg->Data;
-
-       info->Fields = 0xC;
-       info->W = W;
-       info->H = H;
-       
-       AxWin3_int_SendIPCMessage(msg);
-       
-       free(msg);
-}
-

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