From babc6a3e556012de1b7c34296d25cfeba79de260 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 21 Nov 2015 19:14:31 +0100 Subject: Use new enum classes. --- plugingui/nativewindow_pugl.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'plugingui') 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); -- cgit v1.2.3