mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-17 06:38:28 +00:00
committed by
Christian Helmuth
parent
56ed7addbc
commit
e8336acafc
@ -16,67 +16,67 @@
|
||||
|
||||
#include <input/keycodes.h>
|
||||
|
||||
namespace Input {
|
||||
namespace Input { class Event; }
|
||||
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
|
||||
enum Type { INVALID, MOTION, PRESS, RELEASE, WHEEL, FOCUS, LEAVE };
|
||||
class Input::Event
|
||||
{
|
||||
public:
|
||||
|
||||
private:
|
||||
enum Type { INVALID, MOTION, PRESS, RELEASE, WHEEL, FOCUS, LEAVE };
|
||||
|
||||
Type _type;
|
||||
private:
|
||||
|
||||
/*
|
||||
* For PRESS and RELEASE events, '_code' contains the key code.
|
||||
* For FOCUS events, '_code' is set to 1 (focus) or 0 (unfocus).
|
||||
*/
|
||||
int _code;
|
||||
Type _type;
|
||||
|
||||
/*
|
||||
* Absolute pointer position coordinates
|
||||
*/
|
||||
int _ax, _ay;
|
||||
/*
|
||||
* For PRESS and RELEASE events, '_code' contains the key code.
|
||||
* For FOCUS events, '_code' is set to 1 (focus) or 0 (unfocus).
|
||||
*/
|
||||
int _code;
|
||||
|
||||
/*
|
||||
* Relative pointer motion vector
|
||||
*/
|
||||
int _rx, _ry;
|
||||
/*
|
||||
* Absolute pointer position coordinates
|
||||
*/
|
||||
int _ax, _ay;
|
||||
|
||||
public:
|
||||
/*
|
||||
* Relative pointer motion vector
|
||||
*/
|
||||
int _rx, _ry;
|
||||
|
||||
/**
|
||||
* Constructors
|
||||
*/
|
||||
Event():
|
||||
_type(INVALID), _code(0), _ax(0), _ay(0), _rx(0), _ry(0) { }
|
||||
public:
|
||||
|
||||
Event(Type type, int code, int ax, int ay, int rx, int ry):
|
||||
_type(type), _code(code),
|
||||
_ax(ax), _ay(ay), _rx(rx), _ry(ry) { }
|
||||
/**
|
||||
* Constructors
|
||||
*/
|
||||
Event():
|
||||
_type(INVALID), _code(0), _ax(0), _ay(0), _rx(0), _ry(0) { }
|
||||
|
||||
/**
|
||||
* Accessors
|
||||
*/
|
||||
Type type() const { return _type; }
|
||||
int code() const { return _code; }
|
||||
int ax() const { return _ax; }
|
||||
int ay() const { return _ay; }
|
||||
int rx() const { return _rx; }
|
||||
int ry() const { return _ry; }
|
||||
Event(Type type, int code, int ax, int ay, int rx, int ry):
|
||||
_type(type), _code(code),
|
||||
_ax(ax), _ay(ay), _rx(rx), _ry(ry) { }
|
||||
|
||||
/**
|
||||
* Return key code for press/release events
|
||||
*/
|
||||
Keycode keycode() const
|
||||
{
|
||||
return _type == PRESS || _type == RELEASE ? (Keycode)_code : KEY_UNKNOWN;
|
||||
}
|
||||
/**
|
||||
* Accessors
|
||||
*/
|
||||
Type type() const { return _type; }
|
||||
int code() const { return _code; }
|
||||
int ax() const { return _ax; }
|
||||
int ay() const { return _ay; }
|
||||
int rx() const { return _rx; }
|
||||
int ry() const { return _ry; }
|
||||
|
||||
bool is_absolute_motion() const { return _type == MOTION && !_rx && !_ry; }
|
||||
bool is_relative_motion() const { return _type == MOTION && (_rx || _ry); }
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Return key code for press/release events
|
||||
*/
|
||||
Keycode keycode() const
|
||||
{
|
||||
return _type == PRESS || _type == RELEASE ? (Keycode)_code : KEY_UNKNOWN;
|
||||
}
|
||||
|
||||
bool is_absolute_motion() const { return _type == MOTION && !_rx && !_ry; }
|
||||
bool is_relative_motion() const { return _type == MOTION && (_rx || _ry); }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__INPUT__EVENT_H_ */
|
||||
|
Reference in New Issue
Block a user