Usermode/AxWin4 - Code now compiling (if STL is present)
authorJohn Hodge <[email protected]>
Sun, 18 May 2014 14:00:34 +0000 (22:00 +0800)
committerJohn Hodge <[email protected]>
Sun, 18 May 2014 14:00:34 +0000 (22:00 +0800)
29 files changed:
Usermode/Applications/axwin4_src/Server/CClient.cpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/CConfig.cpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/CRect.cpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/CWindow.cpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/IWindow.cpp [deleted file]
Usermode/Applications/axwin4_src/Server/Makefile
Usermode/Applications/axwin4_src/Server/compositor.cpp
Usermode/Applications/axwin4_src/Server/include/CClient.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/CCompositor.hpp
Usermode/Applications/axwin4_src/Server/include/CConfigIPC.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/CConfigInput.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/CConfigVideo.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/CRect.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/CWindow.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/IIPCChannel.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/IWindow.hpp
Usermode/Applications/axwin4_src/Server/include/compositor.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/input.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/ipc.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/ipc_proto.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/serialisation.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/timing.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/video.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/input.cpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/ipc.cpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/main.cpp
Usermode/Applications/axwin4_src/Server/serialisation.cpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/timing.cpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/video.cpp [new file with mode: 0644]

diff --git a/Usermode/Applications/axwin4_src/Server/CClient.cpp b/Usermode/Applications/axwin4_src/Server/CClient.cpp
new file mode 100644 (file)
index 0000000..6f1f256
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * CClient.cpp
+ * - IPC Client
+ */
+#include <CClient.hpp>
+
+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 (file)
index 0000000..567f1a3
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * CConfig.cpp
+ * - Configuration
+ */
+#include <CConfig.hpp>
+
+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 (file)
index 0000000..5fd13c0
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * CRect.cpp
+ * - Rectangle
+ */
+#include <CRect.hpp>
+
+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 (file)
index 0000000..79308cc
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * CWindow.cpp
+ * - Window
+ */
+#include <CWindow.hpp>
+
+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 (file)
index 4243e33..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * 
- */
-#include <IWindow.hpp>
-
-namespace AxWin {
-
-
-IWindow::IWindow(const std::string &name):
-       m_name(name)
-{
-}
-
-}      // namespace AxWin
-
index ab82963..5f6ced4 100644 (file)
@@ -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
index db943c5..497bf74 100644 (file)
@@ -5,28 +5,20 @@
  * compositor.cpp
  * - Window compositor
  */
-#include <CVideo.hpp>
+#include <video.hpp>
+#include <compositor.hpp>
 #include <CCompositor.hpp>
 
 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 (file)
index 0000000..44961da
--- /dev/null
@@ -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<unsigned int,CWindow*>     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
+
index f6f2e7f..e86286a 100644 (file)
@@ -8,7 +8,30 @@
 #ifndef _CCOMPOSITOR_H_
 #define _CCOMPOSITOR_H_
 
+#include <list>
+#include "CRect.hpp"
+#include "CWindow.hpp"
 
+namespace AxWin {
+
+class CClient;
+
+class CCompositor
+{
+       ::std::list<CRect>      m_damageRects;
+       ::std::list<CWindow*>   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 (file)
index 0000000..9e10dd9
--- /dev/null
@@ -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 (file)
index 0000000..1aeb9a7
--- /dev/null
@@ -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 (file)
index 0000000..9a81fb7
--- /dev/null
@@ -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 (file)
index 0000000..69e7c19
--- /dev/null
@@ -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 (file)
index 0000000..86b49c9
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * CWindow.hpp
+ * - Window class
+ */
+#ifndef _CWINDOW_HPP_
+#define _CWINDOW_HPP_
+
+#include <string>
+#include <vector>
+#include <cstdint>
+#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 (file)
index 0000000..5063c4a
--- /dev/null
@@ -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
+
index 6d91cc1..83dd97f 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <string>
 #include <vector>
+#include <cstdint>
 #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 (file)
index 0000000..403d943
--- /dev/null
@@ -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 (file)
index 0000000..6a43034
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang) 
+ *
+ * input.hpp
+ * - Input Interface Header
+ */
+#ifndef _INPUT_H_
+#define _INPUT_H_
+
+#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);
+
+};
+};
+
+#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 (file)
index 0000000..439f3ea
--- /dev/null
@@ -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 <acess/sys.h>
+};
+
+#include <CConfigIPC.hpp>
+
+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 (file)
index 0000000..f78bfbb
--- /dev/null
@@ -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 (file)
index 0000000..f0cc600
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang) 
+ *
+ * serialisation.hpp
+ * - Generic (de)serialisation code
+ */
+#ifndef _SERIALISATION_H_
+#define _SERIALISATION_H_
+
+#include <cstdint>
+#include <cstddef>
+#include <exception>
+
+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 (file)
index 0000000..df5d814
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang) 
+ *
+ * timing.hpp
+ * - Timing Interface Header
+ */
+#ifndef _TIMING_H_
+#define _TIMING_H_
+
+#include <cstdint>
+
+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 (file)
index 0000000..cf0440b
--- /dev/null
@@ -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 (file)
index 0000000..bea4777
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * input.cpp
+ * - Input
+ */
+#include <CConfigInput.hpp>
+#include <input.hpp>
+
+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 (file)
index 0000000..0d92e6a
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ */
+#include <ipc.hpp>
+#include <list>
+#include <IIPCChannel.hpp>
+#include <algorithm>
+#include <CClient.hpp>
+#include <serialisation.hpp>
+#include <ipc_proto.hpp>
+#include <CCompositor.hpp>
+extern "C" {
+#include <assert.h>
+};
+
+namespace AxWin {
+namespace IPC {
+
+CCompositor*   gpCompositor;
+::std::list<IIPCChannel*>      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
+
index 362661a..e14ef13 100644 (file)
@@ -4,7 +4,15 @@
 #include <ipc.hpp>
 #include <input.hpp>
 #include <video.hpp>
+#include <CCompositor.hpp>
 #include <timing.hpp>
+#include <exception>
+#include <algorithm>
+
+extern "C" {
+#include <stdio.h>
+#include <stdint.h>
+};
 
 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 (file)
index 0000000..c4338cb
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang) 
+ *
+ * serialisation.cpp
+ * - IPC Serialisation
+ */
+#include <serialisation.hpp>
+#include <cstddef>
+
+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 (file)
index 0000000..1874009
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * timing.cpp
+ * - Timing code
+ */
+#include <timing.hpp>
+
+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 (file)
index 0000000..a394922
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * video.cpp
+ * - Graphics output
+ */
+#include <video.hpp>
+
+namespace AxWin {
+
+namespace Graphics {
+
+void Initialise(const CConfigVideo& config)
+{
+}
+
+};
+
+};     // namespace AxWin
+

UCC git Repository :: git.ucc.asn.au