]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/mag/plugins/client_fb/client_fb.h
update
[l4.git] / l4 / pkg / mag / plugins / client_fb / client_fb.h
1 /*
2  * (c) 2010 Alexander Warg <warg@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  */
9 #include <l4/mag-gfx/canvas>
10
11 #include <l4/mag/server/view>
12 #include <l4/mag/server/session>
13
14 #include <l4/re/util/video/goos_svr>
15 #include <l4/re/util/event_svr>
16 #include <l4/cxx/ipc_server>
17 #include <l4/re/util/cap_alloc>
18 #include <l4/re/rm>
19 #include <l4/re/util/icu_svr>
20 #include <l4/mag/server/plugin>
21
22 namespace Mag_server {
23
24 class Client_fb
25 : public View, public Session, public Object,
26   private L4Re::Util::Video::Goos_svr,
27   public L4Re::Util::Icu_cap_array_svr<Client_fb>
28 {
29 private:
30   typedef L4Re::Util::Icu_cap_array_svr<Client_fb> Icu_svr;
31   Core_api const *_core;
32   Texture *_fb;
33   int _bar_height;
34
35   L4Re::Util::Auto_cap<L4Re::Dataspace>::Cap _ev_ds;
36   L4Re::Rm::Auto_region<void*> _ev_ds_m;
37   L4Re::Event_buffer _events;
38   Irq _ev_irq;
39
40   enum
41   {
42     F_fb_fixed_location = 1 << 0,
43     F_fb_shaded         = 1 << 1,
44     F_fb_focus          = 1 << 2,
45   };
46   unsigned _flags;
47 public:
48   int setup();
49
50   explicit Client_fb(Core_api const *core);
51
52   L4::Cap<void> rcv_cap() const { return _core->rcv_cap(); }
53
54   void toggle_shaded();
55
56   void draw(Canvas *, View_stack const *, Mode) const;
57   void handle_event(L4Re::Event_buffer::Event const &e,
58                     Point const &mouse);
59
60   int dispatch(l4_umword_t obj, L4::Ipc_iostream &s);
61   int refresh(int x, int y, int w, int h);
62
63   Area visible_size() const;
64
65   void destroy();
66
67   Session *session() const { return const_cast<Client_fb*>(this); }
68
69   static void set_geometry_prop(Session *s, Property_handler const *p, cxx::String const &v);
70   static void set_flags_prop(Session *s, Property_handler const *p, cxx::String const &v);
71   static void set_bar_height_prop(Session *s, Property_handler const *p, cxx::String const &v);
72 };
73
74 }