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.
This commit is contained in:
parent
63cf3a235d
commit
a94bc793fe
1 changed files with 20 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue