--- /dev/null
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * CIPCChannel_AcessIPCPipe.cpp
+ * - IPC Channel :: Acess' IPC Pipe /Devices/ipcpipe/<name>
+ */
+#include <CIPCChannel_AcessIPCPipe.hpp>
+
+namespace AxWin {
+
+CIPCChannel_AcessIPCPipe::CIPCChannel_AcessIPCPipe(const ::std::string& suffix)
+{
+
+}
+CIPCChannel_AcessIPCPipe::~CIPCChannel_AcessIPCPipe()
+{
+}
+
+int CIPCChannel_AcessIPCPipe::FillSelect(fd_set& rfds)
+{
+ return 0;
+}
+
+void CIPCChannel_AcessIPCPipe::HandleSelect(const fd_set& rfds)
+{
+}
+
+};
+
OBJ := main.o ipc.o CConfig.o video.o input.o timing.o
OBJ += compositor.o CWindow.o
OBJ += serialisation.o CClient.o
+OBJ += CIPCChannel_AcessIPCPipe.o
OBJ += CRect.o CSurface.o
BIN := AxWinServer
// For all windows, check for intersection with damage rects
for( auto rect : m_damageRects )
{
+ // window list should be sorted by draw order (lowest first)
for( auto window : m_windows )
{
if( rect.HasIntersection( window->m_surface.m_rect ) )
//window->Repaint( rel_rect );
}
}
+
+ // TODO: Blit from windows to a local surface, then blit from there to screen here
}
m_damageRects.clear();
void CCompositor::DamageArea(const CRect& area)
{
+ m_damageRects.push_back( area );
// 1. Locate intersection with any existing damaged areas
// 2. Append after removing intersections
}
uint16_t Window;
};
+enum eMouseButton
+{
+ MOUSEBTN_MAIN, // Left
+ MOUSEBTN_SECONDARY, // Right
+ MOUSEBTN_MIDDLE, // Scroll wheel
+ MOUSEBTN_BTN4,
+ MOUSEBTN_BTN5,
+};
+
class CCompositor
{
CVideo& m_video;
void Redraw();
void DamageArea(const CRect& rect);
void BlitFromSurface(const CSurface& dest, const CRect& src_rect);
+
+ void MouseMove(unsigned int CursorID, unsigned int X, unsigned int Y, int dX, int dY);
+ void MouseButton(unsigned int CursorID, unsigned int X, unsigned int Y, eMouseButton Button, bool Press);
+
+ void KeyState(unsigned int KeyboardID, uint32_t KeySym, bool Press, uint32_t Codepoint);
};
#ifndef _CCONFIGIPC_H_
#define _CCONFIGIPC_H_
+#include <string>
+
namespace AxWin {
+class CConfigIPC_Channel
+{
+public:
+ ::std::string m_name;
+ ::std::string m_argument;
+};
+
class CConfigIPC
{
public:
--- /dev/null
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * CIPCChannel_AcessIPCPipe.hpp
+ * - IPC Channel :: Acess' IPC Pipe /Devices/ipcpipe/<name>
+ */
+#ifndef _CIPCCHANNEL_ACESSIPCPIPE_HPP_
+#define _CIPCCHANNEL_ACESSIPCPIPE_HPP_
+
+#include <IIPCChannel.hpp>
+#include <string>
+#include <list>
+
+namespace AxWin {
+
+class CClient_AcessIPCPipe
+{
+public:
+};
+
+class CIPCChannel_AcessIPCPipe:
+ public IIPCChannel
+{
+ int m_mainFD;
+ ::std::list<CClient_AcessIPCPipe> m_clients;
+public:
+ CIPCChannel_AcessIPCPipe(const ::std::string& suffix);
+ virtual ~CIPCChannel_AcessIPCPipe();
+
+ virtual int FillSelect(fd_set& rfds);
+ virtual void HandleSelect(const fd_set& rfds);
+};
+
+} // namespace AxWin
+
+#endif
+
#ifndef _IIPCCHANNEL_H_
#define _IIPCCHANNEL_H_
+extern "C" {
+#include <acess/sys.h>
+}
+
namespace AxWin {
class IIPCChannel
virtual ~IIPCChannel();
virtual int FillSelect(::fd_set& rfds) = 0;
- virtual void HandleSelect(::fd_set& rfds) = 0;
+ virtual void HandleSelect(const ::fd_set& rfds) = 0;
};
#include <acess/sys.h>
namespace AxWin {
-namespace Input {
-extern void Initialise(const CConfigInput& config);
-extern int FillSelect(::fd_set& rfds);
-extern void HandleSelect(::fd_set& rfds);
+class CCompositor;
+class CInput
+{
+ CCompositor& m_compositor;
+ int m_keyboardFD;
+ int m_mouseFD;
+public:
+ CInput(const CConfigInput& config, CCompositor& compositor);
+ int FillSelect(::fd_set& rfds);
+ void HandleSelect(::fd_set& rfds);
};
-};
+
+}; // namespace AxWin
#endif
namespace IPC {
-extern void Initialise(const CConfigIPC& config, CCompositor* compositor);
+extern void Initialise(const CConfigIPC& config, CCompositor& compositor);
extern int FillSelect(::fd_set& rfds);
extern void HandleSelect(::fd_set& rfds);
*/
#include <CConfigInput.hpp>
#include <input.hpp>
+#include <CCompositor.hpp>
+#include <algorithm>
namespace AxWin {
-namespace Input {
-
-void Initialise(const ::AxWin::CConfigInput& config)
+CInput::CInput(const ::AxWin::CConfigInput& config, CCompositor& compositor):
+ m_compositor(compositor),
+ m_keyboardFD(0),
+ m_mouseFD(-1)
{
}
-int FillSelect(::fd_set& rfds)
+int CInput::FillSelect(::fd_set& rfds)
{
- return 0;
+ FD_SET(m_keyboardFD, &rfds);
+ FD_SET(m_mouseFD, &rfds);
+ return ::std::max(m_keyboardFD, m_mouseFD)+1;
}
-void HandleSelect(::fd_set& rfds)
+void CInput::HandleSelect(::fd_set& rfds)
{
+ if( FD_ISSET(m_keyboardFD, &rfds) )
+ {
+ // TODO: Read keystroke and handle
+ }
+
+ if( FD_ISSET(m_mouseFD, &rfds) )
+ {
+ // TODO: Read mouse event and handle
+ }
}
-};
-
}; // namespace AxWin
extern "C" {
#include <assert.h>
};
+#include <CIPCChannel_AcessIPCPipe.hpp>
namespace AxWin {
namespace IPC {
CCompositor* gpCompositor;
-::std::list<IIPCChannel*> channels;
+::std::list<IIPCChannel*> glChannels;
+//::std::map<uint16_t,CClient*> glClients;
-void Initialise(const CConfigIPC& config, CCompositor* compositor)
+void Initialise(const CConfigIPC& config, CCompositor& compositor)
{
- gpCompositor = compositor;
+ gpCompositor = &compositor;
+
+ ::std::string pipe_basepath = "axwin4";
+ glChannels.push_back( new CIPCChannel_AcessIPCPipe( pipe_basepath ) );
+
+ //glChannels.push_back( new CIPCChannel_TCP("0.0.0.0:2100") );
+
//for( auto channel : config.m_channels )
//{
// channels.push_back( );
int FillSelect(fd_set& rfds)
{
int ret = 0;
- for( auto channel : channels )
+ for( auto channel : glChannels )
{
ret = ::std::max(ret, channel->FillSelect(rfds));
}
void HandleSelect(fd_set& rfds)
{
-
+ for( auto channel : glChannels )
+ {
+ channel->HandleSelect(rfds);
+ }
}
-void RegisterClient(IIPCChannel& channel, CClient& client)
+void RegisterClient(CClient& client)
{
-
+ // allocate a client ID, and save
+ //client.m_id = 123;
+ //glClients[client.m_id] = &client;
+}
+
+void DeregisterClient(CClient& client)
+{
+ //glClients.erase( client.m_id );
}
assert(!"TODO");
}
-};
+}; // namespace IPC
+
+IIPCChannel::~IIPCChannel()
+{
+}
+
}; // namespace AxWin
// - Initialise compositor structures
CCompositor* compositor = new CCompositor(/*config.m_compositor,*/ *vid);
// - Open input
- Input::Initialise(config.m_input);
+ CInput* input = new CInput(config.m_input, *compositor);
// > Handles hotkeys?
// - Bind IPC channels
- IPC::Initialise(config.m_ipc, compositor);
+ IPC::Initialise(config.m_ipc, *compositor);
// - Start root child process (from config)
// TODO: Spin up child process
int nfd = 0;
fd_set rfds;
- nfd = ::std::max(nfd, Input::FillSelect(rfds));
+ nfd = ::std::max(nfd, input->FillSelect(rfds));
nfd = ::std::max(nfd, IPC::FillSelect(rfds));
// TODO: Support _SysSendMessage IPC?
Timing::CheckEvents();
- Input::HandleSelect(rfds);
+ input->HandleSelect(rfds);
IPC::HandleSelect(rfds);
compositor->Redraw();