From cc91a8d60d78cc2fc0d44467ac9b0b7fa9ea13b6 Mon Sep 17 00:00:00 2001 From: chenhuan Date: Wed, 20 Nov 2019 13:11:45 +0100 Subject: [PATCH] put callEvent at the end --- src/GUI_Window.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GUI_Window.cpp b/src/GUI_Window.cpp index e1634a6..8f2cd69 100644 --- a/src/GUI_Window.cpp +++ b/src/GUI_Window.cpp @@ -6,7 +6,6 @@ auto GUI_Window::handle(int e) -> int { switch (e) { /*Mousebutton*/ case FL_PUSH: - vkvm::callEvent(vkvm::EventType::MouseButton); if (Fl::event_button() == FL_LEFT_MOUSE) { std::cout << "Mouse:left" << std::endl; } else if (Fl::event_button() == FL_RIGHT_MOUSE) { @@ -14,11 +13,10 @@ auto GUI_Window::handle(int e) -> int { } else { std::cout << "Mouse:middle" << std::endl; } + vkvm::callEvent(vkvm::EventType::MouseButton); return 1; /*Mousebutton and movement*/ case FL_DRAG: - vkvm::callEvent(vkvm::EventType::MouseButton); - vkvm::callEvent(vkvm::EventType::MouseMove); x = Fl::event_x(); y = Fl::event_y(); vkvm::setMousePosition(x,y); @@ -29,27 +27,29 @@ auto GUI_Window::handle(int e) -> int { } else { std::cout << "Mouse:middle" << std::endl; } + vkvm::callEvent(vkvm::EventType::MouseButton); + vkvm::callEvent(vkvm::EventType::MouseMove); return 1; /*Mousemovement*/ case FL_MOVE: - vkvm::callEvent(vkvm::EventType::MouseMove); x = Fl::event_x(); y = Fl::event_y(); vkvm::setMousePosition(x,y); + vkvm::callEvent(vkvm::EventType::MouseMove); return 1; /*keyboardbutton*/ case FL_KEYBOARD: - vkvm::callEvent(vkvm::EventType::KeyDown); button = Fl::event_button(); keyCode = new vkvm::KeyCode(button); vkvm::buttonPressed(*keyCode); + vkvm::callEvent(vkvm::EventType::KeyDown); return 1; case FL_KEYUP: - vkvm::callEvent(vkvm::EventType::KeyUp); button = Fl::event_button(); std::cout<