diff --git a/repos/os/include/input/event.h b/repos/os/include/input/event.h index bb949f6fa6..e27876e13f 100644 --- a/repos/os/include/input/event.h +++ b/repos/os/include/input/event.h @@ -83,10 +83,22 @@ class Input::Event ((unsigned)utf8.b1 << 8) | ((unsigned)utf8.b0 << 0)) { } + /** + * Return event type + */ + Type type() const + { + /* prevent obnoxious events from being processed by clients */ + if ((_type == PRESS || _type == RELEASE) + && (_code <= KEY_RESERVED || _code >= KEY_UNKNOWN)) + return INVALID; + + return _type; + } + /** * Accessors */ - Type type() const { return _type; } int code() const { return _code; } int ax() const { return _ax; } int ay() const { return _ay; }