Skip to content

Commit 4701f2d

Browse files
committed
Add getModifiers() to MouseEvent and KeyEvent
1 parent 927ed25 commit 4701f2d

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/Processing.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3979,6 +3979,14 @@ struct MouseEvent {
39793979
float getX() const { return x; }
39803980
float getY() const { return y; }
39813981
int getAction() const { return action; }
3982+
int getModifiers() const {
3983+
int m=0;
3984+
if(shiftDown) m|=1;
3985+
if(controlDown) m|=2;
3986+
if(altDown) m|=4;
3987+
if(metaDown) m|=8;
3988+
return m;
3989+
}
39823990
};
39833991

39843992
struct KeyEvent {
@@ -3998,6 +4006,14 @@ struct KeyEvent {
39984006
bool isMetaDown() const { return metaDown; }
39994007
char16_t getKey() const { return key; }
40004008
int getKeyCode() const { return keyCode; }
4009+
int getModifiers() const {
4010+
int m=0;
4011+
if(shiftDown) m|=1;
4012+
if(controlDown) m|=2;
4013+
if(altDown) m|=4;
4014+
if(metaDown) m|=8;
4015+
return m;
4016+
}
40014017
int getAction() const { return action; }
40024018
};
40034019

0 commit comments

Comments
 (0)