Usermode/AxWin3 - Cleaner libaxwin WNDMSG handling
[tpg/acess2.git] / Usermode / Applications / axwin3_src / libaxwin3.so_src / main.c
1 /*
2  * AxWin3 Interface Library
3  * - By John Hodge (thePowersGang)
4  *
5  * main.c
6  * - Entrypoint and setup
7  */
8 #include <axwin3/axwin.h>
9 #include "include/internal.h"
10 #include "include/ipc.h"
11 #include <stdlib.h>
12
13 // === GLOBALS ===
14 int     giAxWin3_MainLoopExit;
15
16 // === CODE ===
17 int SoMain(void *Base, int argc, const char *argv[], const char **envp)
18 {
19         // TODO: Parse the environment for the AXWIN3_SERVER variable
20         gsAxWin3_int_ServerDesc = getenv("AXWIN3_SERVER");
21         return 0;
22 }
23
24 int AxWin3_MainLoop(void)
25 {
26         tAxWin_IPCMessage       *msg;
27
28         giAxWin3_MainLoopExit = 0;      
29
30         while(!giAxWin3_MainLoopExit)
31         {
32                 msg = AxWin3_int_GetIPCMessage(0, NULL);
33                 if(!msg)        continue;       
34
35                 _SysDebug("AxWin3_MainLoop - Message (Type=%i, Window=%i, Len=%i)",
36                         msg->ID, msg->Window, msg->Size);
37
38                 AxWin3_int_HandleMessage( msg );
39         }
40         return giAxWin3_MainLoopExit;
41 }
42
43 void AxWin3_StopMainLoop(int Reason)
44 {
45         giAxWin3_MainLoopExit = Reason;
46 }
47
48 void AxWin3_MessageSelect(int nFD, fd_set *FDs)
49 {
50         tAxWin_IPCMessage *msg;
51         msg = AxWin3_int_GetIPCMessage(nFD, FDs);
52         if( msg )
53                 AxWin3_int_HandleMessage( msg );
54 }
55

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