::uint16_t ReadU16();
::int16_t ReadS16();
const ::std::string ReadString();
+private:
+ void RangeCheck(const char *Method, size_t bytes) throw(::std::out_of_range);
};
class CSerialiser
#include <serialisation.hpp>
#include <cstddef>
#include <stdexcept>
+#include <acess/sys.h> // SysDebug
namespace AxWin {
const ::std::string CDeserialiser::ReadString()
{
- if( m_offset + 1 >= m_length )
- throw ::std::out_of_range("CDeserialiser::ReadString");
+ RangeCheck("CDeserialiser::ReadString(len)", 1);
uint8_t len = m_data[m_offset];
m_offset ++;
- if( m_offset + len >= m_length )
- throw ::std::out_of_range("CDeserialiser::ReadString");
-
+ RangeCheck("CDeserialiser::ReadString(data)", len);
::std::string ret( reinterpret_cast<const char*>(m_data+m_offset), len );
m_offset += len;
return ret;
}
+void CDeserialiser::RangeCheck(const char *Method, size_t bytes) throw(::std::out_of_range)
+{
+ if( m_offset + bytes > m_length ) {
+ ::_SysDebug("%s - out of range %i+%i >= %i", Method, m_offset, bytes, m_length);
+ throw ::std::out_of_range(Method);
+ }
+}
+
CSerialiser::CSerialiser()
{
}
void CClient::SetWindow(int ID, CWindow* window)
{
+ _SysDebug("SetWindow(ID=%i,window=%p)", ID, window);
if( m_windows[ID] ) {
delete m_windows[ID];
}
+ _SysDebug("SetWindow - Set", ID, window);
m_windows[ID] = window;
+ _SysDebug("SetWindow - END");
}
void CClient::HandleMessage(CDeserialiser& message)
m_client(client),
m_name(name)
{
-
+ _SysDebug("CWindow::CWindow()");
}
CWindow::~CWindow()
#include "CWindow.hpp"
#include "serialisation.hpp"
+#include <map>
namespace AxWin {
{
IIPCChannel& m_channel;
- //::std::map<unsigned int,CWindow*> m_windows;
- CWindow* m_windows[1];
+ ::std::map<unsigned int,CWindow*> m_windows;
+ //CWindow* m_windows[1];
public:
CClient(::AxWin::IIPCChannel& channel);
virtual ~CClient();
//CWindow* parent = client.GetWindow( parent_id );
::std::string name = message.ReadString();
+ ::_SysDebug("_CreateWindow: (%i, '%s')", new_id, name.c_str());
client.SetWindow( new_id, gpCompositor->CreateWindow(client, name) );
}
return ;
}
+ _SysDebug("IPC::HandleMessage - command=%i", command);
(message_handlers[command])(client, message);
+ _SysDebug("IPC::HandleMessage - Completed");
}
CClientFailure::CClientFailure(std::string&& what):
}
_SysDebug("rv=%i, timeout=%lli", rv, timeout);
- Timing::CheckEvents();
-
- input->HandleSelect(rfds);
- IPC::HandleSelect(rfds);
-
- compositor->Redraw();
+ try {
+ Timing::CheckEvents();
+
+ input->HandleSelect(rfds);
+ IPC::HandleSelect(rfds);
+
+ compositor->Redraw();
+ }
+ catch(...) {
+ ::_SysDebug("Exception during select handling");
+ }
}
return 0;
}
SetBufFormat(PTYBUFFMT_2DCMD);
_SysWrite(m_fd, &hdr, sizeof(hdr));
- _SysDebug("size = %i (%04x:%02x * 4)", size, hdr.len_hi, hdr.len_low);
+ _SysDebug("SetCursorBitmap - size = %i (%04x:%02x * 4)", size, hdr.len_hi, hdr.len_low);
_SysWrite(m_fd, &cCursorBitmap, size-sizeof(hdr));
}