Usermode/AxWin3 - Implementing Client->Window resolution
authorJohn Hodge <[email protected]>
Fri, 4 Nov 2011 03:33:08 +0000 (11:33 +0800)
committerJohn Hodge <[email protected]>
Fri, 4 Nov 2011 03:33:08 +0000 (11:33 +0800)
Usermode/Applications/axwin3_src/WM/include/wm_internals.h
Usermode/Applications/axwin3_src/WM/ipc.c

index b5aa978..43c8db5 100644 (file)
 
 struct sWindow
 {
-       uint32_t        ID;
+       tWindow *GlobalNext;
+       tWindow *RenderNext;
+
+       tWindow *FirstChild;
+       tWindow *LastChild;
+       
        tWMRenderer     *Renderer;
        
         int    X;
index 0ec25db..e07b1e0 100644 (file)
@@ -16,6 +16,7 @@
 #define AXWIN_PORT     4101
 
 #define STATICBUF_SIZE 64
+#define MAX_WINDOWS_PER_APP    128
 
 // === TYPES ===
 typedef struct sIPC_Type       tIPC_Type;
@@ -165,7 +166,6 @@ tIPC_Client *IPC_int_GetClient(const tIPC_Type *IPCType, const void *Ident)
         int    pos;    // Position where the new client will be inserted
         int    ident_size;
        tIPC_Client     *ret;
-       UNIMPLEMENTED();
 
        // - Search list of registered clients
        {
@@ -206,6 +206,8 @@ tIPC_Client *IPC_int_GetClient(const tIPC_Type *IPCType, const void *Ident)
        ret->IPCType = IPCType;
        ret->Ident = &ret + 1;  // Get the end of the structure
        memcpy( (void*)ret->Ident, Ident, ident_size );
+       ret->nWindows = 0;
+       ret->Windows = NULL;
        
        // TODO: Register some way of detecting the client disconnecting
        //       > Wait on the thread / register with kernel somehow
@@ -224,14 +226,27 @@ tWindow *IPC_int_GetWindow(tIPC_Client *Client, uint32_t WindowID)
 {
        if( WindowID == -1 )
                return NULL;
-       
-       UNIMPLEMENTED();
-       return NULL;
+
+       if( WindowID >= Client->nWindows )
+               return NULL;
+
+       return Client->Windows[WindowID];
 }
 
 void IPC_int_SetWindow(tIPC_Client *Client, uint32_t WindowID, tWindow *WindowPtr)
 {
-       UNIMPLEMENTED();
+       if( WindowID >= MAX_WINDOWS_PER_APP )
+               return ;
+
+       if( WindowID >= Client->nWindows )
+       {
+                int    oldCount = Client->nWindows;
+               Client->nWindows = WindowID + 1;
+               Client->Windows = realloc(Client->Windows, Client->nWindows*sizeof(tWindow*));
+               memset( &Client->Windows[oldCount],  0, (Client->nWindows-oldCount)*sizeof(tWindow*) );
+       }
+       
+       Client->Windows[WindowID] = WindowPtr;
 }
 
 // --- IPC Message Handlers ---

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