From a94bc793fe14fa2c6f5feec889bf805dc80ad985 Mon Sep 17 00:00:00 2001 From: gambas Date: Mon, 8 Oct 2018 16:35:45 +0200 Subject: [PATCH] Mouse.State has flags for keyboard modifiers now. [GB.GTK] * NEW: Mouse.State has flags for keyboard modifiers now. [GB.GTK3] * NEW: Mouse.State has flags for keyboard modifiers now. --- gb.gtk/src/CMouse.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/gb.gtk/src/CMouse.cpp b/gb.gtk/src/CMouse.cpp index 8a5c1f163..e7bfd70c3 100644 --- a/gb.gtk/src/CMouse.cpp +++ b/gb.gtk/src/CMouse.cpp @@ -130,7 +130,26 @@ END_PROPERTY BEGIN_PROPERTY(Mouse_State) CHECK_VALID(); - GB.ReturnInteger(gMouse::state()); + + int state = gMouse::state(); + int result = 0; + + if (state & GDK_BUTTON1_MASK) + result |= MOUSE_LEFT; + if (state & GDK_BUTTON2_MASK) + result |= MOUSE_MIDDLE; + if (state & GDK_BUTTON3_MASK) + result |= MOUSE_RIGHT; + if (state & GDK_SHIFT_MASK) + result |= MOUSE_SHIFT; + if (state & GDK_CONTROL_MASK) + result |= MOUSE_CTRL; + if (state & GDK_MOD1_MASK) + result |= MOUSE_ALT; + if (state & GDK_MOD2_MASK) + result |= MOUSE_META; + + GB.ReturnInteger(result); END_PROPERTY