X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Fmain.c;h=9db1c15c6b9711ed4eb89db070ba0f83ed6fa734;hb=be5123fe1f4aa66b76ce8ef589362ad21b6bbf72;hp=7aa5534af00db9b03e8d2066e395927845e8af78;hpb=4c76c235551f3f936a20b17cfe727578644493f1;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/WM/main.c b/Usermode/Applications/axwin3_src/WM/main.c index 7aa5534a..9db1c15c 100644 --- a/Usermode/Applications/axwin3_src/WM/main.c +++ b/Usermode/Applications/axwin3_src/WM/main.c @@ -9,6 +9,7 @@ #include #include #include +#include // === IMPORTS === extern void Video_Setup(void); @@ -17,7 +18,9 @@ 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); @@ -43,8 +46,6 @@ const char *gsInstallRoot = __INSTALL_ROOT; */ int main(int argc, char *argv[]) { - int server_tid = gettid(); - ParseCommandline(argc, argv); if( gsTerminalDevice == NULL ) { @@ -62,19 +63,31 @@ int main(int argc, char *argv[]) Renderer_Widget_Init(); Renderer_Background_Init(); Renderer_Framebuffer_Init(); + Renderer_RichText_Init(); WM_Initialise(); + + // TODO: Move these to config + uint32_t keys[4]; + keys[0] = KEYSYM_LEFTGUI; keys[1] = KEYSYM_r; + WM_Hotkey_Register(2, keys, "Interface>Run"); + keys[0] = KEYSYM_LEFTGUI; keys[1] = KEYSYM_t; + WM_Hotkey_Register(2, keys, "Interface>Terminal"); // Spawn interface root - if( clone(CLONE_VM, 0) == 0 ) { + int server_tid = gettid(); + _SysDebug("server_tid = %i", server_tid); static char csInterfaceApp[] = __INSTALL_ROOT"/AxWinUI"; char server_info[] = "AXWIN3_SERVER=00000"; - char *envp[] = {server_info, NULL}; - char *argv[] = {csInterfaceApp, NULL}; + 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); - execve(csInterfaceApp, argv, envp); - exit(1); + // TODO: Does the client need FDs? + int rv = _SysSpawn(csInterfaceApp, argv, envp, 0, NULL, NULL); + if( rv < 0 ) { + _SysDebug("_SysSpawn chucked a sad, rv=%i, errno=%i", rv, _errno); + } } // Main Loop