+void CCompositor::MouseMove(unsigned int Cursor, unsigned int X, unsigned int Y, int dX, int dY)
+{
+ _SysDebug("MouseButton(%i, %i,%i, %+i,%+i)", Cursor, X, Y, dX, dY);
+ m_video.SetCursorPos(X+dX, Y+dY);
+ CWindow *dstwin = getWindowForCoord(X, Y);
+ if( dstwin )
+ {
+ // TODO: Pass event on to window
+ }
+}
+
+void CCompositor::MouseButton(unsigned int Cursor, unsigned int X, unsigned int Y, eMouseButton Button, bool Press)
+{
+ _SysDebug("MouseButton(%i, %i,%i, %i=%i)", Cursor, X, Y, Button, Press);
+ CWindow *dstwin = getWindowForCoord(X, Y);
+ if( dstwin )
+ {
+ // 1. Give focus and bring to front
+ // 2. Send event
+ // TODO: Pass event on to window
+ }
+}
+
+void CCompositor::KeyState(unsigned int KeyboardID, uint32_t KeySym, bool Press, uint32_t Codepoint)
+{
+ _SysDebug("KeyState(%i, 0x%x, %b, 0x%x)", KeyboardID, KeySym, Press, Codepoint);
+}
+
+CWindow* CCompositor::getWindowForCoord(unsigned int X, unsigned int Y)
+{
+ return m_windowIDBuffer.get(X, Y);
+}
+
+// --------------------------------------------------------------------
+CWindowIDBuffer::CWindowIDBuffer(unsigned int W, unsigned int H):
+ m_w(W),
+ m_buf(W*H)
+{
+}
+void CWindowIDBuffer::set(unsigned int X, unsigned int Y, unsigned int W, unsigned int H, CWindow* win)
+{
+ TWindowID ent = {
+ .Client = win->client().id(),
+ .Window = win->id(),
+ };
+
+}
+CWindow* CWindowIDBuffer::get(unsigned int X, unsigned int Y)
+{
+ if( X >= m_w )
+ return nullptr;
+ unsigned int pos = Y*m_w + X;
+ if( pos >= m_buf.size() )
+ return nullptr;
+ auto id = m_buf[pos];
+ auto client = ::AxWin::IPC::GetClientByID(id.Client);
+ if( client == nullptr )
+ return nullptr;
+ return client->GetWindow(id.Window);
+}
+