Desktop.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Function.h>
  8. #include <AK/String.h>
  9. #include <LibGUI/Forward.h>
  10. #include <LibGfx/Rect.h>
  11. #include <Services/Taskbar/TaskbarWindow.h>
  12. #include <Services/WindowServer/ScreenLayout.h>
  13. namespace GUI {
  14. using ScreenLayout = WindowServer::ScreenLayout;
  15. class Desktop {
  16. public:
  17. // Most people will probably have 4 screens or less
  18. static constexpr size_t default_screen_rect_count = 4;
  19. static Desktop& the();
  20. Desktop();
  21. void set_background_color(const StringView& background_color);
  22. void set_wallpaper_mode(const StringView& mode);
  23. String wallpaper() const;
  24. bool set_wallpaper(const StringView& path, bool save_config = true);
  25. Gfx::IntRect rect() const { return m_bounding_rect; }
  26. const Vector<Gfx::IntRect, 4>& rects() const { return m_rects; }
  27. size_t main_screen_index() const { return m_main_screen_index; }
  28. int taskbar_height() const { return TaskbarWindow::taskbar_height(); }
  29. void did_receive_screen_rects(Badge<WindowServerConnection>, const Vector<Gfx::IntRect, 4>&, size_t);
  30. private:
  31. Vector<Gfx::IntRect, default_screen_rect_count> m_rects;
  32. size_t m_main_screen_index { 0 };
  33. Gfx::IntRect m_bounding_rect;
  34. };
  35. }