blob: 8d78455e1337f7dc16b0743086e8aed677a2c5a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#ifndef SEEN_MODIFIER_FNS_H
#define SEEN_MODIFIER_FNS_H
/** \file
* Functions on GdkEventKey.state that test modifier keys.
*
* The MOD__SHIFT macro in macros.h is equivalent to mod_shift(event-\>key.state).
*/
/*
* Hereby placed in public domain.
*/
#include <gdk/gdktypes.h>
#include <glib/gtypes.h>
inline bool
mod_shift(guint const state)
{
return state & GDK_SHIFT_MASK;
}
inline bool
mod_ctrl(guint const state)
{
return state & GDK_CONTROL_MASK;
}
inline bool
mod_alt(guint const state)
{
return state & GDK_MOD1_MASK;
}
inline bool
mod_shift_only(guint const state)
{
return (state & GDK_SHIFT_MASK) && !(state & GDK_CONTROL_MASK) && !(state & GDK_MOD1_MASK);
}
inline bool
mod_ctrl_only(guint const state)
{
return !(state & GDK_SHIFT_MASK) && (state & GDK_CONTROL_MASK) && !(state & GDK_MOD1_MASK);
}
inline bool
mod_alt_only(guint const state)
{
return !(state & GDK_SHIFT_MASK) && !(state & GDK_CONTROL_MASK) && (state & GDK_MOD1_MASK);
}
#endif /* !SEEN_MODIFIER_FNS_H */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
|