3 * - By John Hodge (thePowersGang)
8 #include <CConfigInput.hpp>
10 #include <CCompositor.hpp>
15 CInput::CInput(const ::AxWin::CConfigInput& config, CCompositor& compositor):
16 m_compositor(compositor),
23 int CInput::FillSelect(::fd_set& rfds)
25 FD_SET(m_keyboardFD, &rfds);
27 FD_SET(m_mouseFD, &rfds);
28 return ::std::max(m_keyboardFD, m_mouseFD)+1;
31 void CInput::HandleSelect(::fd_set& rfds)
33 if( FD_ISSET(m_keyboardFD, &rfds) )
36 static uint32_t scancode;
37 #define KEY_CODEPOINT_MASK 0x3FFFFFFF
39 size_t readlen = _SysRead(m_keyboardFD, &codepoint, sizeof(codepoint));
40 if( readlen != sizeof(codepoint) )
43 _SysDebug("Terminal read failed? (%i != %i)", readlen, sizeof(codepoint));
46 // _SysDebug("Keypress 0x%x", codepoint);
48 switch(codepoint & 0xC0000000)
50 case 0x00000000: // Key pressed
51 //WM_Input_KeyDown(codepoint & KEY_CODEPOINT_MASK, scancode);
52 case 0x80000000: // Key release
53 //WM_Input_KeyFire(codepoint & KEY_CODEPOINT_MASK, scancode);
56 case 0x40000000: // Key refire
57 //WM_Input_KeyUp(codepoint & KEY_CODEPOINT_MASK, scancode);
60 case 0xC0000000: // Raw scancode
61 scancode = codepoint & KEY_CODEPOINT_MASK;
66 if( m_mouseFD != -1 && FD_ISSET(m_mouseFD, &rfds) )
68 // TODO: Read mouse event and handle