put callEvent at the end

This commit is contained in:
chenhuan 2019-11-20 13:11:45 +01:00
parent 66f356c6a1
commit cc91a8d60d
1 changed files with 6 additions and 6 deletions

View File

@ -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<<button<<std::endl;
keyCode = new vkvm::KeyCode(button);
vkvm::buttonPressed(*keyCode);
vkvm::callEvent(vkvm::EventType::KeyUp);
return 1;
}