2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-03-21 15:54:19 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2019-04-03 19:38:44 +02:00
|
|
|
#include <AK/Function.h>
|
2020-01-10 19:06:00 +03:00
|
|
|
#include <AK/String.h>
|
2020-02-16 09:17:49 +01:00
|
|
|
#include <LibGUI/Forward.h>
|
2020-02-06 12:04:00 +01:00
|
|
|
#include <LibGfx/Rect.h>
|
2021-06-02 17:29:53 -06:00
|
|
|
#include <Services/Taskbar/TaskbarWindow.h>
|
2021-06-14 21:19:56 -06:00
|
|
|
#include <Services/WindowServer/ScreenLayout.h>
|
2019-03-21 15:54:19 +01:00
|
|
|
|
2020-02-02 15:07:41 +01:00
|
|
|
namespace GUI {
|
2019-04-03 17:22:14 +02:00
|
|
|
|
2021-06-14 21:19:56 -06:00
|
|
|
using ScreenLayout = WindowServer::ScreenLayout;
|
|
|
|
|
|
2020-02-02 15:07:41 +01:00
|
|
|
class Desktop {
|
2019-03-21 15:54:19 +01:00
|
|
|
public:
|
2021-06-14 21:19:56 -06:00
|
|
|
// Most people will probably have 4 screens or less
|
|
|
|
|
static constexpr size_t default_screen_rect_count = 4;
|
|
|
|
|
|
2020-02-02 15:07:41 +01:00
|
|
|
static Desktop& the();
|
|
|
|
|
Desktop();
|
2019-03-21 15:54:19 +01:00
|
|
|
|
2020-03-29 13:32:34 +03:00
|
|
|
void set_background_color(const StringView& background_color);
|
|
|
|
|
|
|
|
|
|
void set_wallpaper_mode(const StringView& mode);
|
|
|
|
|
|
2019-03-21 15:54:19 +01:00
|
|
|
String wallpaper() const;
|
2020-08-14 21:17:46 +01:00
|
|
|
bool set_wallpaper(const StringView& path, bool save_config = true);
|
2019-03-21 15:54:19 +01:00
|
|
|
|
2021-06-13 06:16:06 -06:00
|
|
|
Gfx::IntRect rect() const { return m_bounding_rect; }
|
|
|
|
|
const Vector<Gfx::IntRect, 4>& rects() const { return m_rects; }
|
|
|
|
|
size_t main_screen_index() const { return m_main_screen_index; }
|
2020-08-13 16:02:59 +02:00
|
|
|
|
2021-06-30 19:12:02 -06:00
|
|
|
unsigned virtual_desktop_rows() const { return m_virtual_desktop_rows; }
|
|
|
|
|
unsigned virtual_desktop_columns() const { return m_virtual_desktop_columns; }
|
|
|
|
|
|
2021-06-02 17:29:53 -06:00
|
|
|
int taskbar_height() const { return TaskbarWindow::taskbar_height(); }
|
2020-08-13 16:02:59 +02:00
|
|
|
|
2021-06-30 19:12:02 -06:00
|
|
|
void did_receive_screen_rects(Badge<WindowServerConnection>, const Vector<Gfx::IntRect, 4>&, size_t, unsigned, unsigned);
|
2019-04-03 17:22:14 +02:00
|
|
|
|
2019-03-21 15:54:19 +01:00
|
|
|
private:
|
2021-06-14 21:19:56 -06:00
|
|
|
Vector<Gfx::IntRect, default_screen_rect_count> m_rects;
|
2021-06-13 06:16:06 -06:00
|
|
|
size_t m_main_screen_index { 0 };
|
|
|
|
|
Gfx::IntRect m_bounding_rect;
|
2021-06-30 19:12:02 -06:00
|
|
|
unsigned m_virtual_desktop_rows { 1 };
|
|
|
|
|
unsigned m_virtual_desktop_columns { 1 };
|
2019-03-21 15:54:19 +01:00
|
|
|
};
|
2020-02-02 15:07:41 +01:00
|
|
|
|
|
|
|
|
}
|