X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Fmain.c;h=7d2d3914ba641a9818be777368d5cc079963b0d9;hb=73b82d524a5b6e9baf2f541bb3fccd4d7e2e94ef;hp=5186c21516b0de7cf6fbee2d86b58bb4595cb4b2;hpb=52508b805ef1512b016b74461f080411cf076088;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/WM/main.c b/Usermode/Applications/axwin3_src/WM/main.c index 5186c215..7d2d3914 100644 --- a/Usermode/Applications/axwin3_src/WM/main.c +++ b/Usermode/Applications/axwin3_src/WM/main.c @@ -7,9 +7,20 @@ */ #include #include +#include +#include +#include // === IMPORTS === +extern void Video_Setup(void); +extern void WM_Initialise(void); +extern int Renderer_Menu_Init(void); +extern int Renderer_Widget_Init(void); +extern int Renderer_Background_Init(void); +extern int Renderer_Framebuffer_Init(void); +extern int Renderer_RichText_Init(void); extern void WM_Update(void); +extern void WM_Hotkey_Register(int nKeys, uint32_t *Keys, const char *ActionName); // === PROTOTYPES === void ParseCommandline(int argc, char **argv); @@ -20,11 +31,14 @@ const char *gsMouseDevice = NULL; int giScreenWidth = 640; int giScreenHeight = 480; -uint32_t *gpScreenBuffer = NULL; int giTerminalFD = -1; + int giTerminalFD_Input = 0; int giMouseFD = -1; - + +#define __INSTALL_ROOT "/Acess/Apps/AxWin/3.0" + +const char *gsInstallRoot = __INSTALL_ROOT; // === CODE === /** @@ -38,16 +52,42 @@ int main(int argc, char *argv[]) gsTerminalDevice = "/Devices/VTerm/6"; } if( gsMouseDevice == NULL ) { - gsMouseDevice = "/Devices/PS2Mouse"; + gsMouseDevice = "/Devices/Mouse/system"; } -// Video_Setup(); -// Interface_Init(); + Video_Setup(); IPC_Init(); Input_Init(); -// WM_Update(); + Renderer_Menu_Init(); + Renderer_Widget_Init(); + Renderer_Background_Init(); + Renderer_Framebuffer_Init(); + Renderer_RichText_Init(); + WM_Initialise(); + + // TODO: Config + uint32_t keys[4]; + keys[0] = KEYSYM_LEFTGUI; keys[1] = KEYSYM_r; + WM_Hotkey_Register(2, keys, "Interface>Run"); + // Spawn interface root + { + int server_tid = gettid(); + _SysDebug("server_tid = %i", server_tid); + static char csInterfaceApp[] = __INSTALL_ROOT"/AxWinUI"; + char server_info[] = "AXWIN3_SERVER=00000"; + const char *envp[] = {server_info, NULL}; + const char *argv[] = {csInterfaceApp, NULL}; + _SysDebug("server_tid = %i, &server_tid = %p", server_tid, &server_tid); + sprintf(server_info, "AXWIN3_SERVER=%i", server_tid); + // TODO: Does the client need FDs? + int rv = _SysSpawn(csInterfaceApp, argv, envp, 0, NULL, NULL); + if( rv ) { + _SysDebug("_SysSpawn chucked a sad, rv=%i, errno=%i", rv, _errno); + } + } + // Main Loop for(;;) { @@ -55,11 +95,16 @@ int main(int argc, char *argv[]) int nfds = 0; FD_ZERO(&fds); + WM_Update(); + Input_FillSelect(&nfds, &fds); IPC_FillSelect(&nfds, &fds); nfds ++; - select(nfds, &fds, NULL, NULL, NULL); + if( _SysSelect(nfds, &fds, NULL, NULL, NULL, THREAD_EVENT_IPCMSG) == -1 ) { + _SysDebug("ERROR: select() returned -1"); + return -1; + } Input_HandleSelect(&fds); IPC_HandleSelect(&fds);