2 * Acess2 GUI v4 (AxWin4)
3 * - By John Hodge (thePowesGang)
12 #include <CCompositor.hpp>
18 #include <system_error>
26 using namespace AxWin;
29 int main(int argc, char *argv[])
31 // - Load configuration (from file and argv)
34 config.parseCommandline(argc, argv);
36 catch(const std::exception& e) {
37 fprintf(stderr, "Exception: %s\n", e.what());
38 _SysDebug("Config threw exception: %s", e.what());
43 CCompositor* compositor = 0;
48 vid = new CVideo(config.m_video);
49 ::_SysDebug("vid = %p", vid);
50 // - Initialise compositor structures
51 compositor = new CCompositor(/*config.m_compositor,*/ *vid);
52 ::_SysDebug("compositor = %p", compositor);
54 input = new CInput(config.m_input, *compositor);
55 ::_SysDebug("input = %p", input);
57 // - Bind IPC channels
58 IPC::Initialise(config.m_ipc, *compositor);
59 ::_SysDebug("IPC up");
60 // - Start root child process (from config)
61 // TODO: Spin up child process
64 const char *interface_app = "/Acess/Apps/AxWin/4.0/AxWinUI";
65 const char *argv[] = {interface_app, NULL};
66 int rv = _SysSpawn(interface_app, argv, NULL, 0, NULL, NULL);
68 _SysDebug("_SysSpawn chucked a sad, rv=%i, errno=%i", rv, _errno);
69 throw ::std::system_error(errno, ::std::system_category());
73 catch(const ::std::exception& e) {
74 fprintf(stderr, "Startup threw exception: %s\n", e.what());
75 _SysDebug("Startup threw exception: %s", e.what());
91 nfd = ::std::max(nfd, input->FillSelect(rfds));
92 nfd = ::std::max(nfd, IPC::FillSelect(rfds));
94 for( int i = 0; i < nfd; i ++ )
95 if( FD_ISSET(i, &rfds) )
99 for( int i = 0; i < nfd; i ++ ) {
100 if( FD_ISSET(i, &rfds) ) {
101 _SysDebug("FD%i", i);
106 // TODO: Support _SysSendMessage IPC?
107 int64_t timeout = Timing::GetTimeToNextEvent();
110 ::_SysDebug("Calling select with timeout %lli", timeout);
114 //::_SysDebug("Calling select with no timeout");
117 int rv = ::_SysSelect(nfd, &rfds, NULL, NULL/*&efds*/, timeoutp, 0);
120 for( int i = 0; i < nfd; i ++ ) {
121 if( FD_ISSET(i, &rfds) ) {
122 _SysDebug("FD%i", i);
126 //_SysDebug("rv=%i, timeout=%lli", rv, timeout);
129 Timing::CheckEvents();
131 input->HandleSelect(rfds);
132 IPC::HandleSelect(rfds);
134 compositor->Redraw();
137 ::_SysDebug("Exception during select handling");
145 const char* InitFailure::what() const throw()