From 14b51253c028aad14315cd854862f920e9156489 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 29 Jun 2019 09:27:55 +0200 Subject: [PATCH] WindowServer: Allow changing window opacity with Logo+MouseWheel. This is just a silly little feature that I thought was a bit neat. :^) --- Servers/WindowServer/WSWindowManager.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp index ade735ef2e..a942b3a5dd 100644 --- a/Servers/WindowServer/WSWindowManager.cpp +++ b/Servers/WindowServer/WSWindowManager.cpp @@ -723,6 +723,17 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& hovere start_window_resize(window, event); return IterationDecision::Break; } + if (m_keyboard_modifiers == Mod_Logo && event.type() == WSEvent::MouseWheel) { + float opacity_change = -event.wheel_delta() * 0.05f; + float new_opacity = window.opacity() + opacity_change; + if (new_opacity < 0.05f) + new_opacity = 0.05f; + if (new_opacity > 1.0f) + new_opacity = 1.0f; + window.set_opacity(new_opacity); + window.invalidate(); + return IterationDecision::Break; + } } // Well okay, let's see if we're hitting the frame or the window inside the frame. if (window.rect().contains(event.position())) {