From: John Hodge Date: Sun, 18 May 2014 14:00:34 +0000 (+0800) Subject: Usermode/AxWin4 - Code now compiling (if STL is present) X-Git-Url: https://git.ucc.asn.au/?p=tpg%2Facess2.git;a=commitdiff_plain;h=340e7923b1e95c39ac85a4b22af7f1b53b315cd9 Usermode/AxWin4 - Code now compiling (if STL is present) --- diff --git a/Usermode/Applications/axwin4_src/Server/CClient.cpp b/Usermode/Applications/axwin4_src/Server/CClient.cpp new file mode 100644 index 00000000..6f1f2562 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/CClient.cpp @@ -0,0 +1,39 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * CClient.cpp + * - IPC Client + */ +#include + +namespace AxWin { + +CClient::CClient(IIPCChannel& channel): + m_channel(channel) +{ + +} + +CWindow* CClient::GetWindow(int ID) +{ + if( ID == 0 ) + return 0; + + return m_windows[ID]; +} + +void CClient::SetWindow(int ID, CWindow* window) +{ + if( m_windows[ID] ) { + delete m_windows[ID]; + } + m_windows[ID] = window; +} + +void CClient::SendMessage(CSerialiser& reply) +{ +} + +}; // namespace AxWin + diff --git a/Usermode/Applications/axwin4_src/Server/CConfig.cpp b/Usermode/Applications/axwin4_src/Server/CConfig.cpp new file mode 100644 index 00000000..567f1a3a --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/CConfig.cpp @@ -0,0 +1,34 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * CConfig.cpp + * - Configuration + */ +#include + +namespace AxWin { + +CConfig::CConfig() +{ +} + +bool CConfig::parseCommandline(int argc, char *argv[]) +{ + return false; +} + +CConfigVideo::CConfigVideo() +{ +} + +CConfigInput::CConfigInput() +{ +} + +CConfigIPC::CConfigIPC() +{ +} + +}; // namespace AxWin + diff --git a/Usermode/Applications/axwin4_src/Server/CRect.cpp b/Usermode/Applications/axwin4_src/Server/CRect.cpp new file mode 100644 index 00000000..5fd13c08 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/CRect.cpp @@ -0,0 +1,23 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * CRect.cpp + * - Rectangle + */ +#include + +namespace AxWin { + +CRect::CRect(int x, int y, int w, int h) + //m_x(x), m_y(y), m_w(w), m_h(h) +{ +} + +bool CRect::Contains(const CRect& other) const +{ + return false; +} + +}; + diff --git a/Usermode/Applications/axwin4_src/Server/CWindow.cpp b/Usermode/Applications/axwin4_src/Server/CWindow.cpp new file mode 100644 index 00000000..79308cc4 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/CWindow.cpp @@ -0,0 +1,30 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * CWindow.cpp + * - Window + */ +#include + +namespace AxWin { + +CWindow::CWindow(CClient& client, const ::std::string& name): + m_client(client), + m_name(name), + m_rect(0,0,0,0) +{ + +} + +CWindow::~CWindow() +{ +} + +void CWindow::Repaint(const CRect& rect) +{ + +} + +}; + diff --git a/Usermode/Applications/axwin4_src/Server/IWindow.cpp b/Usermode/Applications/axwin4_src/Server/IWindow.cpp deleted file mode 100644 index 4243e33a..00000000 --- a/Usermode/Applications/axwin4_src/Server/IWindow.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* - * - */ -#include - -namespace AxWin { - - -IWindow::IWindow(const std::string &name): - m_name(name) -{ -} - -} // namespace AxWin - diff --git a/Usermode/Applications/axwin4_src/Server/Makefile b/Usermode/Applications/axwin4_src/Server/Makefile index ab829634..5f6ced4d 100644 --- a/Usermode/Applications/axwin4_src/Server/Makefile +++ b/Usermode/Applications/axwin4_src/Server/Makefile @@ -2,7 +2,12 @@ include ../../Makefile.cfg CPPFLAGS += -Iinclude/ -OBJ := IWindow.o +OBJ := main.o ipc.o CConfig.o video.o input.o timing.o +OBJ += compositor.o CWindow.o +OBJ += serialisation.o CClient.o +OBJ += CRect.o BIN := AxWinServer +LDFLAGS += -lc++ + include ../../Makefile.tpl diff --git a/Usermode/Applications/axwin4_src/Server/compositor.cpp b/Usermode/Applications/axwin4_src/Server/compositor.cpp index db943c57..497bf741 100644 --- a/Usermode/Applications/axwin4_src/Server/compositor.cpp +++ b/Usermode/Applications/axwin4_src/Server/compositor.cpp @@ -5,28 +5,20 @@ * compositor.cpp * - Window compositor */ -#include +#include +#include #include namespace AxWin { -CCompositor* CCompositor::s_instance; - -void CCompositor::Initialise(const CConfigCompositor& config) -{ - assert(!CCompositor::s_instance); - CCompositor::s_instance = new CCompositor(config); -} - -CCompositor::CCompositor(const CConfigCompositor& config): - m_config(config) +CCompositor::CCompositor() { // } -IWindow* CCompositor::CreateWindow(CClient& client) +CWindow* CCompositor::CreateWindow(CClient& client) { - return new CWindow(client); + return new CWindow(client, "TODO"); } void CCompositor::Redraw() @@ -35,12 +27,28 @@ void CCompositor::Redraw() if( m_damageRects.empty() ) return ; - // For all windows, check for intersection with damage rect + // Build up foreground grid (Rects and windows) + // - This should already be built (mutated on window move/resize/reorder) + + // For all windows, check for intersection with damage rects + for( auto rect : m_damageRects ) + { + for( auto window : m_windows ) + { + if( rect.Contains( window->m_rect ) ) + { + window->Repaint( rect ); + } + } + } + + m_damageRects.clear(); } -void CCompositor::DamageArea(const Rect& area) +void CCompositor::DamageArea(const CRect& area) { - + // 1. Locate intersection with any existing damaged areas + // 2. Append after removing intersections } } // namespace AxWin diff --git a/Usermode/Applications/axwin4_src/Server/include/CClient.hpp b/Usermode/Applications/axwin4_src/Server/include/CClient.hpp new file mode 100644 index 00000000..44961da7 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/CClient.hpp @@ -0,0 +1,38 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * CClient.hpp + * - IPC Client + */ +#ifndef _CCLIENT_H_ +#define _CCLIENT_H_ + +#include "CWindow.hpp" +#include "serialisation.hpp" + +class IIPCChannel; + +namespace AxWin { + +class CClient +{ + IIPCChannel& m_channel; + + //::std::map m_windows; + CWindow* m_windows[1]; +public: + CClient(IIPCChannel& channel); + ~CClient(); + + CWindow* GetWindow(int ID); + void SetWindow(int ID, CWindow* window); + + void SendMessage(CSerialiser& reply); +}; + + +}; + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/CCompositor.hpp b/Usermode/Applications/axwin4_src/Server/include/CCompositor.hpp index f6f2e7f1..e86286a6 100644 --- a/Usermode/Applications/axwin4_src/Server/include/CCompositor.hpp +++ b/Usermode/Applications/axwin4_src/Server/include/CCompositor.hpp @@ -8,7 +8,30 @@ #ifndef _CCOMPOSITOR_H_ #define _CCOMPOSITOR_H_ +#include +#include "CRect.hpp" +#include "CWindow.hpp" +namespace AxWin { + +class CClient; + +class CCompositor +{ + ::std::list m_damageRects; + ::std::list m_windows; + +public: + CCompositor(); + + CWindow* CreateWindow(CClient& client); + + void Redraw(); + void DamageArea(const CRect& rect); +}; + + +}; #endif diff --git a/Usermode/Applications/axwin4_src/Server/include/CConfigIPC.hpp b/Usermode/Applications/axwin4_src/Server/include/CConfigIPC.hpp new file mode 100644 index 00000000..9e10dd9a --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/CConfigIPC.hpp @@ -0,0 +1,22 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * CConfigIPC.hpp + * - Configuration class + */ +#ifndef _CCONFIGIPC_H_ +#define _CCONFIGIPC_H_ + +namespace AxWin { + +class CConfigIPC +{ +public: + CConfigIPC(); +}; + +}; // namespace AxWin + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/CConfigInput.hpp b/Usermode/Applications/axwin4_src/Server/include/CConfigInput.hpp new file mode 100644 index 00000000..1aeb9a7d --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/CConfigInput.hpp @@ -0,0 +1,22 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * CConfig.hpp + * - Configuration class + */ +#ifndef _CCONFIGINPUT_H_ +#define _CCONFIGINPUT_H_ + +namespace AxWin { + +class CConfigInput +{ +public: + CConfigInput(); +}; + +}; // namespace AxWin + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/CConfigVideo.hpp b/Usermode/Applications/axwin4_src/Server/include/CConfigVideo.hpp new file mode 100644 index 00000000..9a81fb70 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/CConfigVideo.hpp @@ -0,0 +1,22 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * CConfigVideo.hpp + * - Configuration class + */ +#ifndef _CCONFIGVIDEO_H_ +#define _CCONFIGVIDEO_H_ + +namespace AxWin { + +class CConfigVideo +{ +public: + CConfigVideo(); +}; + +}; // namespace AxWin + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/CRect.hpp b/Usermode/Applications/axwin4_src/Server/include/CRect.hpp new file mode 100644 index 00000000..69e7c194 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/CRect.hpp @@ -0,0 +1,19 @@ +/* + */ +#ifndef _CRECT_H_ +#define _CRECT_H_ + +namespace AxWin { + +class CRect +{ +public: + CRect(int X, int Y, int W, int H); + + bool Contains(const CRect& other) const; +}; + +}; // namespace AxWin + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/CWindow.hpp b/Usermode/Applications/axwin4_src/Server/include/CWindow.hpp new file mode 100644 index 00000000..86b49c99 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/CWindow.hpp @@ -0,0 +1,42 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * CWindow.hpp + * - Window class + */ +#ifndef _CWINDOW_HPP_ +#define _CWINDOW_HPP_ + +#include +#include +#include +#include "CRect.hpp" + +namespace AxWin { + +class CClient; + +class CWindow +{ + CClient& m_client; +public: + CWindow(CClient& client, const ::std::string &name); + ~CWindow(); + + void Repaint(const CRect& rect); + + void MouseButton(int ButtonID, int X, int Y, bool Down); + void MouseMove(int NewX, int NewY); + void KeyEvent(::uint32_t Scancode, const ::std::string &Translated, bool Down); + + CRect m_rect; +private: + const ::std::string m_name; +}; + +}; // namespace AxWin + +#endif + + diff --git a/Usermode/Applications/axwin4_src/Server/include/IIPCChannel.hpp b/Usermode/Applications/axwin4_src/Server/include/IIPCChannel.hpp new file mode 100644 index 00000000..5063c4a9 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/IIPCChannel.hpp @@ -0,0 +1,26 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * IIPCChannel.hpp + * - IPC Channel interface + */ +#ifndef _IIPCCHANNEL_H_ +#define _IIPCCHANNEL_H_ + +namespace AxWin { + +class IIPCChannel +{ +public: + virtual ~IIPCChannel(); + + virtual int FillSelect(::fd_set& rfds) = 0; + virtual void HandleSelect(::fd_set& rfds) = 0; +}; + + +}; + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/IWindow.hpp b/Usermode/Applications/axwin4_src/Server/include/IWindow.hpp index 6d91cc19..83dd97f8 100644 --- a/Usermode/Applications/axwin4_src/Server/include/IWindow.hpp +++ b/Usermode/Applications/axwin4_src/Server/include/IWindow.hpp @@ -10,6 +10,7 @@ #include #include +#include #include "CRect.hpp" namespace AxWin { @@ -17,14 +18,14 @@ namespace AxWin { class IWindow { public: - virtual IWindow(const ::std::string &name); + IWindow(const ::std::string &name); virtual ~IWindow(); virtual void Repaint() = 0; virtual void MouseButton(int ButtonID, int X, int Y, bool Down); virtual void MouseMove(int NewX, int NewY); - virtual void KeyEvent(uint32_t Scancode, const ::std::string &Translated, bool Down); + virtual void KeyEvent(::uint32_t Scancode, const ::std::string &Translated, bool Down); protected: const ::std::string m_name; }; diff --git a/Usermode/Applications/axwin4_src/Server/include/compositor.hpp b/Usermode/Applications/axwin4_src/Server/include/compositor.hpp new file mode 100644 index 00000000..403d943c --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/compositor.hpp @@ -0,0 +1,22 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * compositor.hpp + * - Compositor Interface Header + */ +#ifndef _COMPOSITOR_H_ +#define _COMPOSITOR_H_ + +namespace AxWin { + +class CCompositor; + +namespace Compositor { + +}; // namespace Compositor + +}; // namespace AxWin + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/input.hpp b/Usermode/Applications/axwin4_src/Server/include/input.hpp new file mode 100644 index 00000000..6a430340 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/input.hpp @@ -0,0 +1,24 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * input.hpp + * - Input Interface Header + */ +#ifndef _INPUT_H_ +#define _INPUT_H_ + +#include + +namespace AxWin { +namespace Input { + +extern void Initialise(const CConfigInput& config); +extern int FillSelect(::fd_set& rfds); +extern void HandleSelect(::fd_set& rfds); + +}; +}; + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/ipc.hpp b/Usermode/Applications/axwin4_src/Server/include/ipc.hpp new file mode 100644 index 00000000..439f3eac --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/ipc.hpp @@ -0,0 +1,30 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * ipc.hpp + * - IPC Interface Header + */ +#ifndef _IPC_H_ +#define _IPC_H_ + +extern "C" { +#include +}; + +#include + +namespace AxWin { +class CCompositor; + +namespace IPC { + +extern void Initialise(const CConfigIPC& config, CCompositor* compositor); +extern int FillSelect(::fd_set& rfds); +extern void HandleSelect(::fd_set& rfds); + +}; // namespace IPC +}; // namespace AxWin + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/ipc_proto.hpp b/Usermode/Applications/axwin4_src/Server/include/ipc_proto.hpp new file mode 100644 index 00000000..f78bfbb8 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/ipc_proto.hpp @@ -0,0 +1,33 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * ipc_proto.hpp + * - IPC Protocol Header + */ +#ifndef _IPC_PROTO_H_ +#define _IPC_PROTO_H_ + +namespace AxWin { + +enum +{ + IPCMSG_PING, + IPCMSG_REPLY, + IPCMSG_CREATEWIN, + IPCMSG_CLOSEWIN, + IPCMSG_SETWINATTR, + IPCMSG_GETWINATTR, + + IPCMSG_RGNADD, + IPCMSG_RGNDEL, + IPCMSG_RGNSETATTR, + IPCMSG_RGNPUSHDATA, + + IPCMSG_SENDIPC, +}; + +}; + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/serialisation.hpp b/Usermode/Applications/axwin4_src/Server/include/serialisation.hpp new file mode 100644 index 00000000..f0cc600c --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/serialisation.hpp @@ -0,0 +1,41 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * serialisation.hpp + * - Generic (de)serialisation code + */ +#ifndef _SERIALISATION_H_ +#define _SERIALISATION_H_ + +#include +#include +#include + +namespace AxWin { + +class CDeserialiseException: + public ::std::exception +{ +}; + +class CDeserialiser +{ +public: + CDeserialiser(size_t Length, const void *Buffer); + ::uint8_t ReadU8(); + ::uint16_t ReadU16(); +}; + +class CSerialiser +{ +public: + CSerialiser(); + void WriteU8(::uint8_t val); + void WriteU16(::uint16_t val); +}; + +}; + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/timing.hpp b/Usermode/Applications/axwin4_src/Server/include/timing.hpp new file mode 100644 index 00000000..df5d814c --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/timing.hpp @@ -0,0 +1,23 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * timing.hpp + * - Timing Interface Header + */ +#ifndef _TIMING_H_ +#define _TIMING_H_ + +#include + +namespace AxWin { +namespace Timing { + +extern ::int64_t GetTimeToNextEvent(); +extern void CheckEvents(); + +}; // namespace Timing +}; // namespace AxWin + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/video.hpp b/Usermode/Applications/axwin4_src/Server/include/video.hpp new file mode 100644 index 00000000..cf0440b2 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/video.hpp @@ -0,0 +1,23 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * video.hpp + * - Graphics Interface Header + */ +#ifndef _VIDEO_H_ +#define _VIDEO_H_ + +#include "CConfigVideo.hpp" + +namespace AxWin { +namespace Graphics { + +extern void Initialise(const CConfigVideo& config); + +}; + +}; + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/input.cpp b/Usermode/Applications/axwin4_src/Server/input.cpp new file mode 100644 index 00000000..bea47775 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/input.cpp @@ -0,0 +1,32 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * input.cpp + * - Input + */ +#include +#include + +namespace AxWin { + +namespace Input { + +void Initialise(const ::AxWin::CConfigInput& config) +{ + +} + +int FillSelect(::fd_set& rfds) +{ + return 0; +} + +void HandleSelect(::fd_set& rfds) +{ +} + +}; + +}; // namespace AxWin + diff --git a/Usermode/Applications/axwin4_src/Server/ipc.cpp b/Usermode/Applications/axwin4_src/Server/ipc.cpp new file mode 100644 index 00000000..0d92e6ac --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/ipc.cpp @@ -0,0 +1,168 @@ +/* + */ +#include +#include +#include +#include +#include +#include +#include +#include +extern "C" { +#include +}; + +namespace AxWin { +namespace IPC { + +CCompositor* gpCompositor; +::std::list channels; + +void Initialise(const CConfigIPC& config, CCompositor* compositor) +{ + gpCompositor = compositor; + //for( auto channel : config.m_channels ) + //{ + // channels.push_back( ); + //} +} + +int FillSelect(fd_set& rfds) +{ + int ret = 0; + for( auto channel : channels ) + { + ret = ::std::max(ret, channel->FillSelect(rfds)); + } + return ret; +} + +void HandleSelect(fd_set& rfds) +{ + +} + +void RegisterClient(IIPCChannel& channel, CClient& client) +{ + +} + + + +typedef void MessageHandler_op_t(CClient& client, CDeserialiser& message); +MessageHandler_op_t HandleMessage_Ping; +MessageHandler_op_t HandleMessage_GetWindowAttr; +MessageHandler_op_t HandleMessage_Reply; +MessageHandler_op_t HandleMessage_CreateWindow; +MessageHandler_op_t HandleMessage_CloseWindow; +MessageHandler_op_t HandleMessage_SetWindowAttr; +MessageHandler_op_t HandleMessage_AddRegion; +MessageHandler_op_t HandleMessage_DelRegion; +MessageHandler_op_t HandleMessage_SetRegionAttr; +MessageHandler_op_t HandleMessage_PushData; +MessageHandler_op_t HandleMessage_SendIPC; + +MessageHandler_op_t *message_handlers[] = { + [IPCMSG_PING] = &HandleMessage_Ping, + [IPCMSG_REPLY] = &HandleMessage_Reply, + + [IPCMSG_CREATEWIN] = &HandleMessage_CreateWindow, + [IPCMSG_CLOSEWIN] = &HandleMessage_CloseWindow, + [IPCMSG_SETWINATTR] = &HandleMessage_SetWindowAttr, + [IPCMSG_GETWINATTR] = &HandleMessage_GetWindowAttr, + + [IPCMSG_RGNADD] = &HandleMessage_AddRegion, + [IPCMSG_RGNDEL] = &HandleMessage_DelRegion, + [IPCMSG_RGNSETATTR] = &HandleMessage_SetRegionAttr, + [IPCMSG_RGNPUSHDATA]= &HandleMessage_PushData, // to a region + [IPCMSG_SENDIPC] = &HandleMessage_SendIPC, // Use the GUI server for low-bandwith inter-process messaging +}; + +void HandleMessage(CClient& client, CDeserialiser& message) +{ + unsigned int command = message.ReadU8(); + if( command >= sizeof(message_handlers)/sizeof(IPC::MessageHandler_op_t*) ) { + // Drop, invalid command + return ; + } + + (message_handlers[command])(client, message); +} + +void HandleMessage_Reply(CClient& client, CDeserialiser& message) +{ + // Reply to a sent message + // - Not many messages need server-bound replies + int orig_command = message.ReadU8(); + switch(orig_command) + { + case IPCMSG_PING: + // Ping reply, mark client as still responding + break; + default: + // Unexpected reply + break; + } +} + +void HandleMessage_Ping(CClient& client, CDeserialiser& message) +{ + // A client has asked for a ping, we pong them back + CSerialiser reply; + reply.WriteU8(IPCMSG_REPLY); + reply.WriteU8(IPCMSG_PING); + client.SendMessage(reply); +} + +void HandleMessage_CreateWindow(CClient& client, CDeserialiser& message) +{ + uint16_t parent_id = message.ReadU16(); + uint16_t new_id = message.ReadU16(); + CWindow* parent = client.GetWindow( parent_id ); + + client.SetWindow( new_id, gpCompositor->CreateWindow(client) ); +} + +void HandleMessage_CloseWindow(CClient& client, CDeserialiser& message) +{ + assert(!"TODO"); +} + +void HandleMessage_SetWindowAttr(CClient& client, CDeserialiser& message) +{ + assert(!"TODO"); +} + +void HandleMessage_GetWindowAttr(CClient& client, CDeserialiser& message) +{ + assert(!"TODO"); +} + +void HandleMessage_AddRegion(CClient& client, CDeserialiser& message) +{ + assert(!"TODO"); +} + +void HandleMessage_DelRegion(CClient& client, CDeserialiser& message) +{ + assert(!"TODO"); +} + +void HandleMessage_SetRegionAttr(CClient& client, CDeserialiser& message) +{ + assert(!"TODO"); +} + +void HandleMessage_PushData(CClient& client, CDeserialiser& message) +{ + assert(!"TODO"); +} + +void HandleMessage_SendIPC(CClient& client, CDeserialiser& message) +{ + assert(!"TODO"); +} + +}; +}; // namespace AxWin + diff --git a/Usermode/Applications/axwin4_src/Server/main.cpp b/Usermode/Applications/axwin4_src/Server/main.cpp index 362661ab..e14ef135 100644 --- a/Usermode/Applications/axwin4_src/Server/main.cpp +++ b/Usermode/Applications/axwin4_src/Server/main.cpp @@ -4,7 +4,15 @@ #include #include #include +#include #include +#include +#include + +extern "C" { +#include +#include +}; using namespace AxWin; @@ -22,13 +30,13 @@ int main(int argc, char *argv[]) } // - Open graphics Graphics::Initialise(config.m_video); + // - Initialise compositor structures + CCompositor* compositor = new CCompositor(/*config.m_compositor*/); // - Open input Input::Initialise(config.m_input); // > Handles hotkeys? - // - Initialise compositor structures - Compositor::Initialise(config.m_compositor); // - Bind IPC channels - IPC::Initialise(config.m_ipc); + IPC::Initialise(config.m_ipc, compositor); // - Start root child process (from config) // TODO: Spin up child process @@ -38,19 +46,19 @@ int main(int argc, char *argv[]) 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(); + compositor->Redraw(); } return 0; } diff --git a/Usermode/Applications/axwin4_src/Server/serialisation.cpp b/Usermode/Applications/axwin4_src/Server/serialisation.cpp new file mode 100644 index 00000000..c4338cb6 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/serialisation.cpp @@ -0,0 +1,36 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * serialisation.cpp + * - IPC Serialisation + */ +#include +#include + +namespace AxWin { + +CDeserialiser::CDeserialiser(size_t Length, const void *Buffer) +{ +} + +::uint8_t CDeserialiser::ReadU8() +{ + return 0; +} + +::uint16_t CDeserialiser::ReadU16() +{ + return 0; +} + +CSerialiser::CSerialiser() +{ +} + +void CSerialiser::WriteU8(::uint8_t Value) +{ +} + +}; // namespace AxWin + diff --git a/Usermode/Applications/axwin4_src/Server/timing.cpp b/Usermode/Applications/axwin4_src/Server/timing.cpp new file mode 100644 index 00000000..18740098 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/timing.cpp @@ -0,0 +1,25 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * timing.cpp + * - Timing code + */ +#include + +namespace AxWin { +namespace Timing { + +int64_t GetTimeToNextEvent() +{ + return 10*1000; +} + +void CheckEvents() +{ + +} + +}; // namespace Timing +}; // namespace AxWin + diff --git a/Usermode/Applications/axwin4_src/Server/video.cpp b/Usermode/Applications/axwin4_src/Server/video.cpp new file mode 100644 index 00000000..a3949221 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/video.cpp @@ -0,0 +1,21 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * video.cpp + * - Graphics output + */ +#include + +namespace AxWin { + +namespace Graphics { + +void Initialise(const CConfigVideo& config) +{ +} + +}; + +}; // namespace AxWin +