2 * Acess2 GUI (AxWin) Version 3
3 * - By John Hodge (thePowersGang)
12 #include <axwin3/keysyms.h>
15 extern void Video_Setup(void);
16 extern void WM_Initialise(void);
17 extern int Renderer_Menu_Init(void);
18 extern int Renderer_Widget_Init(void);
19 extern int Renderer_Background_Init(void);
20 extern int Renderer_Framebuffer_Init(void);
21 extern int Renderer_RichText_Init(void);
22 extern void WM_Update(void);
23 extern void WM_Hotkey_Register(int nKeys, uint32_t *Keys, const char *ActionName);
26 void ParseCommandline(int argc, char **argv);
29 const char *gsTerminalDevice = NULL;
30 const char *gsMouseDevice = NULL;
32 int giScreenWidth = 640;
33 int giScreenHeight = 480;
35 int giTerminalFD = -1;
36 int giTerminalFD_Input = 0;
39 #define __INSTALL_ROOT "/Acess/Apps/AxWin/3.0"
41 const char *gsInstallRoot = __INSTALL_ROOT;
45 * \brief Program Entrypoint
47 int main(int argc, char *argv[])
49 ParseCommandline(argc, argv);
51 if( gsTerminalDevice == NULL ) {
52 gsTerminalDevice = "/Devices/VTerm/6";
54 if( gsMouseDevice == NULL ) {
55 gsMouseDevice = "/Devices/Mouse/system";
63 Renderer_Widget_Init();
64 Renderer_Background_Init();
65 Renderer_Framebuffer_Init();
66 Renderer_RichText_Init();
69 // TODO: Move these to config
71 keys[0] = KEYSYM_LEFTGUI; keys[1] = KEYSYM_r;
72 WM_Hotkey_Register(2, keys, "Interface>Run");
73 keys[0] = KEYSYM_LEFTGUI; keys[1] = KEYSYM_t;
74 WM_Hotkey_Register(2, keys, "Interface>Terminal");
75 keys[0] = KEYSYM_LEFTGUI; keys[1] = KEYSYM_e;
76 WM_Hotkey_Register(2, keys, "Interface>TextEdit");
78 // Spawn interface root
80 int server_tid = gettid();
81 _SysDebug("server_tid = %i", server_tid);
82 static char csInterfaceApp[] = __INSTALL_ROOT"/AxWinUI";
83 char server_info[] = "AXWIN3_SERVER=00000";
84 const char *envp[] = {server_info, NULL};
85 const char *argv[] = {csInterfaceApp, NULL};
86 _SysDebug("server_tid = %i, &server_tid = %p", server_tid, &server_tid);
87 sprintf(server_info, "AXWIN3_SERVER=%i", server_tid);
88 // TODO: Does the client need FDs?
89 int rv = _SysSpawn(csInterfaceApp, argv, envp, 0, NULL, NULL);
91 _SysDebug("_SysSpawn chucked a sad, rv=%i, errno=%i", rv, _errno);
104 Input_FillSelect(&nfds, &fds);
105 IPC_FillSelect(&nfds, &fds);
108 if( _SysSelect(nfds, &fds, NULL, NULL, NULL, THREAD_EVENT_IPCMSG) == -1 ) {
109 _SysDebug("ERROR: select() returned -1");
113 Input_HandleSelect(&fds);
114 IPC_HandleSelect(&fds);
119 void ParseCommandline(int argc, char **argv)