Usermode/AxWin4 - Send mouse/keyboard events to client
[tpg/acess2.git] / Usermode / Applications / axwin4_src / Server / include / CCompositor.hpp
1 /*
2  * Acess2 GUI v4
3  * - By John Hodge (thePowersGang) 
4  *
5  * CCompositor.hpp
6  * - Window Compositor
7  */
8 #ifndef _CCOMPOSITOR_H_
9 #define _CCOMPOSITOR_H_
10
11 #include <string>
12 #include <list>
13 #include <vector>
14 #include "CRect.hpp"
15 #include "CWindow.hpp"
16
17 namespace AxWin {
18
19 class CClient;
20 class CVideo;
21
22
23 enum eMouseButton
24 {
25         MOUSEBTN_MAIN,  // Left
26         MOUSEBTN_SECONDARY,     // Right
27         MOUSEBTN_MIDDLE,        // Scroll wheel
28         MOUSEBTN_BTN4,
29         MOUSEBTN_BTN5,
30 };
31
32 class CWindowIDBuffer
33 {
34         struct TWindowID
35         {
36                 uint16_t        Client;
37                 uint16_t        Window;
38         };
39         unsigned int    m_w;
40         ::std::vector<TWindowID>        m_buf;
41 public:
42         CWindowIDBuffer(unsigned int W, unsigned int H);
43         
44         void set(unsigned int X, unsigned int Y, unsigned int W, unsigned int H, CWindow* win);
45         CWindow* get(unsigned int X, unsigned int Y);
46 };
47
48 class CCompositor
49 {
50         CVideo& m_video;
51         ::std::list<CRect>      m_damageRects;
52         ::std::list<CWindow*>   m_windows;
53         CWindow*        m_focussed_window;
54
55         CWindowIDBuffer m_windowIDBuffer;       // One 32-bit value per pixel
56         
57 public:
58         CCompositor(CVideo& video);
59
60         CWindow* CreateWindow(CClient& client, const ::std::string& name);
61
62         void    ShowWindow(CWindow* window);
63         void    HideWindow(CWindow* window);
64
65         bool    GetScreenDims(unsigned int ScrenID, unsigned int *Width, unsigned int *Height);
66
67         void    Redraw();
68         void    DamageArea(const CRect& rect);
69         void    BlitFromSurface(const CSurface& dest, const CRect& src_rect);
70         
71         void    MouseMove(unsigned int Cursor, unsigned int X, unsigned int Y, int dX, int dY);
72         void    MouseButton(unsigned int Cursor, unsigned int X, unsigned int Y, eMouseButton Button, bool Press);
73         
74         void    KeyState(unsigned int KeyboardID, uint32_t KeySym, bool Press, uint32_t Codepoint);
75 public:
76         CWindow*        getWindowForCoord(unsigned int X, unsigned int Y);
77 };
78
79
80 };
81
82 #endif
83

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