aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/events.c
diff options
context:
space:
mode:
authorGravatar keis <keijser@gmail.com>2011-04-23 14:19:36 +0200
committerGravatar keis <keijser@gmail.com>2011-04-23 14:27:34 +0200
commit1e20430333aee952f55f6caec4d55238a0160bf9 (patch)
tree1fa786471bd098aba72ee6a82f064ea0a592027c /src/events.c
parentce01aad4cd04113a13beb5140c564993dd97fd6d (diff)
include current button press in modstate
like done in key_to_event
Diffstat (limited to 'src/events.c')
-rw-r--r--src/events.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/events.c b/src/events.c
index 3074b34..2da3e38 100644
--- a/src/events.c
+++ b/src/events.c
@@ -267,6 +267,12 @@ guint key_to_modifier(guint keyval) {
}
}
+guint button_to_modifier(guint buttonval) {
+ if(buttonval <= 5)
+ return 1 << (7 + buttonval);
+ return 0;
+}
+
/* Transform gdk key events to our own events */
void
key_to_event(guint keyval, guint state, guint is_modifier, gint mode) {
@@ -312,9 +318,10 @@ button_to_event(guint buttonval, guint state, gint mode) {
gchar *details;
const char *reps;
gchar *modifiers = NULL;
+ guint mod = button_to_modifier (buttonval);
- /* Get modifier state */
- modifiers = get_modifier_mask(state);
+ /* Get modifier state including this button press/release */
+ modifiers = get_modifier_mask(mode != GDK_BUTTON_RELEASE ? state | mod : state & ~mod);
switch (mode) {
case GDK_2BUTTON_PRESS: