summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2021-03-27 15:45:00 -0600
committerAndreas Kling <kling@serenityos.org>2021-03-28 20:42:21 +0200
commit7e9c265cc071a00c39ade29d7735106d37f44b10 (patch)
treea0af67f820dcc35e996e9d26070d2e354de4d73f /Userland/Services
parent7269e0f751c27fc468f0e47462cc857fea6c1f7a (diff)
downloadserenity-7e9c265cc071a00c39ade29d7735106d37f44b10.zip
WindowManager: Allow disabling window hit testing altogether
This allows us to disable hit testing for transparent windows that don't use alpha channels.
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/WindowServer/Window.cpp2
-rw-r--r--Userland/Services/WindowServer/Window.h5
2 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp
index 752bf55dec..e8a0d11d54 100644
--- a/Userland/Services/WindowServer/Window.cpp
+++ b/Userland/Services/WindowServer/Window.cpp
@@ -949,6 +949,8 @@ bool Window::hit_test(const Gfx::IntPoint& point, bool include_frame) const
return frame().hit_test(point);
return false;
}
+ if (!m_hit_testing_enabled)
+ return false;
u8 threshold = alpha_hit_threshold() * 255;
if (threshold == 0 || !m_backing_store || !m_backing_store->has_alpha_channel())
return true;
diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h
index 4b26d6d653..456d6dac4f 100644
--- a/Userland/Services/WindowServer/Window.h
+++ b/Userland/Services/WindowServer/Window.h
@@ -146,6 +146,10 @@ public:
float opacity() const { return m_opacity; }
void set_opacity(float);
+ void set_hit_testing_enabled(bool value)
+ {
+ m_hit_testing_enabled = value;
+ }
float alpha_hit_threshold() const { return m_alpha_hit_threshold; }
void set_alpha_hit_threshold(float threshold)
{
@@ -379,6 +383,7 @@ private:
bool m_invalidated { true };
bool m_invalidated_all { true };
bool m_invalidated_frame { true };
+ bool m_hit_testing_enabled { true };
WindowTileType m_tiled { WindowTileType::None };
Gfx::IntRect m_untiled_rect;
bool m_occluded { false };