put callEvent at the end

This commit is contained in:
chenhuan 2019-11-20 13:11:45 +01:00
parent 66f356c6a1
commit cc91a8d60d

View File

@ -6,7 +6,6 @@ auto GUI_Window::handle(int e) -> int {
switch (e) { switch (e) {
/*Mousebutton*/ /*Mousebutton*/
case FL_PUSH: case FL_PUSH:
vkvm::callEvent(vkvm::EventType::MouseButton);
if (Fl::event_button() == FL_LEFT_MOUSE) { if (Fl::event_button() == FL_LEFT_MOUSE) {
std::cout << "Mouse:left" << std::endl; std::cout << "Mouse:left" << std::endl;
} else if (Fl::event_button() == FL_RIGHT_MOUSE) { } else if (Fl::event_button() == FL_RIGHT_MOUSE) {
@ -14,11 +13,10 @@ auto GUI_Window::handle(int e) -> int {
} else { } else {
std::cout << "Mouse:middle" << std::endl; std::cout << "Mouse:middle" << std::endl;
} }
vkvm::callEvent(vkvm::EventType::MouseButton);
return 1; return 1;
/*Mousebutton and movement*/ /*Mousebutton and movement*/
case FL_DRAG: case FL_DRAG:
vkvm::callEvent(vkvm::EventType::MouseButton);
vkvm::callEvent(vkvm::EventType::MouseMove);
x = Fl::event_x(); x = Fl::event_x();
y = Fl::event_y(); y = Fl::event_y();
vkvm::setMousePosition(x,y); vkvm::setMousePosition(x,y);
@ -29,27 +27,29 @@ auto GUI_Window::handle(int e) -> int {
} else { } else {
std::cout << "Mouse:middle" << std::endl; std::cout << "Mouse:middle" << std::endl;
} }
vkvm::callEvent(vkvm::EventType::MouseButton);
vkvm::callEvent(vkvm::EventType::MouseMove);
return 1; return 1;
/*Mousemovement*/ /*Mousemovement*/
case FL_MOVE: case FL_MOVE:
vkvm::callEvent(vkvm::EventType::MouseMove);
x = Fl::event_x(); x = Fl::event_x();
y = Fl::event_y(); y = Fl::event_y();
vkvm::setMousePosition(x,y); vkvm::setMousePosition(x,y);
vkvm::callEvent(vkvm::EventType::MouseMove);
return 1; return 1;
/*keyboardbutton*/ /*keyboardbutton*/
case FL_KEYBOARD: case FL_KEYBOARD:
vkvm::callEvent(vkvm::EventType::KeyDown);
button = Fl::event_button(); button = Fl::event_button();
keyCode = new vkvm::KeyCode(button); keyCode = new vkvm::KeyCode(button);
vkvm::buttonPressed(*keyCode); vkvm::buttonPressed(*keyCode);
vkvm::callEvent(vkvm::EventType::KeyDown);
return 1; return 1;
case FL_KEYUP: case FL_KEYUP:
vkvm::callEvent(vkvm::EventType::KeyUp);
button = Fl::event_button(); button = Fl::event_button();
std::cout<<button<<std::endl; std::cout<<button<<std::endl;
keyCode = new vkvm::KeyCode(button); keyCode = new vkvm::KeyCode(button);
vkvm::buttonPressed(*keyCode); vkvm::buttonPressed(*keyCode);
vkvm::callEvent(vkvm::EventType::KeyUp);
return 1; return 1;
} }