summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-04-01 20:58:27 +0300
committerLinus Groh <mail@linusgroh.de>2022-04-01 21:24:45 +0100
commit086969277e74d8ba065bf8145d3aeb0dec0bfee5 (patch)
tree02b3699a66735ef806d9b46353491f18f8e4e7b4 /Userland/Services/WindowServer
parent0376c127f6e98e03607700d0b3f5154b7014b2f8 (diff)
downloadserenity-086969277e74d8ba065bf8145d3aeb0dec0bfee5.zip
Everywhere: Run clang-format
Diffstat (limited to 'Userland/Services/WindowServer')
-rw-r--r--Userland/Services/WindowServer/AppletManager.cpp6
-rw-r--r--Userland/Services/WindowServer/AppletManager.h8
-rw-r--r--Userland/Services/WindowServer/Button.cpp2
-rw-r--r--Userland/Services/WindowServer/Button.h6
-rw-r--r--Userland/Services/WindowServer/Compositor.cpp24
-rw-r--r--Userland/Services/WindowServer/Compositor.h20
-rw-r--r--Userland/Services/WindowServer/ConnectionFromClient.h2
-rw-r--r--Userland/Services/WindowServer/Cursor.h6
-rw-r--r--Userland/Services/WindowServer/Event.h10
-rw-r--r--Userland/Services/WindowServer/KeymapSwitcher.cpp4
-rw-r--r--Userland/Services/WindowServer/KeymapSwitcher.h2
-rw-r--r--Userland/Services/WindowServer/Menu.cpp22
-rw-r--r--Userland/Services/WindowServer/Menu.h20
-rw-r--r--Userland/Services/WindowServer/MenuItem.cpp6
-rw-r--r--Userland/Services/WindowServer/MenuItem.h10
-rw-r--r--Userland/Services/WindowServer/MenuManager.cpp6
-rw-r--r--Userland/Services/WindowServer/MenuManager.h2
-rw-r--r--Userland/Services/WindowServer/MultiScaleBitmaps.cpp2
-rw-r--r--Userland/Services/WindowServer/Overlays.h8
-rw-r--r--Userland/Services/WindowServer/Screen.cpp8
-rw-r--r--Userland/Services/WindowServer/Screen.h14
-rw-r--r--Userland/Services/WindowServer/ScreenLayout.h12
-rw-r--r--Userland/Services/WindowServer/Window.cpp34
-rw-r--r--Userland/Services/WindowServer/Window.h62
-rw-r--r--Userland/Services/WindowServer/WindowFrame.cpp20
-rw-r--r--Userland/Services/WindowServer/WindowFrame.h16
-rw-r--r--Userland/Services/WindowServer/WindowManager.cpp8
-rw-r--r--Userland/Services/WindowServer/WindowManager.h4
-rw-r--r--Userland/Services/WindowServer/WindowSwitcher.cpp4
-rw-r--r--Userland/Services/WindowServer/WindowSwitcher.h2
30 files changed, 175 insertions, 175 deletions
diff --git a/Userland/Services/WindowServer/AppletManager.cpp b/Userland/Services/WindowServer/AppletManager.cpp
index c4a6c74e56..b3dc601af1 100644
--- a/Userland/Services/WindowServer/AppletManager.cpp
+++ b/Userland/Services/WindowServer/AppletManager.cpp
@@ -31,7 +31,7 @@ AppletManager& AppletManager::the()
return *s_the;
}
-void AppletManager::set_position(const Gfx::IntPoint& position)
+void AppletManager::set_position(Gfx::IntPoint const& position)
{
m_window->move_to(position);
m_window->set_visible(true);
@@ -169,7 +169,7 @@ void AppletManager::draw()
}
}
-void AppletManager::draw_applet(const Window& applet)
+void AppletManager::draw_applet(Window const& applet)
{
if (!applet.backing_store())
return;
@@ -181,7 +181,7 @@ void AppletManager::draw_applet(const Window& applet)
painter.blit(applet.rect_in_applet_area().location(), *applet.backing_store(), applet.backing_store()->rect());
}
-void AppletManager::invalidate_applet(const Window& applet, const Gfx::IntRect&)
+void AppletManager::invalidate_applet(Window const& applet, Gfx::IntRect const&)
{
draw_applet(applet);
draw();
diff --git a/Userland/Services/WindowServer/AppletManager.h b/Userland/Services/WindowServer/AppletManager.h
index 3fabbd4506..6bdfb6eadd 100644
--- a/Userland/Services/WindowServer/AppletManager.h
+++ b/Userland/Services/WindowServer/AppletManager.h
@@ -23,13 +23,13 @@ public:
void add_applet(Window& applet);
void remove_applet(Window& applet);
void draw();
- void invalidate_applet(const Window& applet, const Gfx::IntRect& rect);
+ void invalidate_applet(Window const& applet, Gfx::IntRect const& rect);
void relayout();
- void set_position(const Gfx::IntPoint&);
+ void set_position(Gfx::IntPoint const&);
Window* window() { return m_window; }
- const Window* window() const { return m_window; }
+ Window const* window() const { return m_window; }
void did_change_theme();
@@ -37,7 +37,7 @@ private:
AppletManager();
void repaint();
- void draw_applet(const Window& applet);
+ void draw_applet(Window const& applet);
void set_hovered_applet(Window*);
Vector<WeakPtr<Window>> m_applets;
diff --git a/Userland/Services/WindowServer/Button.cpp b/Userland/Services/WindowServer/Button.cpp
index 128d72aefc..ea05391042 100644
--- a/Userland/Services/WindowServer/Button.cpp
+++ b/Userland/Services/WindowServer/Button.cpp
@@ -38,7 +38,7 @@ void Button::paint(Screen& screen, Gfx::Painter& painter)
}
}
-void Button::on_mouse_event(const MouseEvent& event)
+void Button::on_mouse_event(MouseEvent const& event)
{
auto interesting_button = false;
diff --git a/Userland/Services/WindowServer/Button.h b/Userland/Services/WindowServer/Button.h
index 0b54211e6d..eed6bd290d 100644
--- a/Userland/Services/WindowServer/Button.h
+++ b/Userland/Services/WindowServer/Button.h
@@ -25,14 +25,14 @@ public:
~Button();
Gfx::IntRect relative_rect() const { return m_relative_rect; }
- void set_relative_rect(const Gfx::IntRect& rect) { m_relative_rect = rect; }
+ void set_relative_rect(Gfx::IntRect const& rect) { m_relative_rect = rect; }
Gfx::IntRect rect() const { return { {}, m_relative_rect.size() }; }
Gfx::IntRect screen_rect() const;
void paint(Screen&, Gfx::Painter&);
- void on_mouse_event(const MouseEvent&);
+ void on_mouse_event(MouseEvent const&);
Function<void(Button&)> on_click;
Function<void(Button&)> on_secondary_click;
@@ -40,7 +40,7 @@ public:
bool is_visible() const { return m_visible; }
- void set_icon(const RefPtr<MultiScaleBitmaps>& icon) { m_icon = icon; }
+ void set_icon(RefPtr<MultiScaleBitmaps> const& icon) { m_icon = icon; }
private:
WindowFrame& m_frame;
diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp
index 2ca7f3ef52..d8abc2dd07 100644
--- a/Userland/Services/WindowServer/Compositor.cpp
+++ b/Userland/Services/WindowServer/Compositor.cpp
@@ -30,7 +30,7 @@ Compositor& Compositor::the()
return s_the;
}
-static WallpaperMode mode_to_enum(const String& name)
+static WallpaperMode mode_to_enum(String const& name)
{
if (name == "tile")
return WallpaperMode::Tile;
@@ -66,14 +66,14 @@ Compositor::Compositor()
init_bitmaps();
}
-const Gfx::Bitmap* Compositor::cursor_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen& screen) const
+Gfx::Bitmap const* Compositor::cursor_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen& screen) const
{
if (!m_current_cursor)
return nullptr;
return &m_current_cursor->bitmap(screen.scale_factor());
}
-const Gfx::Bitmap& Compositor::front_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen& screen) const
+Gfx::Bitmap const& Compositor::front_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen& screen) const
{
return *screen.compositor_screen_data().m_front_bitmap;
}
@@ -255,7 +255,7 @@ void Compositor::compose()
bool need_to_draw_cursor = false;
Gfx::IntRect previous_cursor_rect;
Screen* previous_cursor_screen = nullptr;
- auto check_restore_cursor_back = [&](Screen& screen, const Gfx::IntRect& rect) {
+ auto check_restore_cursor_back = [&](Screen& screen, Gfx::IntRect const& rect) {
if (&screen == &cursor_screen && !previous_cursor_screen && !need_to_draw_cursor && rect.intersects(cursor_rect)) {
// Restore what's behind the cursor if anything touches the area of the cursor
need_to_draw_cursor = true;
@@ -274,7 +274,7 @@ void Compositor::compose()
m_current_cursor_screen = &cursor_screen;
}
- auto prepare_rect = [&](Screen& screen, const Gfx::IntRect& rect) {
+ auto prepare_rect = [&](Screen& screen, Gfx::IntRect const& rect) {
auto& screen_data = screen.compositor_screen_data();
dbgln_if(COMPOSE_DEBUG, " -> flush opaque: {}", rect);
VERIFY(!screen_data.m_flush_rects.intersects(rect));
@@ -284,7 +284,7 @@ void Compositor::compose()
check_restore_cursor_back(screen, rect);
};
- auto prepare_transparency_rect = [&](Screen& screen, const Gfx::IntRect& rect) {
+ auto prepare_transparency_rect = [&](Screen& screen, Gfx::IntRect const& rect) {
auto& screen_data = screen.compositor_screen_data();
dbgln_if(COMPOSE_DEBUG, " -> flush transparent: {}", rect);
VERIFY(!screen_data.m_flush_rects.intersects(rect));
@@ -301,7 +301,7 @@ void Compositor::compose()
if (!cursor_screen.compositor_screen_data().m_cursor_back_bitmap || m_invalidated_cursor)
check_restore_cursor_back(cursor_screen, cursor_rect);
- auto paint_wallpaper = [&](Screen& screen, Gfx::Painter& painter, const Gfx::IntRect& rect, const Gfx::IntRect& screen_rect) {
+ auto paint_wallpaper = [&](Screen& screen, Gfx::Painter& painter, Gfx::IntRect const& rect, Gfx::IntRect const& screen_rect) {
// FIXME: If the wallpaper is opaque and covers the whole rect, no need to fill with color!
painter.fill_rect(rect, background_color);
if (m_wallpaper) {
@@ -728,7 +728,7 @@ void Compositor::invalidate_screen()
invalidate_screen(Screen::bounding_rect());
}
-void Compositor::invalidate_screen(const Gfx::IntRect& screen_rect)
+void Compositor::invalidate_screen(Gfx::IntRect const& screen_rect)
{
m_dirty_screen_rects.add(screen_rect.intersected(Screen::bounding_rect()));
@@ -773,7 +773,7 @@ void Compositor::start_compose_async_timer()
}
}
-bool Compositor::set_background_color(const String& background_color)
+bool Compositor::set_background_color(String const& background_color)
{
auto color = Color::from_string(background_color);
if (!color.has_value())
@@ -791,7 +791,7 @@ bool Compositor::set_background_color(const String& background_color)
return succeeded;
}
-bool Compositor::set_wallpaper_mode(const String& mode)
+bool Compositor::set_wallpaper_mode(String const& mode)
{
auto& wm = WindowManager::the();
wm.config()->write_entry("Background", "Mode", mode);
@@ -856,7 +856,7 @@ void Compositor::invalidate_cursor(bool compose_immediately)
start_compose_async_timer();
}
-void Compositor::change_cursor(const Cursor* cursor)
+void Compositor::change_cursor(Cursor const* cursor)
{
if (m_current_cursor == cursor)
return;
@@ -935,7 +935,7 @@ void Compositor::remove_overlay(Overlay& overlay)
overlay_rects_changed();
}
-void CompositorScreenData::draw_cursor(Screen& screen, const Gfx::IntRect& cursor_rect)
+void CompositorScreenData::draw_cursor(Screen& screen, Gfx::IntRect const& cursor_rect)
{
auto& wm = WindowManager::the();
diff --git a/Userland/Services/WindowServer/Compositor.h b/Userland/Services/WindowServer/Compositor.h
index 187e9ab272..8a9b238fd2 100644
--- a/Userland/Services/WindowServer/Compositor.h
+++ b/Userland/Services/WindowServer/Compositor.h
@@ -58,7 +58,7 @@ struct CompositorScreenData {
void init_bitmaps(Compositor&, Screen&);
void flip_buffers(Screen&);
- void draw_cursor(Screen&, const Gfx::IntRect&);
+ void draw_cursor(Screen&, Gfx::IntRect const&);
bool restore_cursor_back(Screen&, Gfx::IntRect&);
template<typename F>
@@ -96,22 +96,22 @@ public:
void compose();
void invalidate_window();
void invalidate_screen();
- void invalidate_screen(const Gfx::IntRect&);
+ void invalidate_screen(Gfx::IntRect const&);
void invalidate_screen(Gfx::DisjointRectSet const&);
void screen_resolution_changed();
- bool set_background_color(const String& background_color);
+ bool set_background_color(String const& background_color);
- bool set_wallpaper_mode(const String& mode);
+ bool set_wallpaper_mode(String const& mode);
bool set_wallpaper(RefPtr<Gfx::Bitmap>);
RefPtr<Gfx::Bitmap> wallpaper_bitmap() const { return m_wallpaper; }
void invalidate_cursor(bool = false);
Gfx::IntRect current_cursor_rect() const;
- const Cursor* current_cursor() const { return m_current_cursor; }
- void current_cursor_was_reloaded(const Cursor* new_cursor) { m_current_cursor = new_cursor; }
+ Cursor const* current_cursor() const { return m_current_cursor; }
+ void current_cursor_was_reloaded(Cursor const* new_cursor) { m_current_cursor = new_cursor; }
void increment_display_link_count(Badge<ConnectionFromClient>);
void decrement_display_link_count(Badge<ConnectionFromClient>);
@@ -174,8 +174,8 @@ public:
void did_construct_window_manager(Badge<WindowManager>);
- const Gfx::Bitmap* cursor_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen&) const;
- const Gfx::Bitmap& front_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen&) const;
+ Gfx::Bitmap const* cursor_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen&) const;
+ Gfx::Bitmap const& front_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen&) const;
Gfx::Color color_at_position(Badge<ConnectionFromClient>, Screen&, Gfx::IntPoint const&) const;
void register_animation(Badge<Animation>, Animation&);
@@ -202,7 +202,7 @@ private:
void start_compose_async_timer();
void recompute_overlay_rects();
void recompute_occlusions();
- void change_cursor(const Cursor*);
+ void change_cursor(Cursor const*);
void flush(Screen&);
Gfx::IntPoint window_transition_offset(Window&);
void update_animations(Screen&, Gfx::DisjointRectSet& flush_rects);
@@ -230,7 +230,7 @@ private:
WallpaperMode m_wallpaper_mode { WallpaperMode::Unchecked };
RefPtr<Gfx::Bitmap> m_wallpaper;
- const Cursor* m_current_cursor { nullptr };
+ Cursor const* m_current_cursor { nullptr };
Screen* m_current_cursor_screen { nullptr };
unsigned m_current_cursor_frame { 0 };
RefPtr<Core::Timer> m_cursor_timer;
diff --git a/Userland/Services/WindowServer/ConnectionFromClient.h b/Userland/Services/WindowServer/ConnectionFromClient.h
index ce9e587701..6b12169355 100644
--- a/Userland/Services/WindowServer/ConnectionFromClient.h
+++ b/Userland/Services/WindowServer/ConnectionFromClient.h
@@ -53,7 +53,7 @@ public:
return nullptr;
return menu.value();
}
- const Menu* find_menu_by_id(int menu_id) const
+ Menu const* find_menu_by_id(int menu_id) const
{
auto menu = m_menus.get(menu_id);
if (!menu.has_value())
diff --git a/Userland/Services/WindowServer/Cursor.h b/Userland/Services/WindowServer/Cursor.h
index 8991432dce..83e769a5ba 100644
--- a/Userland/Services/WindowServer/Cursor.h
+++ b/Userland/Services/WindowServer/Cursor.h
@@ -20,8 +20,8 @@ public:
static RefPtr<Cursor> create(Gfx::StandardCursor);
~Cursor() = default;
- const Gfx::CursorParams& params() const { return m_params; }
- const Gfx::Bitmap& bitmap(int scale_factor) const
+ Gfx::CursorParams const& params() const { return m_params; }
+ Gfx::Bitmap const& bitmap(int scale_factor) const
{
auto it = m_bitmaps.find(scale_factor);
if (it == m_bitmaps.end()) {
@@ -47,7 +47,7 @@ public:
private:
Cursor() = default;
- Cursor(NonnullRefPtr<Gfx::Bitmap>&&, int, const Gfx::CursorParams&);
+ Cursor(NonnullRefPtr<Gfx::Bitmap>&&, int, Gfx::CursorParams const&);
bool load(StringView, StringView);
void update_rect_if_animated();
diff --git a/Userland/Services/WindowServer/Event.h b/Userland/Services/WindowServer/Event.h
index d5a72f3643..6ab2bc59b4 100644
--- a/Userland/Services/WindowServer/Event.h
+++ b/Userland/Services/WindowServer/Event.h
@@ -88,7 +88,7 @@ private:
class MouseEvent final : public Event {
public:
- MouseEvent(Type type, const Gfx::IntPoint& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta_x = 0, int wheel_delta_y = 0, int wheel_raw_delta_x = 0, int wheel_raw_delta_y = 0)
+ MouseEvent(Type type, Gfx::IntPoint const& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta_x = 0, int wheel_delta_y = 0, int wheel_raw_delta_x = 0, int wheel_raw_delta_y = 0)
: Event(type)
, m_position(position)
, m_buttons(buttons)
@@ -101,7 +101,7 @@ public:
{
}
- const Gfx::IntPoint& position() const { return m_position; }
+ Gfx::IntPoint const& position() const { return m_position; }
int x() const { return m_position.x(); }
int y() const { return m_position.y(); }
MouseButton button() const { return m_button; }
@@ -121,7 +121,7 @@ public:
}
void set_drag(bool b) { m_drag = b; }
- void set_mime_data(const Core::MimeData& mime_data) { m_mime_data = mime_data; }
+ void set_mime_data(Core::MimeData const& mime_data) { m_mime_data = mime_data; }
MouseEvent translated(Gfx::IntPoint const& delta) const
{
@@ -145,13 +145,13 @@ private:
class ResizeEvent final : public Event {
public:
- ResizeEvent(const Gfx::IntRect& rect)
+ ResizeEvent(Gfx::IntRect const& rect)
: Event(Event::WindowResized)
, m_rect(rect)
{
}
- const Gfx::IntRect& rect() const { return m_rect; }
+ Gfx::IntRect const& rect() const { return m_rect; }
private:
Gfx::IntRect m_rect;
diff --git a/Userland/Services/WindowServer/KeymapSwitcher.cpp b/Userland/Services/WindowServer/KeymapSwitcher.cpp
index 2781dd7145..f329c15bfa 100644
--- a/Userland/Services/WindowServer/KeymapSwitcher.cpp
+++ b/Userland/Services/WindowServer/KeymapSwitcher.cpp
@@ -67,7 +67,7 @@ void KeymapSwitcher::next_keymap()
dbgln("Current system keymap: {}", current_keymap_name);
- auto it = m_keymaps.find_if([&](const auto& enumerator) {
+ auto it = m_keymaps.find_if([&](auto const& enumerator) {
return enumerator == current_keymap_name;
});
@@ -102,7 +102,7 @@ String KeymapSwitcher::get_current_keymap() const
void KeymapSwitcher::setkeymap(const AK::String& keymap)
{
pid_t child_pid;
- const char* argv[] = { "/bin/keymap", "-m", keymap.characters(), nullptr };
+ char const* argv[] = { "/bin/keymap", "-m", keymap.characters(), nullptr };
if ((errno = posix_spawn(&child_pid, "/bin/keymap", nullptr, nullptr, const_cast<char**>(argv), environ))) {
perror("posix_spawn");
dbgln("Failed to call /bin/keymap, error: {} ({})", errno, strerror(errno));
diff --git a/Userland/Services/WindowServer/KeymapSwitcher.h b/Userland/Services/WindowServer/KeymapSwitcher.h
index bbae14c1a3..fde86465c9 100644
--- a/Userland/Services/WindowServer/KeymapSwitcher.h
+++ b/Userland/Services/WindowServer/KeymapSwitcher.h
@@ -38,7 +38,7 @@ private:
RefPtr<Core::FileWatcher> m_file_watcher;
- const char* m_keyboard_config = "/etc/Keyboard.ini";
+ char const* m_keyboard_config = "/etc/Keyboard.ini";
};
}
diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp
index 98e77aaa8e..9529baab06 100644
--- a/Userland/Services/WindowServer/Menu.cpp
+++ b/Userland/Services/WindowServer/Menu.cpp
@@ -47,7 +47,7 @@ Menu::Menu(ConnectionFromClient* client, int menu_id, String name)
m_alt_shortcut_character = find_ampersand_shortcut_character(m_name);
}
-const Gfx::Font& Menu::font() const
+Gfx::Font const& Menu::font() const
{
return Gfx::FontDatabase::default_font();
}
@@ -332,7 +332,7 @@ void Menu::descend_into_submenu_at_hovered_item()
VERIFY(submenu->hovered_item()->type() != MenuItem::Separator);
}
-void Menu::handle_mouse_move_event(const MouseEvent& mouse_event)
+void Menu::handle_mouse_move_event(MouseEvent const& mouse_event)
{
VERIFY(menu_window());
MenuManager::the().set_current_menu(this);
@@ -357,7 +357,7 @@ void Menu::handle_mouse_move_event(const MouseEvent& mouse_event)
void Menu::event(Core::Event& event)
{
if (event.type() == Event::MouseMove) {
- handle_mouse_move_event(static_cast<const MouseEvent&>(event));
+ handle_mouse_move_event(static_cast<MouseEvent const&>(event));
return;
}
@@ -368,7 +368,7 @@ void Menu::event(Core::Event& event)
if (event.type() == Event::MouseWheel && is_scrollable()) {
VERIFY(menu_window());
- auto& mouse_event = static_cast<const MouseEvent&>(event);
+ auto& mouse_event = static_cast<MouseEvent const&>(event);
auto previous_scroll_offset = m_scroll_offset;
m_scroll_offset += mouse_event.wheel_delta_y();
m_scroll_offset = clamp(m_scroll_offset, 0, m_max_scroll_offset);
@@ -402,7 +402,7 @@ void Menu::event(Core::Event& event)
} else {
// Default to the first enabled, non-separator item on key press if one has not been selected yet
int counter = 0;
- for (const auto& item : m_items) {
+ for (auto const& item : m_items) {
if (item.type() != MenuItem::Separator && item.is_enabled()) {
set_hovered_index(counter, key == Key_Right);
break;
@@ -567,7 +567,7 @@ bool Menu::remove_item_with_identifier(unsigned identifier)
return m_items.remove_first_matching([&](auto& item) { return item->identifier() == identifier; });
}
-int Menu::item_index_at(const Gfx::IntPoint& position)
+int Menu::item_index_at(Gfx::IntPoint const& position)
{
int i = 0;
for (auto& item : m_items) {
@@ -589,12 +589,12 @@ void Menu::redraw_if_theme_changed()
redraw();
}
-void Menu::popup(const Gfx::IntPoint& position)
+void Menu::popup(Gfx::IntPoint const& position)
{
do_popup(position, true);
}
-void Menu::do_popup(const Gfx::IntPoint& position, bool make_input, bool as_submenu)
+void Menu::do_popup(Gfx::IntPoint const& position, bool make_input, bool as_submenu)
{
if (is_empty()) {
dbgln("Menu: Empty menu popup");
@@ -605,7 +605,7 @@ void Menu::do_popup(const Gfx::IntPoint& position, bool make_input, bool as_subm
auto& window = ensure_menu_window(position);
redraw_if_theme_changed();
- const int margin = 30;
+ int const margin = 30;
Gfx::IntPoint adjusted_pos = position;
if (adjusted_pos.x() + window.width() > screen.rect().right() - margin) {
@@ -624,7 +624,7 @@ void Menu::do_popup(const Gfx::IntPoint& position, bool make_input, bool as_subm
WindowManager::the().did_popup_a_menu({});
}
-bool Menu::is_menu_ancestor_of(const Menu& other) const
+bool Menu::is_menu_ancestor_of(Menu const& other) const
{
for (auto& item : m_items) {
if (!item.is_submenu())
@@ -657,7 +657,7 @@ void Menu::add_item(NonnullOwnPtr<MenuItem> item)
m_items.append(move(item));
}
-const Vector<size_t>* Menu::items_with_alt_shortcut(u32 alt_shortcut) const
+Vector<size_t> const* Menu::items_with_alt_shortcut(u32 alt_shortcut) const
{
auto it = m_alt_shortcut_character_to_item_indices.find(to_ascii_lowercase(alt_shortcut));
if (it == m_alt_shortcut_character_to_item_indices.end())
diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h
index 8b1b40abf6..4052bfee2e 100644
--- a/Userland/Services/WindowServer/Menu.h
+++ b/Userland/Services/WindowServer/Menu.h
@@ -31,7 +31,7 @@ public:
virtual ~Menu() override = default;
ConnectionFromClient* client() { return m_client; }
- const ConnectionFromClient* client() const { return m_client; }
+ ConnectionFromClient const* client() const { return m_client; }
int menu_id() const { return m_menu_id; }
bool is_open() const;
@@ -40,7 +40,7 @@ public:
bool is_empty() const { return m_items.is_empty(); }
size_t item_count() const { return m_items.size(); }
- const MenuItem& item(size_t index) const { return m_items.at(index); }
+ MenuItem const& item(size_t index) const { return m_items.at(index); }
MenuItem& item(size_t index) { return m_items.at(index); }
MenuItem* item_by_identifier(unsigned identifier)
@@ -72,7 +72,7 @@ public:
}
Gfx::IntRect rect_in_window_menubar() const { return m_rect_in_window_menubar; }
- void set_rect_in_window_menubar(const Gfx::IntRect& rect) { m_rect_in_window_menubar = rect; }
+ void set_rect_in_window_menubar(Gfx::IntRect const& rect) { m_rect_in_window_menubar = rect; }
Window* menu_window() { return m_menu_window.ptr(); }
Window& ensure_menu_window(Gfx::IntPoint const&);
@@ -94,7 +94,7 @@ public:
void draw();
void draw(MenuItem const&, bool = false);
- const Gfx::Font& font() const;
+ Gfx::Font const& font() const;
MenuItem* item_with_identifier(unsigned);
bool remove_item_with_identifier(unsigned);
@@ -113,10 +113,10 @@ public:
void set_visible(bool);
- void popup(const Gfx::IntPoint&);
- void do_popup(const Gfx::IntPoint&, bool make_input, bool as_submenu = false);
+ void popup(Gfx::IntPoint const&);
+ void do_popup(Gfx::IntPoint const&, bool make_input, bool as_submenu = false);
- bool is_menu_ancestor_of(const Menu&) const;
+ bool is_menu_ancestor_of(Menu const&) const;
void redraw_if_theme_changed();
@@ -126,18 +126,18 @@ public:
void descend_into_submenu_at_hovered_item();
void open_hovered_item(bool leave_menu_open);
- const Vector<size_t>* items_with_alt_shortcut(u32 alt_shortcut) const;
+ Vector<size_t> const* items_with_alt_shortcut(u32 alt_shortcut) const;
private:
Menu(ConnectionFromClient*, int menu_id, String name);
virtual void event(Core::Event&) override;
- void handle_mouse_move_event(const MouseEvent&);
+ void handle_mouse_move_event(MouseEvent const&);
size_t visible_item_count() const;
Gfx::IntRect stripe_rect();
- int item_index_at(const Gfx::IntPoint&);
+ int item_index_at(Gfx::IntPoint const&);
static constexpr int padding_between_text_and_shortcut() { return 50; }
void did_activate(MenuItem&, bool leave_menu_open);
void update_for_new_hovered_item(bool make_input = false);
diff --git a/Userland/Services/WindowServer/MenuItem.cpp b/Userland/Services/WindowServer/MenuItem.cpp
index 707a365327..2d79f818b8 100644
--- a/Userland/Services/WindowServer/MenuItem.cpp
+++ b/Userland/Services/WindowServer/MenuItem.cpp
@@ -12,7 +12,7 @@
namespace WindowServer {
-MenuItem::MenuItem(Menu& menu, unsigned identifier, const String& text, const String& shortcut_text, bool enabled, bool checkable, bool checked, const Gfx::Bitmap* icon)
+MenuItem::MenuItem(Menu& menu, unsigned identifier, String const& text, String const& shortcut_text, bool enabled, bool checkable, bool checked, Gfx::Bitmap const* icon)
: m_menu(menu)
, m_type(Text)
, m_enabled(enabled)
@@ -62,7 +62,7 @@ Menu* MenuItem::submenu()
return m_menu.client()->find_menu_by_id(m_submenu_id);
}
-const Menu* MenuItem::submenu() const
+Menu const* MenuItem::submenu() const
{
VERIFY(is_submenu());
VERIFY(m_menu.client());
@@ -76,7 +76,7 @@ Gfx::IntRect MenuItem::rect() const
return m_rect.translated(0, m_menu.item_height() - (m_menu.scroll_offset() * m_menu.item_height()));
}
-void MenuItem::set_icon(const Gfx::Bitmap* icon)
+void MenuItem::set_icon(Gfx::Bitmap const* icon)
{
if (m_icon == icon)
return;
diff --git a/Userland/Services/WindowServer/MenuItem.h b/Userland/Services/WindowServer/MenuItem.h
index cb9d640dff..f5d3d74b72 100644
--- a/Userland/Services/WindowServer/MenuItem.h
+++ b/Userland/Services/WindowServer/MenuItem.h
@@ -23,7 +23,7 @@ public:
Separator,
};
- MenuItem(Menu&, unsigned identifier, const String& text, const String& shortcut_text = {}, bool enabled = true, bool checkable = false, bool checked = false, const Gfx::Bitmap* icon = nullptr);
+ MenuItem(Menu&, unsigned identifier, String const& text, String const& shortcut_text = {}, bool enabled = true, bool checkable = false, bool checked = false, Gfx::Bitmap const* icon = nullptr);
MenuItem(Menu&, Type);
~MenuItem() = default;
@@ -47,20 +47,20 @@ public:
String shortcut_text() const { return m_shortcut_text; }
void set_shortcut_text(String text) { m_shortcut_text = move(text); }
- void set_rect(const Gfx::IntRect& rect) { m_rect = rect; }
+ void set_rect(Gfx::IntRect const& rect) { m_rect = rect; }
Gfx::IntRect rect() const;
unsigned identifier() const { return m_identifier; }
- const Gfx::Bitmap* icon() const { return m_icon; }
- void set_icon(const Gfx::Bitmap*);
+ Gfx::Bitmap const* icon() const { return m_icon; }
+ void set_icon(Gfx::Bitmap const*);
bool is_submenu() const { return m_submenu_id != -1; }
int submenu_id() const { return m_submenu_id; }
void set_submenu_id(int submenu_id) { m_submenu_id = submenu_id; }
Menu* submenu();
- const Menu* submenu() const;
+ Menu const* submenu() const;
bool is_exclusive() const { return m_exclusive; }
void set_exclusive(bool exclusive) { m_exclusive = exclusive; }
diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp
index e511befaf4..3a882c7b46 100644
--- a/Userland/Services/WindowServer/MenuManager.cpp
+++ b/Userland/Services/WindowServer/MenuManager.cpp
@@ -26,7 +26,7 @@ MenuManager::MenuManager()
s_the = this;
}
-bool MenuManager::is_open(const Menu& menu) const
+bool MenuManager::is_open(Menu const& menu) const
{
for (size_t i = 0; i < m_open_menu_stack.size(); ++i) {
if (&menu == m_open_menu_stack[i].ptr())
@@ -55,7 +55,7 @@ void MenuManager::event(Core::Event& event)
}
if (static_cast<Event&>(event).is_key_event()) {
- auto& key_event = static_cast<const KeyEvent&>(event);
+ auto& key_event = static_cast<KeyEvent const&>(event);
if (key_event.type() == Event::KeyUp && key_event.key() == Key_Escape) {
close_everyone();
@@ -85,7 +85,7 @@ void MenuManager::event(Core::Event& event)
if (event.type() == Event::KeyDown) {
if (key_event.key() == Key_Left) {
- auto it = m_open_menu_stack.find_if([&](const auto& other) { return m_current_menu == other.ptr(); });
+ auto it = m_open_menu_stack.find_if([&](auto const& other) { return m_current_menu == other.ptr(); });
VERIFY(!it.is_end());
// Going "back" a menu should be the previous menu in the stack
diff --git a/Userland/Services/WindowServer/MenuManager.h b/Userland/Services/WindowServer/MenuManager.h
index c5177073f7..90312238e5 100644
--- a/Userland/Services/WindowServer/MenuManager.h
+++ b/Userland/Services/WindowServer/MenuManager.h
@@ -22,7 +22,7 @@ public:
virtual ~MenuManager() override = default;
- bool is_open(const Menu&) const;
+ bool is_open(Menu const&) const;
bool has_open_menu() const { return !m_open_menu_stack.is_empty(); }
Menu* current_menu() { return m_current_menu.ptr(); }
diff --git a/Userland/Services/WindowServer/MultiScaleBitmaps.cpp b/Userland/Services/WindowServer/MultiScaleBitmaps.cpp
index 937f1bf028..c0d33509d7 100644
--- a/Userland/Services/WindowServer/MultiScaleBitmaps.cpp
+++ b/Userland/Services/WindowServer/MultiScaleBitmaps.cpp
@@ -9,7 +9,7 @@
namespace WindowServer {
-const Gfx::Bitmap& MultiScaleBitmaps::bitmap(int scale_factor) const
+Gfx::Bitmap const& MultiScaleBitmaps::bitmap(int scale_factor) const
{
auto it = m_bitmaps.find(scale_factor);
if (it == m_bitmaps.end()) {
diff --git a/Userland/Services/WindowServer/Overlays.h b/Userland/Services/WindowServer/Overlays.h
index f94a870bd0..a0c171c2ac 100644
--- a/Userland/Services/WindowServer/Overlays.h
+++ b/Userland/Services/WindowServer/Overlays.h
@@ -184,10 +184,10 @@ public:
private:
Gfx::IntSize m_content_size;
- const int m_rows;
- const int m_columns;
- const int m_target_row;
- const int m_target_column;
+ int const m_rows;
+ int const m_columns;
+ int const m_target_row;
+ int const m_target_column;
};
}
diff --git a/Userland/Services/WindowServer/Screen.cpp b/Userland/Services/WindowServer/Screen.cpp
index faa44d96c1..62d20ca56b 100644
--- a/Userland/Services/WindowServer/Screen.cpp
+++ b/Userland/Services/WindowServer/Screen.cpp
@@ -43,7 +43,7 @@ Screen& ScreenInput::cursor_location_screen()
return *screen;
}
-const Screen& ScreenInput::cursor_location_screen() const
+Screen const& ScreenInput::cursor_location_screen() const
{
auto* screen = Screen::find_by_location(m_cursor_location);
VERIFY(screen);
@@ -271,7 +271,7 @@ void Screen::scale_factor_changed()
constrain_pending_flush_rects();
}
-Screen& Screen::closest_to_rect(const Gfx::IntRect& rect)
+Screen& Screen::closest_to_rect(Gfx::IntRect const& rect)
{
Screen* best_screen = nullptr;
int best_area = 0;
@@ -290,7 +290,7 @@ Screen& Screen::closest_to_rect(const Gfx::IntRect& rect)
return *best_screen;
}
-Screen& Screen::closest_to_location(const Gfx::IntPoint& point)
+Screen& Screen::closest_to_location(Gfx::IntPoint const& point)
{
for (auto& screen : s_screens) {
if (screen.rect().contains(point))
@@ -421,7 +421,7 @@ void ScreenInput::set_scroll_step_size(unsigned step_size)
m_scroll_step_size = step_size;
}
-void ScreenInput::on_receive_mouse_data(const MousePacket& packet)
+void ScreenInput::on_receive_mouse_data(MousePacket const& packet)
{
auto& current_screen = cursor_location_screen();
auto prev_location = m_cursor_location;
diff --git a/Userland/Services/WindowServer/Screen.h b/Userland/Services/WindowServer/Screen.h
index f8e41caeb2..ddfa225142 100644
--- a/Userland/Services/WindowServer/Screen.h
+++ b/Userland/Services/WindowServer/Screen.h
@@ -35,7 +35,7 @@ public:
static ScreenInput& the();
Screen& cursor_location_screen();
- const Screen& cursor_location_screen() const;
+ Screen const& cursor_location_screen() const;
unsigned mouse_button_state() const { return m_mouse_button_state; }
double acceleration_factor() const { return m_acceleration_factor; }
@@ -44,7 +44,7 @@ public:
unsigned scroll_step_size() const { return m_scroll_step_size; }
void set_scroll_step_size(unsigned);
- void on_receive_mouse_data(const MousePacket&);
+ void on_receive_mouse_data(MousePacket const&);
void on_receive_keyboard_data(::KeyEvent);
Gfx::IntPoint cursor_location() const { return m_cursor_location; }
@@ -80,7 +80,7 @@ public:
~Screen();
static bool apply_layout(ScreenLayout&&, String&);
- static const ScreenLayout& layout() { return s_layout; }
+ static ScreenLayout const& layout() { return s_layout; }
static Screen& main()
{
@@ -88,8 +88,8 @@ public:
return *s_main_screen;
}
- static Screen& closest_to_rect(const Gfx::IntRect&);
- static Screen& closest_to_location(const Gfx::IntPoint&);
+ static Screen& closest_to_rect(Gfx::IntRect const&);
+ static Screen& closest_to_location(Gfx::IntPoint const&);
static Screen* find_by_index(size_t index)
{
@@ -106,7 +106,7 @@ public:
return rects;
}
- static Screen* find_by_location(const Gfx::IntPoint& point)
+ static Screen* find_by_location(Gfx::IntPoint const& point)
{
for (auto& screen : s_screens) {
if (screen.rect().contains(point))
@@ -115,7 +115,7 @@ public:
return nullptr;
}
- static const Gfx::IntRect& bounding_rect() { return s_bounding_screens_rect; }
+ static Gfx::IntRect const& bounding_rect() { return s_bounding_screens_rect; }
static size_t count() { return s_screens.size(); }
size_t index() const { return m_index; }
diff --git a/Userland/Services/WindowServer/ScreenLayout.h b/Userland/Services/WindowServer/ScreenLayout.h
index a1983b2842..4e4becc7bf 100644
--- a/Userland/Services/WindowServer/ScreenLayout.h
+++ b/Userland/Services/WindowServer/ScreenLayout.h
@@ -28,7 +28,7 @@ public:
return { location, { resolution.width() / scale_factor, resolution.height() / scale_factor } };
}
- bool operator==(const Screen&) const = default;
+ bool operator==(Screen const&) const = default;
};
Vector<Screen> screens;
@@ -36,13 +36,13 @@ public:
bool is_valid(String* error_msg = nullptr) const;
bool normalize();
- bool load_config(const Core::ConfigFile& config_file, String* error_msg = nullptr);
+ bool load_config(Core::ConfigFile const& config_file, String* error_msg = nullptr);
bool save_config(Core::ConfigFile& config_file, bool sync = true) const;
bool try_auto_add_framebuffer(String const&);
// TODO: spaceship operator
- bool operator!=(const ScreenLayout& other) const;
- bool operator==(const ScreenLayout& other) const
+ bool operator!=(ScreenLayout const& other) const;
+ bool operator==(ScreenLayout const& other) const
{
return !(*this != other);
}
@@ -52,9 +52,9 @@ public:
namespace IPC {
-bool encode(Encoder&, const WindowServer::ScreenLayout::Screen&);
+bool encode(Encoder&, WindowServer::ScreenLayout::Screen const&);
ErrorOr<void> decode(Decoder&, WindowServer::ScreenLayout::Screen&);
-bool encode(Encoder&, const WindowServer::ScreenLayout&);
+bool encode(Encoder&, WindowServer::ScreenLayout const&);
ErrorOr<void> decode(Decoder&, WindowServer::ScreenLayout&);
}
diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp
index 7317a37c0c..f372aff82c 100644
--- a/Userland/Services/WindowServer/Window.cpp
+++ b/Userland/Services/WindowServer/Window.cpp
@@ -137,7 +137,7 @@ void Window::destroy()
set_visible(false);
}
-void Window::set_title(const String& title)
+void Window::set_title(String const& title)
{
if (m_title == title)
return;
@@ -146,7 +146,7 @@ void Window::set_title(const String& title)
WindowManager::the().notify_title_changed(*this);
}
-void Window::set_rect(const Gfx::IntRect& rect)
+void Window::set_rect(Gfx::IntRect const& rect)
{
if (m_rect == rect)
return;
@@ -167,7 +167,7 @@ void Window::set_rect(const Gfx::IntRect& rect)
invalidate_last_rendered_screen_rects();
}
-void Window::set_rect_without_repaint(const Gfx::IntRect& rect)
+void Window::set_rect_without_repaint(Gfx::IntRect const& rect)
{
VERIFY(!rect.is_empty());
if (m_rect == rect)
@@ -246,7 +246,7 @@ void Window::nudge_into_desktop(Screen* target_screen, bool force_titlebar_visib
set_rect(new_window_rect);
}
-void Window::set_minimum_size(const Gfx::IntSize& size)
+void Window::set_minimum_size(Gfx::IntSize const& size)
{
if (size.is_null())
return;
@@ -261,7 +261,7 @@ void Window::set_minimum_size(const Gfx::IntSize& size)
m_minimum_size = size;
}
-void Window::handle_mouse_event(const MouseEvent& event)
+void Window::handle_mouse_event(MouseEvent const& event)
{
set_automatic_cursor_tracking_enabled(event.buttons() != 0);
@@ -357,7 +357,7 @@ void Window::set_closeable(bool closeable)
update_window_menu_items();
}
-void Window::set_taskbar_rect(const Gfx::IntRect& rect)
+void Window::set_taskbar_rect(Gfx::IntRect const& rect)
{
m_taskbar_rect = rect;
m_have_taskbar_rect = !m_taskbar_rect.is_empty();
@@ -536,7 +536,7 @@ void Window::event(Core::Event& event)
}
if (static_cast<Event&>(event).is_mouse_event())
- return handle_mouse_event(static_cast<const MouseEvent&>(event));
+ return handle_mouse_event(static_cast<MouseEvent const&>(event));
switch (event.type()) {
case Event::WindowEntered:
@@ -546,14 +546,14 @@ void Window::event(Core::Event& event)
m_client->async_window_left(m_window_id);
break;
case Event::KeyDown:
- handle_keydown_event(static_cast<const KeyEvent&>(event));
+ handle_keydown_event(static_cast<KeyEvent const&>(event));
break;
case Event::KeyUp:
m_client->async_key_up(m_window_id,
- (u32) static_cast<const KeyEvent&>(event).code_point(),
- (u32) static_cast<const KeyEvent&>(event).key(),
- static_cast<const KeyEvent&>(event).modifiers(),
- (u32) static_cast<const KeyEvent&>(event).scancode());
+ (u32) static_cast<KeyEvent const&>(event).code_point(),
+ (u32) static_cast<KeyEvent const&>(event).key(),
+ static_cast<KeyEvent const&>(event).modifiers(),
+ (u32) static_cast<KeyEvent const&>(event).scancode());
break;
case Event::WindowActivated:
m_client->async_window_activated(m_window_id);
@@ -571,14 +571,14 @@ void Window::event(Core::Event& event)
m_client->async_window_close_request(m_window_id);
break;
case Event::WindowResized:
- m_client->async_window_resized(m_window_id, static_cast<const ResizeEvent&>(event).rect());
+ m_client->async_window_resized(m_window_id, static_cast<ResizeEvent const&>(event).rect());
break;
default:
break;
}
}
-void Window::handle_keydown_event(const KeyEvent& event)
+void Window::handle_keydown_event(KeyEvent const& event)
{
if (event.modifiers() == Mod_Alt && event.key() == Key_Space && type() == WindowType::Normal && !is_frameless()) {
auto position = frame().titlebar_rect().bottom_left().translated(frame().rect().location());
@@ -661,7 +661,7 @@ void Window::invalidate(Gfx::IntRect const& rect, bool invalidate_frame)
Compositor::the().invalidate_window();
}
-bool Window::invalidate_no_notify(const Gfx::IntRect& rect, bool invalidate_frame)
+bool Window::invalidate_no_notify(Gfx::IntRect const& rect, bool invalidate_frame)
{
if (rect.is_empty())
return false;
@@ -764,7 +764,7 @@ void Window::set_default_icon()
m_icon = default_window_icon();
}
-void Window::request_update(const Gfx::IntRect& rect, bool ignore_occlusion)
+void Window::request_update(Gfx::IntRect const& rect, bool ignore_occlusion)
{
if (rect.is_empty())
return;
@@ -865,7 +865,7 @@ void Window::handle_window_menu_action(WindowMenuAction action)
}
}
-void Window::popup_window_menu(const Gfx::IntPoint& position, WindowMenuDefaultAction default_action)
+void Window::popup_window_menu(Gfx::IntPoint const& position, WindowMenuDefaultAction default_action)
{
ensure_window_menu();
if (default_action == WindowMenuDefaultAction::BasedOnWindowState) {
diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h
index a6a43a7c0f..79ec348edc 100644
--- a/Userland/Services/WindowServer/Window.h
+++ b/Userland/Services/WindowServer/Window.h
@@ -88,7 +88,7 @@ public:
bool is_modified() const { return m_modified; }
void set_modified(bool);
- void popup_window_menu(const Gfx::IntPoint&, WindowMenuDefaultAction);
+ void popup_window_menu(Gfx::IntPoint const&, WindowMenuDefaultAction);
void handle_window_menu_action(WindowMenuAction);
void window_menu_activate_default();
void request_close();
@@ -139,12 +139,12 @@ public:
}
WindowFrame& frame() { return m_frame; }
- const WindowFrame& frame() const { return m_frame; }
+ WindowFrame const& frame() const { return m_frame; }
Window* blocking_modal_window();
ConnectionFromClient* client() { return m_client; }
- const ConnectionFromClient* client() const { return m_client; }
+ ConnectionFromClient const* client() const { return m_client; }
WindowType type() const { return m_type; }
int window_id() const { return m_window_id; }
@@ -153,7 +153,7 @@ public:
i32 client_id() const { return m_client_id; }
String title() const { return m_title; }
- void set_title(const String&);
+ void set_title(String const&);
String computed_title() const;
@@ -170,7 +170,7 @@ public:
m_alpha_hit_threshold = threshold;
}
- Optional<HitTestResult> hit_test(const Gfx::IntPoint&, bool include_frame = true);
+ Optional<HitTestResult> hit_test(Gfx::IntPoint const&, bool include_frame = true);
int x() const { return m_rect.x(); }
int y() const { return m_rect.y(); }
@@ -186,34 +186,34 @@ public:
bool is_modal_dont_unparent() const { return m_modal && m_parent_window; }
Gfx::IntRect rect() const { return m_rect; }
- void set_rect(const Gfx::IntRect&);
+ void set_rect(Gfx::IntRect const&);
void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); }
- void set_rect_without_repaint(const Gfx::IntRect&);
+ void set_rect_without_repaint(Gfx::IntRect const&);
bool apply_minimum_size(Gfx::IntRect&);
void nudge_into_desktop(Screen*, bool force_titlebar_visible = true);
Gfx::IntSize minimum_size() const { return m_minimum_size; }
- void set_minimum_size(const Gfx::IntSize&);
+ void set_minimum_size(Gfx::IntSize const&);
void set_minimum_size(int width, int height) { set_minimum_size({ width, height }); }
- void set_taskbar_rect(const Gfx::IntRect&);
- const Gfx::IntRect& taskbar_rect() const { return m_taskbar_rect; }
+ void set_taskbar_rect(Gfx::IntRect const&);
+ Gfx::IntRect const& taskbar_rect() const { return m_taskbar_rect; }
- void move_to(const Gfx::IntPoint& position) { set_rect({ position, size() }); }
+ void move_to(Gfx::IntPoint const& position) { set_rect({ position, size() }); }
void move_to(int x, int y) { move_to({ x, y }); }
- void move_by(const Gfx::IntPoint& delta) { set_position_without_repaint(position().translated(delta)); }
+ void move_by(Gfx::IntPoint const& delta) { set_position_without_repaint(position().translated(delta)); }
Gfx::IntPoint position() const { return m_rect.location(); }
- void set_position(const Gfx::IntPoint& position) { set_rect({ position.x(), position.y(), width(), height() }); }
- void set_position_without_repaint(const Gfx::IntPoint& position) { set_rect_without_repaint({ position.x(), position.y(), width(), height() }); }
+ void set_position(Gfx::IntPoint const& position) { set_rect({ position.x(), position.y(), width(), height() }); }
+ void set_position_without_repaint(Gfx::IntPoint const& position) { set_rect_without_repaint({ position.x(), position.y(), width(), height() }); }
Gfx::IntSize size() const { return m_rect.size(); }
void invalidate(bool with_frame = true, bool re_render_frame = false);
void invalidate(Gfx::IntRect const&, bool invalidate_frame = false);
void invalidate_menubar();
- bool invalidate_no_notify(const Gfx::IntRect& rect, bool invalidate_frame = false);
+ bool invalidate_no_notify(Gfx::IntRect const& rect, bool invalidate_frame = false);
void invalidate_last_rendered_screen_rects();
void invalidate_last_rendered_screen_rects_now();
[[nodiscard]] bool should_invalidate_last_rendered_screen_rects() { return exchange(m_invalidate_last_render_rects, false); }
@@ -225,10 +225,10 @@ public:
Gfx::DisjointRectSet& dirty_rects() { return m_dirty_rects; }
// Only used by WindowType::Applet. Perhaps it could be a Window subclass? I don't know.
- void set_rect_in_applet_area(const Gfx::IntRect& rect) { m_rect_in_applet_area = rect; }
- const Gfx::IntRect& rect_in_applet_area() const { return m_rect_in_applet_area; }
+ void set_rect_in_applet_area(Gfx::IntRect const& rect) { m_rect_in_applet_area = rect; }
+ Gfx::IntRect const& rect_in_applet_area() const { return m_rect_in_applet_area; }
- const Gfx::Bitmap* backing_store() const { return m_backing_store.ptr(); }
+ Gfx::Bitmap const* backing_store() const { return m_backing_store.ptr(); }
Gfx::Bitmap* backing_store() { return m_backing_store.ptr(); }
void set_backing_store(RefPtr<Gfx::Bitmap> backing_store, i32 serial)
@@ -257,10 +257,10 @@ public:
void set_has_alpha_channel(bool value);
Gfx::IntSize size_increment() const { return m_size_increment; }
- void set_size_increment(const Gfx::IntSize& increment) { m_size_increment = increment; }
+ void set_size_increment(Gfx::IntSize const& increment) { m_size_increment = increment; }
- const Optional<Gfx::IntSize>& resize_aspect_ratio() const { return m_resize_aspect_ratio; }
- void set_resize_aspect_ratio(const Optional<Gfx::IntSize>& ratio)
+ Optional<Gfx::IntSize> const& resize_aspect_ratio() const { return m_resize_aspect_ratio; }
+ void set_resize_aspect_ratio(Optional<Gfx::IntSize> const& ratio)
{
// "Tiled" means that we take up a chunk of space relative to the screen.
// The screen can change, so "tiled" and "fixed aspect ratio" are mutually exclusive.
@@ -272,19 +272,19 @@ public:
}
Gfx::IntSize base_size() const { return m_base_size; }
- void set_base_size(const Gfx::IntSize& size) { m_base_size = size; }
+ void set_base_size(Gfx::IntSize const& size) { m_base_size = size; }
- const Gfx::Bitmap& icon() const { return *m_icon; }
+ Gfx::Bitmap const& icon() const { return *m_icon; }
void set_icon(NonnullRefPtr<Gfx::Bitmap>&& icon) { m_icon = move(icon); }
void set_default_icon();
- const Cursor* cursor() const { return (m_cursor_override ? m_cursor_override : m_cursor).ptr(); }
+ Cursor const* cursor() const { return (m_cursor_override ? m_cursor_override : m_cursor).ptr(); }
void set_cursor(RefPtr<Cursor> cursor) { m_cursor = move(cursor); }
void set_cursor_override(RefPtr<Cursor> cursor) { m_cursor_override = move(cursor); }
void remove_cursor_override() { m_cursor_override = nullptr; }
- void request_update(const Gfx::IntRect&, bool ignore_occlusion = false);
+ void request_update(Gfx::IntRect const&, bool ignore_occlusion = false);
Gfx::DisjointRectSet take_pending_paint_rects() { return move(m_pending_paint_rects); }
bool has_taskbar_rect() const { return m_have_taskbar_rect; };
@@ -299,15 +299,15 @@ public:
void detach_client(Badge<ConnectionFromClient>);
Window* parent_window() { return m_parent_window; }
- const Window* parent_window() const { return m_parent_window; }
+ Window const* parent_window() const { return m_parent_window; }
void set_parent_window(Window&);
Vector<WeakPtr<Window>>& child_windows() { return m_child_windows; }
- const Vector<WeakPtr<Window>>& child_windows() const { return m_child_windows; }
+ Vector<WeakPtr<Window>> const& child_windows() const { return m_child_windows; }
Vector<WeakPtr<Window>>& accessory_windows() { return m_accessory_windows; }
- const Vector<WeakPtr<Window>>& accessory_windows() const { return m_accessory_windows; }
+ Vector<WeakPtr<Window>> const& accessory_windows() const { return m_accessory_windows; }
bool is_descendant_of(Window&) const;
@@ -364,7 +364,7 @@ public:
bool is_on_any_window_stack(Badge<WindowStack>) const { return m_window_stack != nullptr; }
void set_window_stack(Badge<WindowStack>, WindowStack* stack) { m_window_stack = stack; }
- const Vector<Screen*, default_screen_count>& screens() const { return m_screens; }
+ Vector<Screen*, default_screen_count> const& screens() const { return m_screens; }
Vector<Screen*, default_screen_count>& screens() { return m_screens; }
void set_moving_to_another_stack(bool value) { m_moving_to_another_stack = value; }
@@ -385,8 +385,8 @@ private:
Window(Core::Object&, WindowType);
virtual void event(Core::Event&) override;
- void handle_mouse_event(const MouseEvent&);
- void handle_keydown_event(const KeyEvent&);
+ void handle_mouse_event(MouseEvent const&);
+ void handle_keydown_event(KeyEvent const&);
void add_child_window(Window&);
void add_accessory_window(Window&);
void ensure_window_menu();
diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp
index 7c44578d27..8a66dc84c9 100644
--- a/Userland/Services/WindowServer/WindowFrame.cpp
+++ b/Userland/Services/WindowServer/WindowFrame.cpp
@@ -52,7 +52,7 @@ static String s_last_menu_shadow_path;
static String s_last_taskbar_shadow_path;
static String s_last_tooltip_shadow_path;
-static Gfx::IntRect frame_rect_for_window(Window& window, const Gfx::IntRect& rect)
+static Gfx::IntRect frame_rect_for_window(Window& window, Gfx::IntRect const& rect)
{
if (window.is_frameless())
return rect;
@@ -148,7 +148,7 @@ void WindowFrame::reload_config()
reload_icon(s_close_icon, "window-close.png", "/res/icons/16x16/window-close.png");
reload_icon(s_close_modified_icon, "window-close-modified.png", "/res/icons/16x16/window-close-modified.png");
- auto load_shadow = [](const String& path, String& last_path, RefPtr<MultiScaleBitmaps>& shadow_bitmap) {
+ auto load_shadow = [](String const& path, String& last_path, RefPtr<MultiScaleBitmaps>& shadow_bitmap) {
if (path.is_empty()) {
last_path = String::empty();
shadow_bitmap = nullptr;
@@ -305,13 +305,13 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
paint_menubar(painter);
}
-void WindowFrame::paint(Screen& screen, Gfx::Painter& painter, const Gfx::IntRect& rect)
+void WindowFrame::paint(Screen& screen, Gfx::Painter& painter, Gfx::IntRect const& rect)
{
if (auto* cached = render_to_cache(screen))
cached->paint(*this, painter, rect);
}
-void WindowFrame::PerScaleRenderedCache::paint(WindowFrame& frame, Gfx::Painter& painter, const Gfx::IntRect& rect)
+void WindowFrame::PerScaleRenderedCache::paint(WindowFrame& frame, Gfx::Painter& painter, Gfx::IntRect const& rect)
{
auto frame_rect = frame.unconstrained_render_rect();
auto window_rect = frame.window().rect();
@@ -526,7 +526,7 @@ void WindowFrame::set_opacity(float opacity)
WindowManager::the().notify_opacity_changed(m_window);
}
-Gfx::IntRect WindowFrame::inflated_for_shadow(const Gfx::IntRect& frame_rect) const
+Gfx::IntRect WindowFrame::inflated_for_shadow(Gfx::IntRect const& frame_rect) const
{
if (auto* shadow = shadow_bitmap()) {
auto total_shadow_size = shadow->default_bitmap().height();
@@ -540,7 +540,7 @@ Gfx::IntRect WindowFrame::rect() const
return frame_rect_for_window(m_window, m_window.rect());
}
-Gfx::IntRect WindowFrame::constrained_render_rect_to_screen(const Gfx::IntRect& render_rect) const
+Gfx::IntRect WindowFrame::constrained_render_rect_to_screen(Gfx::IntRect const& render_rect) const
{
if (m_window.is_tiled())
return render_rect.intersected(Screen::closest_to_rect(rect()).rect());
@@ -630,7 +630,7 @@ void WindowFrame::invalidate(Gfx::IntRect relative_rect)
m_window.invalidate(relative_rect, true);
}
-void WindowFrame::window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect)
+void WindowFrame::window_rect_changed(Gfx::IntRect const& old_rect, Gfx::IntRect const& new_rect)
{
layout_buttons();
@@ -810,7 +810,7 @@ void WindowFrame::handle_mouse_event(MouseEvent const& event)
handle_border_mouse_event(event);
}
-void WindowFrame::handle_border_mouse_event(const MouseEvent& event)
+void WindowFrame::handle_border_mouse_event(MouseEvent const& event)
{
if (!m_window.is_resizable())
return;
@@ -838,7 +838,7 @@ void WindowFrame::handle_border_mouse_event(const MouseEvent& event)
wm.start_window_resize(m_window, event.translated(rect().location()));
}
-void WindowFrame::handle_menubar_mouse_event(const MouseEvent& event)
+void WindowFrame::handle_menubar_mouse_event(MouseEvent const& event)
{
Menu* hovered_menu = nullptr;
auto menubar_rect = this->menubar_rect();
@@ -869,7 +869,7 @@ void WindowFrame::open_menubar_menu(Menu& menu)
invalidate(menubar_rect);
}
-void WindowFrame::handle_menu_mouse_event(Menu& menu, const MouseEvent& event)
+void WindowFrame::handle_menu_mouse_event(Menu& menu, MouseEvent const& event)
{
auto menubar_rect = this->menubar_rect();
bool is_hover_with_any_menu_open = event.type() == MouseEvent::MouseMove && &m_window == WindowManager::the().window_with_active_menu();
diff --git a/Userland/Services/WindowServer/WindowFrame.h b/Userland/Services/WindowServer/WindowFrame.h
index 9e37b8b34f..30483af6cd 100644
--- a/Userland/Services/WindowServer/WindowFrame.h
+++ b/Userland/Services/WindowServer/WindowFrame.h
@@ -29,7 +29,7 @@ public:
friend class WindowFrame;
public:
- void paint(WindowFrame&, Gfx::Painter&, const Gfx::IntRect&);
+ void paint(WindowFrame&, Gfx::Painter&, Gfx::IntRect const&);
void render(WindowFrame&, Screen&);
Optional<HitTestResult> hit_test(WindowFrame&, Gfx::IntPoint const&, Gfx::IntPoint const&);
@@ -51,7 +51,7 @@ public:
void window_was_constructed(Badge<Window>);
Window& window() { return m_window; }
- const Window& window() const { return m_window; }
+ Window const& window() const { return m_window; }
Gfx::IntRect rect() const;
Gfx::IntRect render_rect() const;
@@ -59,7 +59,7 @@ public:
Gfx::DisjointRectSet opaque_render_rects() const;
Gfx::DisjointRectSet transparent_render_rects() const;
- void paint(Screen&, Gfx::Painter&, const Gfx::IntRect&);
+ void paint(Screen&, Gfx::Painter&, Gfx::IntRect const&);
void render(Screen&, Gfx::Painter&);
PerScaleRenderedCache* render_to_cache(Screen&);
@@ -68,7 +68,7 @@ public:
bool handle_titlebar_icon_mouse_event(MouseEvent const&);
void handle_border_mouse_event(MouseEvent const&);
- void window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect);
+ void window_rect_changed(Gfx::IntRect const& old_rect, Gfx::IntRect const& new_rect);
void invalidate_titlebar();
void invalidate_menubar();
void invalidate(Gfx::IntRect relative_rect);
@@ -125,15 +125,15 @@ private:
void paint_tool_window_frame(Gfx::Painter&);
void paint_menubar(Gfx::Painter&);
MultiScaleBitmaps const* shadow_bitmap() const;
- Gfx::IntRect inflated_for_shadow(const Gfx::IntRect&) const;
+ Gfx::IntRect inflated_for_shadow(Gfx::IntRect const&) const;
- void handle_menubar_mouse_event(const MouseEvent&);
- void handle_menu_mouse_event(Menu&, const MouseEvent&);
+ void handle_menubar_mouse_event(MouseEvent const&);
+ void handle_menu_mouse_event(Menu&, MouseEvent const&);
Gfx::WindowTheme::WindowState window_state_for_theme() const;
String computed_title() const;
- Gfx::IntRect constrained_render_rect_to_screen(const Gfx::IntRect&) const;
+ Gfx::IntRect constrained_render_rect_to_screen(Gfx::IntRect const&) const;
Gfx::IntRect leftmost_titlebar_button_rect() const;
Window& m_window;
diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp
index 31dc9d56d2..bf57e84207 100644
--- a/Userland/Services/WindowServer/WindowManager.cpp
+++ b/Userland/Services/WindowServer/WindowManager.cpp
@@ -774,8 +774,8 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event)
dbgln(" [!] The window is still maximized. Not moving yet.");
}
- const int tiling_deadzone = 10;
- const int secondary_deadzone = 2;
+ int const tiling_deadzone = 10;
+ int const secondary_deadzone = 2;
auto& cursor_screen = Screen::closest_to_location(event.position());
auto desktop = desktop_rect(cursor_screen);
auto desktop_relative_to_screen = desktop.translated(-cursor_screen.rect().location());
@@ -869,7 +869,7 @@ bool WindowManager::process_ongoing_window_resize(MouseEvent const& event)
return false;
if (event.type() == Event::MouseMove) {
- const int vertical_maximize_deadzone = 5;
+ int const vertical_maximize_deadzone = 5;
auto& cursor_screen = ScreenInput::the().cursor_location_screen();
if (&cursor_screen == &Screen::closest_to_rect(m_resize_window->rect())) {
auto desktop_rect = this->desktop_rect(cursor_screen);
@@ -2225,7 +2225,7 @@ void WindowManager::apply_cursor_theme(String const& theme_name)
auto cursor_theme_config = cursor_theme_config_or_error.release_value();
auto* current_cursor = Compositor::the().current_cursor();
- auto reload_cursor = [&](RefPtr<Cursor>& cursor, const String& name) {
+ auto reload_cursor = [&](RefPtr<Cursor>& cursor, String const& name) {
bool is_current_cursor = current_cursor && current_cursor == cursor.ptr();
static auto const s_default_cursor_path = "/res/cursor-themes/Default/arrow.x2y2.png";
diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h
index ece88429df..047d6f3866 100644
--- a/Userland/Services/WindowServer/WindowManager.h
+++ b/Userland/Services/WindowServer/WindowManager.h
@@ -28,8 +28,8 @@
namespace WindowServer {
-const int double_click_speed_max = 900;
-const int double_click_speed_min = 100;
+int const double_click_speed_max = 900;
+int const double_click_speed_min = 100;
class Screen;
class MouseEvent;
diff --git a/Userland/Services/WindowServer/WindowSwitcher.cpp b/Userland/Services/WindowServer/WindowSwitcher.cpp
index f359ffb998..0243366838 100644
--- a/Userland/Services/WindowServer/WindowSwitcher.cpp
+++ b/Userland/Services/WindowServer/WindowSwitcher.cpp
@@ -85,7 +85,7 @@ void WindowSwitcher::event(Core::Event& event)
event.accept();
}
-void WindowSwitcher::on_key_event(const KeyEvent& event)
+void WindowSwitcher::on_key_event(KeyEvent const& event)
{
if (event.type() == Event::KeyUp) {
if (event.key() == (m_mode == Mode::ShowAllWindows ? Key_Super : Key_Alt)) {
@@ -212,7 +212,7 @@ void WindowSwitcher::draw()
void WindowSwitcher::refresh()
{
auto& wm = WindowManager::the();
- const Window* selected_window = nullptr;
+ Window const* selected_window = nullptr;
if (m_selected_index > 0 && m_windows[m_selected_index])
selected_window = m_windows[m_selected_index].ptr();
if (!selected_window)
diff --git a/Userland/Services/WindowServer/WindowSwitcher.h b/Userland/Services/WindowServer/WindowSwitcher.h
index 40ee72af9f..52ae22f825 100644
--- a/Userland/Services/WindowServer/WindowSwitcher.h
+++ b/Userland/Services/WindowServer/WindowSwitcher.h
@@ -38,7 +38,7 @@ public:
}
void hide() { set_visible(false); }
- void on_key_event(const KeyEvent&);
+ void on_key_event(KeyEvent const&);
void refresh();
void refresh_if_needed();