Usermode/AxWin3 - Debugging IPC
authorJohn Hodge <[email protected]>
Thu, 3 Nov 2011 14:13:54 +0000 (22:13 +0800)
committerJohn Hodge <[email protected]>
Thu, 3 Nov 2011 14:13:54 +0000 (22:13 +0800)
Usermode/Applications/axwin3_src/Makefile
Usermode/Applications/axwin3_src/WM/Makefile
Usermode/Applications/axwin3_src/WM/main.c
Usermode/Applications/axwin3_src/WM/renderer_widget.c
Usermode/Libraries/libaxwin3.so_src/include/internal.h
Usermode/Libraries/libaxwin3.so_src/main.c
Usermode/Libraries/libaxwin3.so_src/msg.c

index daf0685..3523ded 100644 (file)
@@ -1,6 +1,6 @@
 
 NAME = AxWin3
-DIRS = WM
+DIRS = WM Interface
 
 SUBMAKE = $(MAKE) --no-print-directory
 
index 86fbbae..9bd94a0 100644 (file)
@@ -2,6 +2,7 @@
 
 -include ../../Makefile.cfg
 
+# Some evil lazy evaulation, hopefully it works
 CPPFLAGS += -I include/
 
 DIR := Apps/AxWin/3.0
index 51c8c58..c6a4546 100644 (file)
@@ -7,6 +7,8 @@
  */
 #include <common.h>
 #include <acess/sys.h>
+#include <stdlib.h>
+#include <stdio.h>
 
 // === IMPORTS ===
 extern void    WM_Update(void);
@@ -24,7 +26,10 @@ const char   *gsMouseDevice = NULL;
 
  int   giTerminalFD = -1;
  int   giMouseFD = -1;
+
+#define __INSTALL_ROOT "/Acess/Apps/AxWin/3.0"
+
+const char     *gsInstallRoot = __INSTALL_ROOT;
 
 // === CODE ===
 /**
@@ -32,6 +37,8 @@ const char    *gsMouseDevice = NULL;
  */
 int main(int argc, char *argv[])
 {
+        int    server_tid = gettid();
+       
        ParseCommandline(argc, argv);
        
        if( gsTerminalDevice == NULL ) {
@@ -48,6 +55,17 @@ int main(int argc, char *argv[])
        
 //     WM_Update();
        
+       // Spawn interface root
+       if( clone(CLONE_VM, 0) == 0 )
+       {
+               static char csInterfaceApp[] = __INSTALL_ROOT"/AxWinUI";
+               char    server_info[] = "AXWIN3_SERVER=00000";
+               char    *envp[] = {server_info, NULL};
+               char    *argv[] = {csInterfaceApp, NULL};
+               sprintf(server_info, "AXWIN3_SERVER=%i", server_tid);
+               execve(csInterfaceApp, argv, envp);
+       }
+
        // Main Loop
        for(;;)
        {
@@ -59,7 +77,10 @@ int main(int argc, char *argv[])
                IPC_FillSelect(&nfds, &fds);
                
                nfds ++;
-               select(nfds, &fds, NULL, NULL, NULL);
+               if( select(nfds, &fds, NULL, NULL, NULL) == -1 ) {
+                       _SysDebug("ERROR: select() returned -1");
+                       return -1;
+               }
 
                Input_HandleSelect(&fds);
                IPC_HandleSelect(&fds);
index 43d39c1..32d1a97 100644 (file)
@@ -278,7 +278,7 @@ void Widget_NewWidget(tWidgetWin *Info, size_t Len, tWidgetMsg_Create *Msg)
                return ;
        
        // Create
-       parent = _GetElementById(Info, Msg->Parent);
+       parent = Widget_GetElementById(Info, Msg->Parent);
        
 }
 
@@ -293,7 +293,7 @@ int Renderer_Widget_HandleMessage(tWindow *Target, int Msg, int Len, void *Data)
                return 0;
        // 
        default:
-               return 1;       // Unhandled
+               return 1;       // Unhandled, pass to user
        }
 }
 
index ae47408..f804050 100644 (file)
@@ -16,5 +16,7 @@ struct sAxWin3_Window
        char    Data[];
 };
 
+extern const char      *gsAxWin3_int_ServerDesc;
+
 #endif
 
index 47e3f33..3fba042 100644 (file)
@@ -7,11 +7,13 @@
  */
 #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_PID variable
+       // TODO: Parse the environment for the AXWIN3_SERVER variable
+       gsAxWin3_int_ServerDesc = getenv("AXWIN3_SERVER");
        return 0;
 }
 
index cce977b..49bc77e 100644 (file)
@@ -31,10 +31,12 @@ 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
@@ -113,6 +115,8 @@ tAxWin_IPCMessage *AxWin3_int_GetIPCMessage(void)
        switch(giConnectionType)
        {
        case CONNTYPE_SENDMESSAGE:
+               if(SysGetMessage(NULL, NULL) == 0)
+                       sleep();
                while(SysGetMessage(NULL, NULL))
                {
                        pid_t   tid;

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