WindowServer: Ignore mouse clicks we're not handling
This ignores unhandled mouse clicks for the window buttons. Right now right-clicking on the window buttons animates them as if some action were to occur when the mouse button is released.
This commit is contained in:
parent
aa70a56174
commit
a3baf06549
Notes:
sideshowbarker
2024-07-18 18:44:00 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/a3baf06549b Pull-request: https://github.com/SerenityOS/serenity/pull/6843
1 changed files with 19 additions and 0 deletions
|
@ -40,6 +40,25 @@ void Button::paint(Gfx::Painter& painter)
|
|||
|
||||
void Button::on_mouse_event(const MouseEvent& event)
|
||||
{
|
||||
auto interesting_button = false;
|
||||
|
||||
switch (event.button()) {
|
||||
case MouseButton::Left:
|
||||
interesting_button = !!on_click;
|
||||
break;
|
||||
case MouseButton::Middle:
|
||||
interesting_button = !!on_middle_click;
|
||||
break;
|
||||
case MouseButton::Right:
|
||||
interesting_button = !!on_right_click;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!interesting_button)
|
||||
return;
|
||||
|
||||
auto& wm = WindowManager::the();
|
||||
|
||||
if (event.type() == Event::MouseDown && (event.button() == MouseButton::Left || event.button() == MouseButton::Right || event.button() == MouseButton::Middle)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue