X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin4_src%2FServer%2Fmain.cpp;h=e14ef13544a085383425f297eec23e02a9150461;hb=340e7923b1e95c39ac85a4b22af7f1b53b315cd9;hp=3953e07cb23efac736910cdc7ef7d89398c26e95;hpb=b26dd737345421b70f59fcfd1ddd5278876482da;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin4_src/Server/main.cpp b/Usermode/Applications/axwin4_src/Server/main.cpp index 3953e07c..e14ef135 100644 --- a/Usermode/Applications/axwin4_src/Server/main.cpp +++ b/Usermode/Applications/axwin4_src/Server/main.cpp @@ -1,8 +1,18 @@ /* */ +#include #include #include +#include +#include #include +#include +#include + +extern "C" { +#include +#include +}; using namespace AxWin; @@ -10,31 +20,45 @@ using namespace AxWin; int main(int argc, char *argv[]) { // - Load configuration (from file and argv) + CConfig config; + try { + config.parseCommandline(argc, argv); + } + catch(const std::exception& e) { + fprintf(stderr, "Exception: %s\n", e.what()); + return 1; + } // - Open graphics - Graphics::Open(/*config.m_displayDevice*/); - // - Open input + Graphics::Initialise(config.m_video); // - Initialise compositor structures - // - Prepare global hotkeys + CCompositor* compositor = new CCompositor(/*config.m_compositor*/); + // - Open input + Input::Initialise(config.m_input); + // > Handles hotkeys? // - Bind IPC channels + IPC::Initialise(config.m_ipc, compositor); // - Start root child process (from config) - + // TODO: Spin up child process + // - Event loop for( ;; ) { int nfd = 0; fd_set rfds; - Input::FillSelect(&nfd, &rfds); - IPC::FillSelect(&nfd, &rfds); + nfd = ::std::max(nfd, Input::FillSelect(rfds)); + nfd = ::std::max(nfd, IPC::FillSelect(rfds)); - // TODO: Timer events + // TODO: Support _SysSendMessage IPC? int64_t timeout = Timing::GetTimeToNextEvent(); - int rv = ::_SysSelect(nfd, &rfds, NULL, &rfds, NULL, 0); + int rv = ::_SysSelect(nfd, &rfds, NULL, &rfds, &timeout, 0); Timing::CheckEvents(); - Input::HandleSelect(&rfds); - IPC::HandleSelect(&rfds); + Input::HandleSelect(rfds); + IPC::HandleSelect(rfds); + + compositor->Redraw(); } return 0; }