mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
WindowManager: Allow disabling window hit testing altogether
This allows us to disable hit testing for transparent windows that don't use alpha channels.
This commit is contained in:
parent
7269e0f751
commit
7e9c265cc0
Notes:
sideshowbarker
2024-07-18 20:59:36 +09:00
Author: https://github.com/tomuta
Commit: 7e9c265cc0
Pull-request: https://github.com/SerenityOS/serenity/pull/5988
Reviewed-by: https://github.com/awesomekling
2 changed files with 7 additions and 0 deletions
|
@ -949,6 +949,8 @@ bool Window::hit_test(const Gfx::IntPoint& point, bool include_frame) const
|
||||||
return frame().hit_test(point);
|
return frame().hit_test(point);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!m_hit_testing_enabled)
|
||||||
|
return false;
|
||||||
u8 threshold = alpha_hit_threshold() * 255;
|
u8 threshold = alpha_hit_threshold() * 255;
|
||||||
if (threshold == 0 || !m_backing_store || !m_backing_store->has_alpha_channel())
|
if (threshold == 0 || !m_backing_store || !m_backing_store->has_alpha_channel())
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -146,6 +146,10 @@ public:
|
||||||
float opacity() const { return m_opacity; }
|
float opacity() const { return m_opacity; }
|
||||||
void set_opacity(float);
|
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; }
|
float alpha_hit_threshold() const { return m_alpha_hit_threshold; }
|
||||||
void set_alpha_hit_threshold(float threshold)
|
void set_alpha_hit_threshold(float threshold)
|
||||||
{
|
{
|
||||||
|
@ -379,6 +383,7 @@ private:
|
||||||
bool m_invalidated { true };
|
bool m_invalidated { true };
|
||||||
bool m_invalidated_all { true };
|
bool m_invalidated_all { true };
|
||||||
bool m_invalidated_frame { true };
|
bool m_invalidated_frame { true };
|
||||||
|
bool m_hit_testing_enabled { true };
|
||||||
WindowTileType m_tiled { WindowTileType::None };
|
WindowTileType m_tiled { WindowTileType::None };
|
||||||
Gfx::IntRect m_untiled_rect;
|
Gfx::IntRect m_untiled_rect;
|
||||||
bool m_occluded { false };
|
bool m_occluded { false };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue