diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-21 19:14:31 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-21 19:14:31 +0100 |
commit | babc6a3e556012de1b7c34296d25cfeba79de260 (patch) | |
tree | d253ad011137ed89fbad254d1078f95f3f93960a | |
parent | f5d20c7b488c114399a3d18c58db661d517fb38e (diff) |
Use new enum classes.
-rw-r--r-- | plugingui/nativewindow_pugl.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/plugingui/nativewindow_pugl.cc b/plugingui/nativewindow_pugl.cc index 0c7ba96..df21925 100644 --- a/plugingui/nativewindow_pugl.cc +++ b/plugingui/nativewindow_pugl.cc @@ -81,9 +81,22 @@ static void onMouse(PuglView* view, int button, bool press, int x, int y) GUI::ButtonEvent* e = new GUI::ButtonEvent(); e->x = x; e->y = y; - e->button = button; - e->direction = press?1:-1; - e->doubleClick = false; + + switch(button) { + case 1: + e->button = GUI::MouseButton::left; + break; + case 2: + e->button = GUI::MouseButton::right; + break; + case 3: + default: + e->button = GUI::MouseButton::middle; + break; + } + + e->direction = press ? GUI::Direction::down : GUI::Direction::up; + e->doubleClick = false; eventq.push_back(e); } @@ -92,7 +105,7 @@ static void onKeyboard(PuglView* view, bool press, uint32_t key) { if(press) { GUI::KeyEvent* e = new GUI::KeyEvent(); - e->direction = press?-1:1; + e->direction = press ? GUI::Direction::down : GUI::Direction::up; printf("%d\n", key); |