mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibGUI: Add callback for screen rect change to Desktop.h
callbacks for screen rect changes can be added with on_receive_screen_rects()
This commit is contained in:
parent
222b97488a
commit
b8f3441300
2 changed files with 10 additions and 0 deletions
|
@ -39,6 +39,9 @@ void Desktop::did_receive_screen_rects(Badge<WindowServerConnection>, const Vect
|
|||
|
||||
m_virtual_desktop_rows = virtual_desktop_rows;
|
||||
m_virtual_desktop_columns = virtual_desktop_columns;
|
||||
|
||||
for (auto& callback : m_receive_rects_callbacks)
|
||||
callback(*this);
|
||||
}
|
||||
|
||||
void Desktop::set_background_color(const StringView& background_color)
|
||||
|
|
|
@ -43,12 +43,19 @@ public:
|
|||
|
||||
void did_receive_screen_rects(Badge<WindowServerConnection>, const Vector<Gfx::IntRect, 4>&, size_t, unsigned, unsigned);
|
||||
|
||||
template<typename F>
|
||||
void on_receive_screen_rects(F&& callback)
|
||||
{
|
||||
m_receive_rects_callbacks.append(forward<F>(callback));
|
||||
}
|
||||
|
||||
private:
|
||||
Vector<Gfx::IntRect, default_screen_rect_count> m_rects;
|
||||
size_t m_main_screen_index { 0 };
|
||||
Gfx::IntRect m_bounding_rect;
|
||||
unsigned m_virtual_desktop_rows { 1 };
|
||||
unsigned m_virtual_desktop_columns { 1 };
|
||||
Vector<Function<void(Desktop&)>> m_receive_rects_callbacks;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue