#include <CWindow.hpp>
#include <CCompositor.hpp>
#include <assert.h>
+#include <ipc.hpp>
namespace AxWin {
-CWindow::CWindow(CCompositor& compositor, CClient& client, const ::std::string& name):
+CWindow::CWindow(CCompositor& compositor, CClient& client, const ::std::string& name, unsigned int id):
m_surface(0,0,0,0),
m_compositor(compositor),
m_client(client),
- m_name(name)
+ m_id(id),
+ m_name(name),
+ m_is_shown(false)
{
_SysDebug("CWindow::CWindow()");
}
void CWindow::Repaint(const CRect& rect)
{
- #if 0
- for( auto rgn : m_regions )
+ if( m_is_shown )
{
- if( rect.Contains(rgn->m_rect) )
- {
- CRect rel_rect(rect, rgn->m_rect);
- rgn->Repaint(m_surface, rel_rect);
- }
+ CRect outrect(
+ m_surface.m_rect.m_x + rect.m_x,
+ m_surface.m_rect.m_y + rect.m_y,
+ rect.m_w, rect.m_h
+ );
+ m_compositor.DamageArea(outrect);
}
- #endif
}
void CWindow::Show(bool bShow)
{
- assert(!"TODO: CWindow::Show");
+ if( m_is_shown == bShow )
+ return;
+
+ if( bShow )
+ m_compositor.ShowWindow( this );
+ else
+ m_compositor.HideWindow( this );
+ m_is_shown = bShow;
}
void CWindow::Move(int X, int Y)
{
- assert(!"TODO: CWindow::Move");
+ m_surface.m_rect.Move(X, Y);
}
void CWindow::Resize(unsigned int W, unsigned int H)
{
- assert(!"TODO: CWindow::Resize");
+ m_surface.Resize(W, H);
+ IPC::SendMessage_NotifyDims(m_client, W, H);
+}
+void CWindow::SetFlags(uint32_t Flags)
+{
+ // TODO: CWindow::SetFlags
+ _SysDebug("TOOD: CWindow::SetFlags");
}
uint64_t CWindow::ShareSurface()
{
{
}
+
+void CWindow::DrawScanline(unsigned int row, unsigned int x, unsigned int w, const uint8_t *data)
+{
+ m_surface.DrawScanline(row, x, w, data);
+ CRect damaged( m_surface.m_rect.m_x+x, m_surface.m_rect.m_y+row, w, 1 );
+ m_compositor.DamageArea(damaged);
+}
+
};