Usermode/AxWin4 - Tweak handling of AcessNative (doesn't have SHM and mmap)
[tpg/acess2.git] / Usermode / Applications / axwin4_src / Server / CWindow.cpp
1 /*
2  * Acess2 GUI v4
3  * - By John Hodge (thePowersGang)
4  *
5  * CWindow.cpp
6  * - Window
7  */
8 #include <CWindow.hpp>
9 #include <CCompositor.hpp>
10 #include <assert.h>
11 #include <ipc.hpp>
12
13 namespace AxWin {
14
15 CWindow::CWindow(CCompositor& compositor, CClient& client, const ::std::string& name):
16         m_surface(0,0,0,0),
17         m_compositor(compositor),
18         m_client(client),
19         m_name(name),
20         m_is_shown(false)
21 {
22         _SysDebug("CWindow::CWindow()");
23 }
24
25 CWindow::~CWindow()
26 {
27 }
28
29 void CWindow::Repaint(const CRect& rect)
30 {
31         if( m_is_shown )
32         {
33                 CRect   outrect(
34                         m_surface.m_rect.m_x + rect.m_x, 
35                         m_surface.m_rect.m_y + rect.m_y, 
36                         rect.m_w, rect.m_h
37                         );
38                 m_compositor.DamageArea(outrect);
39         }
40 }
41
42 void CWindow::Show(bool bShow)
43 {
44         if( m_is_shown == bShow )
45                 return;
46         
47         if( bShow )
48                 m_compositor.ShowWindow( this );
49         else
50                 m_compositor.HideWindow( this );
51         m_is_shown = bShow;
52 }
53
54 void CWindow::Move(int X, int Y)
55 {
56         m_surface.m_rect.Move(X, Y);
57 }
58 void CWindow::Resize(unsigned int W, unsigned int H)
59 {
60         m_surface.Resize(W, H);
61         IPC::SendMessage_NotifyDims(m_client, W, H);
62 }
63 void CWindow::SetFlags(uint32_t Flags)
64 {
65         // TODO: CWindow::SetFlags
66         _SysDebug("TOOD: CWindow::SetFlags");
67 }
68 uint64_t CWindow::ShareSurface()
69 {
70         assert(!"TODO: CWindow::ShareSurface");
71         return 0;
72 }
73
74 void CWindow::MouseButton(int ButtonID, int X, int Y, bool Down)
75 {
76 }
77
78 void CWindow::MouseMove(int NewX, int NewY)
79 {
80 }
81
82 void CWindow::KeyEvent(::uint32_t Scancode, const ::std::string &Translated, bool Down)
83 {
84 }
85
86
87 void CWindow::DrawScanline(unsigned int row, unsigned int x, unsigned int w, const uint8_t *data)
88 {
89         m_surface.DrawScanline(row, x, w, data);
90         CRect   damaged( m_surface.m_rect.m_x+x, m_surface.m_rect.m_y+row, w, 1 );
91         m_compositor.DamageArea(damaged);
92 }
93
94 };
95

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