2 * (c) 2010 Alexander Warg <warg@os.inf.tu-dresden.de>
3 * economic rights: Technische Universität Dresden (Germany)
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.
9 #include <l4/mag-gfx/canvas>
11 #include <l4/mag/server/view>
12 #include <l4/mag/server/session>
14 #include <l4/re/console>
15 #include <l4/re/util/video/goos_svr>
16 #include <l4/re/util/event_svr>
17 #include <l4/sys/cxx/ipc_epiface>
18 #include <l4/re/util/cap_alloc>
20 #include <l4/re/util/icu_svr>
21 #include <l4/mag/server/plugin>
23 namespace Mag_server {
26 : public View, public Session,
27 public L4::Epiface_t<Client_fb, L4Re::Console, Object>,
28 public L4Re::Util::Video::Goos_svr,
29 public L4Re::Util::Icu_cap_array_svr<Client_fb>
32 typedef L4Re::Util::Icu_cap_array_svr<Client_fb> Icu_svr;
33 Core_api const *_core;
37 L4Re::Util::Auto_cap<L4Re::Dataspace>::Cap _ev_ds;
38 L4Re::Rm::Auto_region<void*> _ev_ds_m;
39 L4Re::Event_buffer _events;
44 F_fb_fixed_location = 1 << 0,
54 explicit Client_fb(Core_api const *core);
58 void draw(Canvas *, View_stack const *, Mode) const;
59 void handle_event(Hid_report *e, Point const &mouse, bool core_dev);
60 bool handle_core_event(Hid_report *e, Point const &mouse);
62 int get_stream_info_for_id(l4_umword_t id, L4Re::Event_stream_info *info);
63 int get_abs_info(l4_umword_t id, unsigned naxes, unsigned const *axes,
64 L4Re::Event_absinfo *infos);
66 using L4Re::Util::Video::Goos_svr::op_info;
67 using Icu_svr::op_info;
68 int refresh(int x, int y, int w, int h);
70 Area visible_size() const;
74 Session *session() const { return const_cast<Client_fb*>(this); }
76 static void set_geometry_prop(Session *s, Property_handler const *p, cxx::String const &v);
77 static void set_flags_prop(Session *s, Property_handler const *p, cxx::String const &v);
78 static void set_bar_height_prop(Session *s, Property_handler const *p, cxx::String const &v);
80 void put_event(l4_umword_t stream, int type, int code, int value,
83 long op_get_buffer(L4Re::Event::Rights, L4::Ipc::Cap<L4Re::Dataspace> &ds)
86 ds = L4::Ipc::Cap<L4Re::Dataspace>(_ev_ds.get(), L4_CAP_FPAGE_RW);
90 long op_get_num_streams(L4Re::Event::Rights)
91 { return -L4_ENOSYS; }
93 long op_get_stream_info(L4Re::Event::Rights, int, L4Re::Event_stream_info &)
94 { return -L4_ENOSYS; }
96 long op_get_stream_info_for_id(L4Re::Event::Rights, l4_umword_t id,
97 L4Re::Event_stream_info &info)
98 { return get_stream_info_for_id(id, &info); }
100 long op_get_axis_info(L4Re::Event::Rights, l4_umword_t id,
101 L4::Ipc::Array_in_buf<unsigned, unsigned long> const &axes,
102 L4::Ipc::Array_ref<L4Re::Event_absinfo, unsigned long> &info)
104 unsigned naxes = cxx::min<unsigned>(L4RE_ABS_MAX, axes.length);
108 L4Re::Event_absinfo _info[naxes];
109 int r = get_abs_info(id, naxes, axes.data, _info);
113 for (unsigned i = 0; i < naxes; ++i)
114 info.data[i] = _info[i];
120 long op_get_stream_state_for_id(L4Re::Event::Rights, l4_umword_t,
121 L4Re::Event_stream_state &)
122 { return -L4_ENOSYS; }