Skip to content

Commit

Permalink
issue #17 - Make sure to pass keyboard modifiers to mouse events.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobgladish@yahoo.com committed May 4, 2015
1 parent bdded48 commit 9a1a171
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/gles/LinuxInputEventDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ class LinuxInputEventDispatcher : public pxInputDeviceEventProvider
if (isButtonPress)
{
evt.type = pxMouseEventTypeButton;
evt.modifiers = mModifiers;
evt.button.state = getKeyState(e);
evt.button.button = getMouseButton(e);
evt.button.x = mMouseX;
Expand Down
5 changes: 4 additions & 1 deletion src/gles/pxInputDeviceEventProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ enum pxKeyModifier
pxKeyModifierAlt = 0x20,
};

typedef uint8_t pxKeyModifierSet;

enum pxKeyState
{
pxKeyStateRelease = 0,
Expand All @@ -34,7 +36,7 @@ struct pxKeyEvent
pxKeyState state;

// flags or'd together from pxKeyModifier
uint8_t modifiers;
pxKeyModifierSet modifiers;
};

enum pxMouseEventType
Expand All @@ -46,6 +48,7 @@ enum pxMouseEventType
struct pxMouseEvent
{
pxMouseEventType type;
pxKeyModifierSet modifiers;

union
{
Expand Down
6 changes: 4 additions & 2 deletions src/gles/pxWindowNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ void pxWindowNative::runEventLoopOnce()
pxWindowNative* w = (*i);
w->animateAndRender();
}

// TODO: Why are we sleeping?
usleep(1000); //TODO - find out why pxSleepMS causes a crash on xi3
}

Expand Down Expand Up @@ -461,9 +463,9 @@ void pxWindowNative::mouseEventListener(const pxMouseEvent& evt, void* argp)

// TODO: Is that 3rd arg supposed to be the current keyboard modifiers?
if (evt.button.state == pxKeyStatePressed)
p->onMouseDown(evt.button.x, evt.button.y, 0);
p->onMouseDown(evt.button.x, evt.button.y, evt.modifiers);
else if (evt.button.state == pxKeyStateRelease)
p->onMouseUp(evt.button.x, evt.button.y, 0);
p->onMouseUp(evt.button.x, evt.button.y, evt.modifiers);
}
}

Expand Down

0 comments on commit 9a1a171

Please sign in to comment.