1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

WindowServer: Add support for alpha channel based hit testing

This enables implementing non-rectangular window shapes, including
non-rectangular window frames.
This commit is contained in:
Tom 2021-02-14 16:42:37 -07:00 committed by Andreas Kling
parent b3f0a5c917
commit d590e0c946
12 changed files with 107 additions and 12 deletions

View file

@ -145,6 +145,13 @@ public:
float opacity() const { return m_opacity; }
void set_opacity(float);
float alpha_hit_threshold() const { return m_alpha_hit_threshold; }
void set_alpha_hit_threshold(float threshold)
{
m_alpha_hit_threshold = threshold;
}
bool hit_test(const Gfx::IntPoint&, bool include_frame = true) const;
int x() const { return m_rect.x(); }
int y() const { return m_rect.y(); }
int width() const { return m_rect.width(); }
@ -365,6 +372,7 @@ private:
int m_window_id { -1 };
i32 m_client_id { -1 };
float m_opacity { 1 };
float m_alpha_hit_threshold { 0.0f };
Gfx::IntSize m_size_increment;
Gfx::IntSize m_base_size;
NonnullRefPtr<Gfx::Bitmap> m_icon;