1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:57:45 +00:00

Meta+Userland: Pass Gfx::IntPoint by value

This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
This commit is contained in:
MacDue 2022-12-06 20:27:44 +00:00 committed by Andreas Kling
parent bbc149ebb9
commit 7be0b27dd3
161 changed files with 442 additions and 441 deletions

View file

@ -31,7 +31,7 @@ AppletManager& AppletManager::the()
return *s_the;
}
void AppletManager::set_position(Gfx::IntPoint const& position)
void AppletManager::set_position(Gfx::IntPoint position)
{
m_window->move_to(position);
m_window->set_visible(true);

View file

@ -26,7 +26,7 @@ public:
void invalidate_applet(Window const& applet, Gfx::IntRect const& rect);
void relayout();
void set_position(Gfx::IntPoint const&);
void set_position(Gfx::IntPoint);
Window* window() { return m_window; }
Window const* window() const { return m_window; }

View file

@ -79,7 +79,7 @@ Gfx::Bitmap const& Compositor::front_bitmap_for_screenshot(Badge<ConnectionFromC
return *screen.compositor_screen_data().m_front_bitmap;
}
Gfx::Color Compositor::color_at_position(Badge<ConnectionFromClient>, Screen& screen, Gfx::IntPoint const& position) const
Gfx::Color Compositor::color_at_position(Badge<ConnectionFromClient>, Screen& screen, Gfx::IntPoint position) const
{
return screen.compositor_screen_data().m_front_bitmap->get_pixel(position);
}

View file

@ -180,7 +180,7 @@ public:
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;
Gfx::Color color_at_position(Badge<ConnectionFromClient>, Screen&, Gfx::IntPoint) const;
void register_animation(Badge<Animation>, Animation&);
void unregister_animation(Badge<Animation>, Animation&);

View file

@ -145,7 +145,7 @@ void ConnectionFromClient::add_menu_item(i32 menu_id, i32 identifier, i32 submen
menu.add_item(move(menu_item));
}
void ConnectionFromClient::popup_menu(i32 menu_id, Gfx::IntPoint const& screen_position, Gfx::IntRect const& button_rect)
void ConnectionFromClient::popup_menu(i32 menu_id, Gfx::IntPoint screen_position, Gfx::IntRect const& button_rect)
{
auto position = screen_position;
auto it = m_menus.find(menu_id);
@ -1040,7 +1040,7 @@ void ConnectionFromClient::pong()
set_unresponsive(false);
}
void ConnectionFromClient::set_global_cursor_position(Gfx::IntPoint const& position)
void ConnectionFromClient::set_global_cursor_position(Gfx::IntPoint position)
{
if (!Screen::main().rect().contains(position)) {
did_misbehave("SetGlobalCursorPosition with bad position");

View file

@ -140,7 +140,7 @@ private:
virtual void show_screen_numbers(bool) override;
virtual void set_window_cursor(i32, i32) override;
virtual void set_window_custom_cursor(i32, Gfx::ShareableBitmap const&) override;
virtual void popup_menu(i32, Gfx::IntPoint const&, Gfx::IntRect const&) override;
virtual void popup_menu(i32, Gfx::IntPoint, Gfx::IntRect const&) override;
virtual void dismiss_menu(i32) override;
virtual void set_window_icon_bitmap(i32, Gfx::ShareableBitmap const&) override;
virtual Messages::WindowServer::StartDragResponse start_drag(DeprecatedString const&, HashMap<DeprecatedString, ByteBuffer> const&, Gfx::ShareableBitmap const&) override;
@ -166,7 +166,7 @@ private:
virtual void set_window_progress(i32, Optional<i32> const&) override;
virtual void refresh_system_theme() override;
virtual void pong() override;
virtual void set_global_cursor_position(Gfx::IntPoint const&) override;
virtual void set_global_cursor_position(Gfx::IntPoint) override;
virtual Messages::WindowServer::GetGlobalCursorPositionResponse get_global_cursor_position() override;
virtual void set_mouse_acceleration(float) override;
virtual Messages::WindowServer::GetMouseAccelerationResponse get_mouse_acceleration() override;

View file

@ -89,7 +89,7 @@ private:
class MouseEvent final : public Event {
public:
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)
MouseEvent(Type type, 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)
: Event(type)
, m_position(position)
, m_buttons(buttons)
@ -102,7 +102,7 @@ public:
{
}
Gfx::IntPoint const& position() const { return m_position; }
Gfx::IntPoint 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; }
@ -124,7 +124,7 @@ public:
void set_drag(bool b) { m_drag = b; }
void set_mime_data(Core::MimeData const& mime_data) { m_mime_data = mime_data; }
MouseEvent translated(Gfx::IntPoint const& delta) const
MouseEvent translated(Gfx::IntPoint delta) const
{
MouseEvent event = *this;
event.m_position = m_position.translated(delta);

View file

@ -112,7 +112,7 @@ void Menu::redraw(MenuItem const& menu_item)
menu_window()->invalidate(menu_item.rect());
}
Window& Menu::ensure_menu_window(Gfx::IntPoint const& position)
Window& Menu::ensure_menu_window(Gfx::IntPoint position)
{
auto& screen = Screen::closest_to_location(position);
int width = this->content_width();
@ -575,7 +575,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(Gfx::IntPoint const& position)
int Menu::item_index_at(Gfx::IntPoint position)
{
int i = 0;
for (auto& item : m_items) {
@ -597,7 +597,7 @@ void Menu::redraw_if_theme_changed()
redraw();
}
void Menu::open_button_menu(Gfx::IntPoint const& position, Gfx::IntRect const& button_rect)
void Menu::open_button_menu(Gfx::IntPoint position, Gfx::IntRect const& button_rect)
{
if (is_empty())
return;
@ -618,12 +618,12 @@ void Menu::open_button_menu(Gfx::IntPoint const& position, Gfx::IntRect const& b
WindowManager::the().did_popup_a_menu({});
}
void Menu::popup(Gfx::IntPoint const& position)
void Menu::popup(Gfx::IntPoint position)
{
do_popup(position, true);
}
void Menu::do_popup(Gfx::IntPoint const& position, bool make_input, bool as_submenu)
void Menu::do_popup(Gfx::IntPoint position, bool make_input, bool as_submenu)
{
if (is_empty()) {
dbgln("Menu: Empty menu popup");

View file

@ -76,10 +76,10 @@ public:
void set_rect_in_window_menubar(Gfx::IntRect const& rect) { m_rect_in_window_menubar = rect; }
Gfx::IntPoint unadjusted_position() const { return m_unadjusted_position; }
void set_unadjusted_position(Gfx::IntPoint const& position) { m_unadjusted_position = position; }
void set_unadjusted_position(Gfx::IntPoint position) { m_unadjusted_position = position; }
Window* menu_window() { return m_menu_window.ptr(); }
Window& ensure_menu_window(Gfx::IntPoint const&);
Window& ensure_menu_window(Gfx::IntPoint);
Window* window_menu_of() { return m_window_menu_of; }
void set_window_menu_of(Window& window) { m_window_menu_of = window; }
@ -118,9 +118,9 @@ public:
void set_visible(bool);
void popup(Gfx::IntPoint const&);
void do_popup(Gfx::IntPoint const&, bool make_input, bool as_submenu = false);
void open_button_menu(Gfx::IntPoint const& position, Gfx::IntRect const& button_rect);
void popup(Gfx::IntPoint);
void do_popup(Gfx::IntPoint, bool make_input, bool as_submenu = false);
void open_button_menu(Gfx::IntPoint position, Gfx::IntRect const& button_rect);
bool is_menu_ancestor_of(Menu const&) const;
@ -143,7 +143,7 @@ private:
size_t visible_item_count() const;
Gfx::IntRect stripe_rect();
int item_index_at(Gfx::IntPoint const&);
int item_index_at(Gfx::IntPoint);
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);

View file

@ -293,7 +293,7 @@ Screen& Screen::closest_to_rect(Gfx::IntRect const& rect)
return *best_screen;
}
Screen& Screen::closest_to_location(Gfx::IntPoint const& point)
Screen& Screen::closest_to_location(Gfx::IntPoint point)
{
for (auto& screen : s_screens) {
if (screen.rect().contains(point))

View file

@ -92,7 +92,7 @@ public:
}
static Screen& closest_to_rect(Gfx::IntRect const&);
static Screen& closest_to_location(Gfx::IntPoint const&);
static Screen& closest_to_location(Gfx::IntPoint);
static Screen* find_by_index(size_t index)
{
@ -109,7 +109,7 @@ public:
return rects;
}
static Screen* find_by_location(Gfx::IntPoint const& point)
static Screen* find_by_location(Gfx::IntPoint point)
{
for (auto& screen : s_screens) {
if (screen.rect().contains(point))

View file

@ -33,7 +33,7 @@ void WMConnectionFromClient::die()
});
}
void WMConnectionFromClient::set_applet_area_position(Gfx::IntPoint const& position)
void WMConnectionFromClient::set_applet_area_position(Gfx::IntPoint position)
{
if (m_window_id < 0) {
did_misbehave("SetAppletAreaPosition: WM didn't assign window as manager yet");
@ -66,7 +66,7 @@ void WMConnectionFromClient::set_active_window(i32 client_id, i32 window_id)
WindowManager::the().move_to_front_and_make_active(window);
}
void WMConnectionFromClient::popup_window_menu(i32 client_id, i32 window_id, Gfx::IntPoint const& screen_position)
void WMConnectionFromClient::popup_window_menu(i32 client_id, i32 window_id, Gfx::IntPoint screen_position)
{
auto* client = WindowServer::ConnectionFromClient::from_client_id(client_id);
if (!client) {

View file

@ -25,9 +25,9 @@ public:
virtual void set_window_minimized(i32, i32, bool) override;
virtual void toggle_show_desktop() override;
virtual void start_window_resize(i32, i32, i32) override;
virtual void popup_window_menu(i32, i32, Gfx::IntPoint const&) override;
virtual void popup_window_menu(i32, i32, Gfx::IntPoint) override;
virtual void set_window_taskbar_rect(i32, i32, Gfx::IntRect const&) override;
virtual void set_applet_area_position(Gfx::IntPoint const&) override;
virtual void set_applet_area_position(Gfx::IntPoint) override;
virtual void set_event_mask(u32) override;
virtual void set_manager_window(i32) override;
virtual void set_workspace(u32, u32) override;

View file

@ -787,7 +787,7 @@ void Window::handle_window_menu_action(WindowMenuAction action)
}
}
void Window::popup_window_menu(Gfx::IntPoint const& position, WindowMenuDefaultAction default_action)
void Window::popup_window_menu(Gfx::IntPoint position, WindowMenuDefaultAction default_action)
{
ensure_window_menu();
if (default_action == WindowMenuDefaultAction::BasedOnWindowState) {
@ -999,7 +999,7 @@ bool Window::is_descendant_of(Window& window) const
return false;
}
Optional<HitTestResult> Window::hit_test(Gfx::IntPoint const& position, bool include_frame)
Optional<HitTestResult> Window::hit_test(Gfx::IntPoint position, bool include_frame)
{
if (!m_hit_testing_enabled)
return {};

View file

@ -89,7 +89,7 @@ public:
bool is_modified() const { return m_modified; }
void set_modified(bool);
void popup_window_menu(Gfx::IntPoint const&, WindowMenuDefaultAction);
void popup_window_menu(Gfx::IntPoint, WindowMenuDefaultAction);
void handle_window_menu_action(WindowMenuAction);
void window_menu_activate_default();
void request_close();
@ -166,7 +166,7 @@ public:
m_alpha_hit_threshold = threshold;
}
Optional<HitTestResult> hit_test(Gfx::IntPoint const&, bool include_frame = true);
Optional<HitTestResult> hit_test(Gfx::IntPoint, bool include_frame = true);
int x() const { return m_rect.x(); }
int y() const { return m_rect.y(); }
@ -201,14 +201,14 @@ public:
void set_taskbar_rect(Gfx::IntRect const&);
Gfx::IntRect const& taskbar_rect() const { return m_taskbar_rect; }
void move_to(Gfx::IntPoint const& position) { set_rect({ position, size() }); }
void move_to(Gfx::IntPoint position) { set_rect({ position, size() }); }
void move_to(int x, int y) { move_to({ x, y }); }
void move_by(Gfx::IntPoint const& delta) { set_position_without_repaint(position().translated(delta)); }
void move_by(Gfx::IntPoint delta) { set_position_without_repaint(position().translated(delta)); }
Gfx::IntPoint position() const { return m_rect.location(); }
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() }); }
void set_position(Gfx::IntPoint position) { set_rect({ position.x(), position.y(), width(), height() }); }
void set_position_without_repaint(Gfx::IntPoint position) { set_rect_without_repaint({ position.x(), position.y(), width(), height() }); }
Gfx::IntSize size() const { return m_rect.size(); }

View file

@ -680,7 +680,7 @@ void WindowFrame::layout_buttons()
m_buttons[i].set_relative_rect(button_rects[i]);
}
Optional<HitTestResult> WindowFrame::hit_test(Gfx::IntPoint const& position)
Optional<HitTestResult> WindowFrame::hit_test(Gfx::IntPoint position)
{
if (m_window.is_frameless() || m_window.is_fullscreen())
return {};
@ -706,7 +706,7 @@ Optional<HitTestResult> WindowFrame::hit_test(Gfx::IntPoint const& position)
return cached->hit_test(*this, position, window_relative_position);
}
Optional<HitTestResult> WindowFrame::PerScaleRenderedCache::hit_test(WindowFrame& frame, Gfx::IntPoint const& position, Gfx::IntPoint const& window_relative_position)
Optional<HitTestResult> WindowFrame::PerScaleRenderedCache::hit_test(WindowFrame& frame, Gfx::IntPoint position, Gfx::IntPoint window_relative_position)
{
HitTestResult result {
.window = frame.window(),

View file

@ -31,7 +31,7 @@ public:
public:
void paint(WindowFrame&, Gfx::Painter&, Gfx::IntRect const&);
void render(WindowFrame&, Screen&);
Optional<HitTestResult> hit_test(WindowFrame&, Gfx::IntPoint const&, Gfx::IntPoint const&);
Optional<HitTestResult> hit_test(WindowFrame&, Gfx::IntPoint, Gfx::IntPoint);
private:
RefPtr<Gfx::Bitmap> m_top_bottom;
@ -115,7 +115,7 @@ public:
void theme_changed();
Optional<HitTestResult> hit_test(Gfx::IntPoint const&);
Optional<HitTestResult> hit_test(Gfx::IntPoint);
void open_menubar_menu(Menu&);

View file

@ -684,7 +684,7 @@ void WindowManager::check_hide_geometry_overlay(Window& window)
m_geometry_overlay = nullptr;
}
void WindowManager::start_window_move(Window& window, Gfx::IntPoint const& origin)
void WindowManager::start_window_move(Window& window, Gfx::IntPoint origin)
{
MenuManager::the().close_everyone();
@ -708,7 +708,7 @@ void WindowManager::start_window_move(Window& window, MouseEvent const& event)
start_window_move(window, event.position());
}
void WindowManager::start_window_resize(Window& window, Gfx::IntPoint const& position, MouseButton button, ResizeDirection resize_direction)
void WindowManager::start_window_resize(Window& window, Gfx::IntPoint position, MouseButton button, ResizeDirection resize_direction)
{
MenuManager::the().close_everyone();
@ -830,7 +830,7 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event)
return true;
}
Gfx::IntPoint WindowManager::to_floating_cursor_position(Gfx::IntPoint const& origin) const
Gfx::IntPoint WindowManager::to_floating_cursor_position(Gfx::IntPoint origin) const
{
VERIFY(m_move_window);
@ -2157,7 +2157,7 @@ void WindowManager::set_always_on_top(Window& window, bool always_on_top)
});
}
Gfx::IntPoint WindowManager::get_recommended_window_position(Gfx::IntPoint const& desired)
Gfx::IntPoint WindowManager::get_recommended_window_position(Gfx::IntPoint desired)
{
// FIXME: Find a better source for the width and height to shift by.
Gfx::IntPoint shift(8, Gfx::WindowTheme::current().titlebar_height(Gfx::WindowTheme::WindowType::Normal, Gfx::WindowTheme::WindowMode::Other, palette()) + 10);

View file

@ -180,10 +180,10 @@ public:
void check_hide_geometry_overlay(Window&);
void start_window_resize(Window&, Gfx::IntPoint const&, MouseButton, ResizeDirection);
void start_window_resize(Window&, Gfx::IntPoint, MouseButton, ResizeDirection);
void start_window_resize(Window&, MouseEvent const&, ResizeDirection);
void start_window_move(Window&, MouseEvent const&);
void start_window_move(Window&, Gfx::IntPoint const&);
void start_window_move(Window&, Gfx::IntPoint);
Window const* active_fullscreen_window() const
{
@ -246,7 +246,7 @@ public:
}
bool is_window_in_modal_chain(Window& chain_window, Window& other_window);
Gfx::IntPoint get_recommended_window_position(Gfx::IntPoint const& desired);
Gfx::IntPoint get_recommended_window_position(Gfx::IntPoint desired);
void reload_icon_bitmaps_after_scale_change();
@ -428,7 +428,7 @@ private:
bool is_considered_doubleclick(MouseEvent const&, DoubleClickInfo::ClickMetadata const&) const;
Gfx::IntPoint to_floating_cursor_position(Gfx::IntPoint const&) const;
Gfx::IntPoint to_floating_cursor_position(Gfx::IntPoint) const;
DoubleClickInfo m_double_click_info;
int m_double_click_speed { 0 };

View file

@ -99,7 +99,7 @@ void WindowStack::move_all_windows(WindowStack& new_window_stack, Vector<Window*
m_active_window = nullptr;
}
Window* WindowStack::window_at(Gfx::IntPoint const& position, IncludeWindowFrame include_window_frame) const
Window* WindowStack::window_at(Gfx::IntPoint position, IncludeWindowFrame include_window_frame) const
{
auto result = hit_test(position);
if (!result.has_value())
@ -132,7 +132,7 @@ void WindowStack::set_all_occluded(bool occluded)
}
}
Optional<HitTestResult> WindowStack::hit_test(Gfx::IntPoint const& position) const
Optional<HitTestResult> WindowStack::hit_test(Gfx::IntPoint position) const
{
Optional<HitTestResult> result;
WindowManager::the().for_each_visible_window_from_front_to_back([&](Window& window) {

View file

@ -35,7 +35,7 @@ public:
Yes,
No,
};
Window* window_at(Gfx::IntPoint const&, IncludeWindowFrame = IncludeWindowFrame::Yes) const;
Window* window_at(Gfx::IntPoint, IncludeWindowFrame = IncludeWindowFrame::Yes) const;
Window* highlight_window() const;
template<typename Callback>
@ -56,13 +56,13 @@ public:
Window const* active_window() const { return m_active_window; }
void set_active_window(Window*);
Optional<HitTestResult> hit_test(Gfx::IntPoint const&) const;
Optional<HitTestResult> hit_test(Gfx::IntPoint) const;
unsigned row() const { return m_row; }
unsigned column() const { return m_column; }
void set_transition_offset(Badge<Compositor>, Gfx::IntPoint const& transition_offset) { m_transition_offset = transition_offset; }
Gfx::IntPoint const& transition_offset() const { return m_transition_offset; }
void set_transition_offset(Badge<Compositor>, Gfx::IntPoint transition_offset) { m_transition_offset = transition_offset; }
Gfx::IntPoint transition_offset() const { return m_transition_offset; }
void set_stationary_window_stack(WindowStack& window_stack) { m_stationary_window_stack = &window_stack; }
WindowStack& stationary_window_stack()