]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/mag/include/server/input_source
a1522aa560ad585c07778ecda31ff4fc99b29f08
[l4.git] / l4 / pkg / mag / include / server / input_source
1 // vi:ft=cpp
2 /*
3  * (c) 2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
4  *          Alexander Warg <warg@os.inf.tu-dresden.de>
5  *     economic rights: Technische Universität Dresden (Germany)
6  *
7  * This file is part of TUD:OS and distributed under the terms of the
8  * GNU General Public License 2.
9  * Please see the COPYING-GPL-2 file for details.
10  */
11 #pragma once
12
13 #include <l4/re/event>
14
15 struct lua_State;
16
17 namespace Mag_server {
18
19 class Core_api;
20
21 class Input_source
22 {
23 private:
24   friend class Core_api;
25   Input_source *_next_active;
26
27   void add_lua_input_source(lua_State *l, int ref_table);
28
29 protected:
30   Core_api *_core;
31   int _ref;
32
33 public:
34   explicit Input_source(Core_api *core = 0) : _core(core) {}
35   virtual void poll_events() = 0;
36   void post_event(L4Re::Event_buffer::Event const *e);
37   Input_source *next() const { return _next_active; }
38   virtual int get_stream_info(l4_umword_t stream_id, L4Re::Event_stream_info *info) = 0;
39   virtual int get_axis_info(l4_umword_t stream_id, unsigned naxes, unsigned *axes, L4Re::Event_absinfo *info) = 0;
40 };
41
42
43 }