uterm_input: introduce UTERM_INPUT_HAS_MODS()
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 27 May 2012 14:43:26 +0000 (16:43 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 27 May 2012 14:43:26 +0000 (16:43 +0200)
This is a convenient macro to check whether a given set of modifiers is
enabled on the given input event.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/uterm.h

index 967961e..413d600 100644 (file)
@@ -253,6 +253,8 @@ struct uterm_input_event {
        uint32_t unicode;       /* ucs4 unicode value or UTERM_INPUT_INVALID */
 };
 
+#define UTERM_INPUT_HAS_MODS(_ev, _mods) (((_ev)->mods & (_mods)) == (_mods))
+
 typedef void (*uterm_input_cb) (struct uterm_input *input,
                                struct uterm_input_event *ev,
                                void *data);