Super slow MicroProfile GL UI.
This commit is contained in:
@@ -29,12 +29,16 @@ class UIEvent {
|
||||
class KeyEvent : public UIEvent {
|
||||
public:
|
||||
KeyEvent(Control* control, int key_code)
|
||||
: UIEvent(control), key_code_(key_code) {}
|
||||
: UIEvent(control), handled_(false), key_code_(key_code) {}
|
||||
~KeyEvent() override = default;
|
||||
|
||||
bool is_handled() const { return handled_; }
|
||||
void set_handled(bool value) { handled_ = value; }
|
||||
|
||||
int key_code() const { return key_code_; }
|
||||
|
||||
private:
|
||||
bool handled_;
|
||||
int key_code_;
|
||||
};
|
||||
|
||||
@@ -52,9 +56,18 @@ class MouseEvent : public UIEvent {
|
||||
public:
|
||||
MouseEvent(Control* control, Button button, int32_t x, int32_t y,
|
||||
int32_t dx = 0, int32_t dy = 0)
|
||||
: UIEvent(control), button_(button), x_(x), y_(y), dx_(dx), dy_(dy) {}
|
||||
: UIEvent(control),
|
||||
handled_(false),
|
||||
button_(button),
|
||||
x_(x),
|
||||
y_(y),
|
||||
dx_(dx),
|
||||
dy_(dy) {}
|
||||
~MouseEvent() override = default;
|
||||
|
||||
bool is_handled() const { return handled_; }
|
||||
void set_handled(bool value) { handled_ = value; }
|
||||
|
||||
Button button() const { return button_; }
|
||||
int32_t x() const { return x_; }
|
||||
int32_t y() const { return y_; }
|
||||
@@ -62,6 +75,7 @@ class MouseEvent : public UIEvent {
|
||||
int32_t dy() const { return dy_; }
|
||||
|
||||
private:
|
||||
bool handled_;
|
||||
Button button_;
|
||||
int32_t x_;
|
||||
int32_t y_;
|
||||
|
||||
@@ -342,7 +342,7 @@ bool Win32Control::HandleMouse(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
OnMouseWheel(e);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
return e.is_handled();
|
||||
}
|
||||
|
||||
bool Win32Control::HandleKeyboard(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
@@ -350,13 +350,12 @@ bool Win32Control::HandleKeyboard(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
switch (message) {
|
||||
case WM_KEYDOWN:
|
||||
OnKeyDown(e);
|
||||
return true;
|
||||
break;
|
||||
case WM_KEYUP:
|
||||
OnKeyUp(e);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return e.is_handled();
|
||||
}
|
||||
|
||||
} // namespace win32
|
||||
|
||||
Reference in New Issue
Block a user