From 2c142e4c57f6499ca512bc6a44cf7a582fa164a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Oppeb=C3=B8en?= Date: Sun, 27 Nov 2022 02:33:07 +0100 Subject: [PATCH] MouseDemo: Show distinct colors for primary vs secondary button This shows mouse down of primary button in blue color, and secondary button in light blue color. --- Userland/Demos/Mouse/main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Userland/Demos/Mouse/main.cpp b/Userland/Demos/Mouse/main.cpp index d9b74e3fbc..2dc91268ee 100644 --- a/Userland/Demos/Mouse/main.cpp +++ b/Userland/Demos/Mouse/main.cpp @@ -79,13 +79,15 @@ public: auto secondary_pressed = m_buttons & GUI::MouseButton::Secondary; if (primary_secondary_switched ? secondary_pressed : primary_pressed) { - painter.fill_rect({ 31, 21, 34, 44 }, Color::Blue); - painter.draw_triangle({ 30, 21 }, { 65, 21 }, { 65, 12 }, Color::Blue); + auto button_color = primary_secondary_switched ? Color::LightBlue : Color::MidBlue; + painter.fill_rect({ 31, 21, 34, 44 }, button_color); + painter.draw_triangle({ 30, 21 }, { 65, 21 }, { 65, 12 }, button_color); } if (primary_secondary_switched ? primary_pressed : secondary_pressed) { - painter.fill_rect({ 96, 21, 34, 44 }, Color::Blue); - painter.draw_triangle({ 96, 12 }, { 96, 21 }, { 132, 21 }, Color::Blue); + auto button_color = primary_secondary_switched ? Color::MidBlue : Color::LightBlue; + painter.fill_rect({ 96, 21, 34, 44 }, button_color); + painter.draw_triangle({ 96, 12 }, { 96, 21 }, { 132, 21 }, button_color); } if (m_buttons & GUI::MouseButton::Middle)