diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-06 13:02:38 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-06 13:02:38 +0100 |
commit | 20cfd2a6bff8c469970651dd73ffee60ab0e5176 (patch) | |
tree | 4f92b38ae97fb0add184ccae97d679f484ef1a49 | |
parent | c39d44fc2ef0d2e5435524c5b96b5a367df2438b (diff) | |
download | serenity-20cfd2a6bff8c469970651dd73ffee60ab0e5176.zip |
LibGfx: Unpublish Gfx::Rect from global namespace
78 files changed, 262 insertions, 260 deletions
diff --git a/Applications/About/main.cpp b/Applications/About/main.cpp index 2e8eeba91e..f1c334c52e 100644 --- a/Applications/About/main.cpp +++ b/Applications/About/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char** argv) auto window = GUI::Window::construct(); window->set_title("About SerenityOS"); - Rect window_rect { 0, 0, 240, 180 }; + Gfx::Rect window_rect { 0, 0, 240, 180 }; window_rect.center_within(GUI::Desktop::the().rect()); window->set_resizable(false); window->set_rect(window_rect); diff --git a/Applications/FontEditor/GlyphEditorWidget.cpp b/Applications/FontEditor/GlyphEditorWidget.cpp index 5bb1341423..3fc9ccffc5 100644 --- a/Applications/FontEditor/GlyphEditorWidget.cpp +++ b/Applications/FontEditor/GlyphEditorWidget.cpp @@ -70,7 +70,7 @@ void GlyphEditorWidget::paint_event(GUI::PaintEvent& event) for (int y = 0; y < font().glyph_height(); ++y) { for (int x = 0; x < font().max_glyph_width(); ++x) { - Rect rect { x * m_scale, y * m_scale, m_scale, m_scale }; + Gfx::Rect rect { x * m_scale, y * m_scale, m_scale, m_scale }; if (x >= font().glyph_width(m_glyph)) { painter.fill_rect(rect, Color::MidGray); } else { diff --git a/Applications/FontEditor/GlyphMapWidget.cpp b/Applications/FontEditor/GlyphMapWidget.cpp index 28973ed860..8cea9009e1 100644 --- a/Applications/FontEditor/GlyphMapWidget.cpp +++ b/Applications/FontEditor/GlyphMapWidget.cpp @@ -62,11 +62,11 @@ void GlyphMapWidget::set_selected_glyph(u8 glyph) update(); } -Rect GlyphMapWidget::get_outer_rect(u8 glyph) const +Gfx::Rect GlyphMapWidget::get_outer_rect(u8 glyph) const { int row = glyph / columns(); int column = glyph % columns(); - return Rect { + return Gfx::Rect { column * (font().max_glyph_width() + m_horizontal_spacing) + 1, row * (font().glyph_height() + m_vertical_spacing) + 1, font().max_glyph_width() + m_horizontal_spacing, @@ -94,8 +94,8 @@ void GlyphMapWidget::paint_event(GUI::PaintEvent& event) for (int row = 0; row < rows(); ++row) { for (int column = 0; column < columns(); ++column, ++glyph) { - Rect outer_rect = get_outer_rect(glyph); - Rect inner_rect( + Gfx::Rect outer_rect = get_outer_rect(glyph); + Gfx::Rect inner_rect( outer_rect.x() + m_horizontal_spacing / 2, outer_rect.y() + m_vertical_spacing / 2, font().max_glyph_width(), diff --git a/Applications/FontEditor/GlyphMapWidget.h b/Applications/FontEditor/GlyphMapWidget.h index 5cee940a9c..5056279fff 100644 --- a/Applications/FontEditor/GlyphMapWidget.h +++ b/Applications/FontEditor/GlyphMapWidget.h @@ -55,7 +55,7 @@ private: virtual void paint_event(GUI::PaintEvent&) override; virtual void mousedown_event(GUI::MouseEvent&) override; - Rect get_outer_rect(u8 glyph) const; + Gfx::Rect get_outer_rect(u8 glyph) const; RefPtr<Gfx::Font> m_font; int m_rows { 8 }; diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp index 55e920f096..0618790a0e 100644 --- a/Applications/HexEditor/HexEditor.cpp +++ b/Applications/HexEditor/HexEditor.cpp @@ -335,7 +335,7 @@ void HexEditor::scroll_position_into_view(int position) { int y = position / bytes_per_row(); int x = position % bytes_per_row(); - Rect rect { + Gfx::Rect rect { frame_thickness() + offset_margin_width() + (x * (character_width() * 3)) + 10, frame_thickness() + 5 + (y * line_height()), (character_width() * 3), @@ -477,7 +477,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event) painter.translate(frame_thickness(), frame_thickness()); painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value()); - Rect offset_clip_rect { + Gfx::Rect offset_clip_rect { 0, vertical_scrollbar().value(), 85, @@ -497,7 +497,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event) // paint offsets for (int i = min_row; i < max_row; i++) { - Rect side_offset_rect { + Gfx::Rect side_offset_rect { frame_thickness() + 5, frame_thickness() + 5 + (i * line_height()), width() - width_occupied_by_vertical_scrollbar(), @@ -530,7 +530,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event) } } - Rect hex_display_rect { + Gfx::Rect hex_display_rect { frame_thickness() + offset_margin_width() + (j * (character_width() * 3)) + 10, frame_thickness() + 5 + (i * line_height()), (character_width() * 3), @@ -546,7 +546,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event) auto line = String::format("%02X", m_buffer[byte_position]); painter.draw_text(hex_display_rect, line, Gfx::TextAlignment::TopLeft, text_color); - Rect text_display_rect { + Gfx::Rect text_display_rect { frame_thickness() + offset_margin_width() + (bytes_per_row() * (character_width() * 3)) + (j * character_width()) + 20, frame_thickness() + 5 + (i * line_height()), character_width(), diff --git a/Applications/PaintBrush/EllipseTool.cpp b/Applications/PaintBrush/EllipseTool.cpp index 77179826c0..99aa902575 100644 --- a/Applications/PaintBrush/EllipseTool.cpp +++ b/Applications/PaintBrush/EllipseTool.cpp @@ -42,7 +42,7 @@ EllipseTool::~EllipseTool() void EllipseTool::draw_using(GUI::Painter& painter) { - auto ellipse_intersecting_rect = Rect::from_two_points(m_ellipse_start_position, m_ellipse_end_position); + auto ellipse_intersecting_rect = Gfx::Rect::from_two_points(m_ellipse_start_position, m_ellipse_end_position); switch (m_mode) { case Mode::Outline: painter.draw_ellipse_intersecting(ellipse_intersecting_rect, m_widget->color_for(m_drawing_button), m_thickness); diff --git a/Applications/PaintBrush/EraseTool.cpp b/Applications/PaintBrush/EraseTool.cpp index b57d013232..06129de9a9 100644 --- a/Applications/PaintBrush/EraseTool.cpp +++ b/Applications/PaintBrush/EraseTool.cpp @@ -38,21 +38,21 @@ EraseTool::~EraseTool() { } -Rect EraseTool::build_rect(const Gfx::Point& pos, const Gfx::Rect& widget_rect) +Gfx::Rect EraseTool::build_rect(const Gfx::Point& pos, const Gfx::Rect& widget_rect) { const int base_eraser_size = 10; const int eraser_size = (base_eraser_size * m_thickness); const int eraser_radius = eraser_size / 2; const auto ex = pos.x(); const auto ey = pos.y(); - return Rect(ex - eraser_radius, ey - eraser_radius, eraser_size, eraser_size).intersected(widget_rect); + return Gfx::Rect(ex - eraser_radius, ey - eraser_radius, eraser_size, eraser_size).intersected(widget_rect); } void EraseTool::on_mousedown(GUI::MouseEvent& event) { if (event.button() != GUI::MouseButton::Left && event.button() != GUI::MouseButton::Right) return; - Rect r = build_rect(event.position(), m_widget->bitmap().rect()); + Gfx::Rect r = build_rect(event.position(), m_widget->bitmap().rect()); GUI::Painter painter(m_widget->bitmap()); painter.fill_rect(r, get_color()); m_widget->update(); @@ -64,7 +64,7 @@ void EraseTool::on_mousemove(GUI::MouseEvent& event) return; if (event.buttons() & GUI::MouseButton::Left || event.buttons() & GUI::MouseButton::Right) { - Rect r = build_rect(event.position(), m_widget->bitmap().rect()); + Gfx::Rect r = build_rect(event.position(), m_widget->bitmap().rect()); GUI::Painter painter(m_widget->bitmap()); painter.fill_rect(r, get_color()); m_widget->update(); diff --git a/Applications/PaintBrush/EraseTool.h b/Applications/PaintBrush/EraseTool.h index 5e68b33978..d91eb12c4e 100644 --- a/Applications/PaintBrush/EraseTool.h +++ b/Applications/PaintBrush/EraseTool.h @@ -46,7 +46,7 @@ public: private: Color get_color() const; virtual const char* class_name() const override { return "EraseTool"; } - Rect build_rect(const Gfx::Point& pos, const Gfx::Rect& widget_rect); + Gfx::Rect build_rect(const Gfx::Point& pos, const Gfx::Rect& widget_rect); RefPtr<GUI::Menu> m_context_menu; bool m_use_secondary_color { true }; diff --git a/Applications/PaintBrush/PaletteWidget.cpp b/Applications/PaintBrush/PaletteWidget.cpp index 9a309699ad..f4a2bedd18 100644 --- a/Applications/PaintBrush/PaletteWidget.cpp +++ b/Applications/PaintBrush/PaletteWidget.cpp @@ -95,7 +95,7 @@ PaletteWidget::PaletteWidget(PaintableWidget& paintable_widget, GUI::Widget* par m_primary_color_widget->set_frame_thickness(2); m_primary_color_widget->set_frame_shape(Gfx::FrameShape::Container); m_primary_color_widget->set_frame_shadow(Gfx::FrameShadow::Sunken); - Rect rect { 0, 0, 38, 15 }; + Gfx::Rect rect { 0, 0, 38, 15 }; rect.center_within(m_secondary_color_widget->relative_rect()); m_primary_color_widget->set_relative_rect(rect); m_primary_color_widget->set_fill_with_background_color(true); diff --git a/Applications/PaintBrush/RectangleTool.cpp b/Applications/PaintBrush/RectangleTool.cpp index 070ca6be84..5d016ce0af 100644 --- a/Applications/PaintBrush/RectangleTool.cpp +++ b/Applications/PaintBrush/RectangleTool.cpp @@ -42,7 +42,7 @@ RectangleTool::~RectangleTool() void RectangleTool::draw_using(GUI::Painter& painter) { - auto rect_to_draw = Rect::from_two_points(m_rectangle_start_position, m_rectangle_end_position); + auto rect_to_draw = Gfx::Rect::from_two_points(m_rectangle_start_position, m_rectangle_end_position); switch (m_mode) { case Mode::Fill: painter.fill_rect(rect_to_draw, m_widget->color_for(m_drawing_button)); diff --git a/Applications/Piano/KeysWidget.cpp b/Applications/Piano/KeysWidget.cpp index 4f7963de3f..aa8c951904 100644 --- a/Applications/Piano/KeysWidget.cpp +++ b/Applications/Piano/KeysWidget.cpp @@ -183,7 +183,7 @@ void KeysWidget::paint_event(GUI::PaintEvent& event) int x = 0; int i = 0; for (;;) { - Rect rect(x, 0, white_key_width, frame_inner_rect().height()); + Gfx::Rect rect(x, 0, white_key_width, frame_inner_rect().height()); painter.fill_rect(rect, m_key_on[note] ? note_pressed_color : Color::White); painter.draw_rect(rect, Color::Black); if (i < white_key_labels_count) { @@ -205,7 +205,7 @@ void KeysWidget::paint_event(GUI::PaintEvent& event) x = white_key_width - black_key_x_offset; i = 0; for (;;) { - Rect rect(x, 0, black_key_width, black_key_height); + Gfx::Rect rect(x, 0, black_key_width, black_key_height); painter.fill_rect(rect, m_key_on[note] ? note_pressed_color : Color::Black); painter.draw_rect(rect, Color::Black); if (i < black_key_labels_count) { @@ -263,7 +263,7 @@ int KeysWidget::note_for_event_position(const Gfx::Point& a_point) const bool black_key_on_left = note != 0 && key_pattern[(note - 1) % notes_per_octave] == Black; if (black_key_on_left) { int black_key_x = (white_keys * white_key_width) - black_key_x_offset; - Rect black_key(black_key_x, 0, black_key_width, black_key_height); + Gfx::Rect black_key(black_key_x, 0, black_key_width, black_key_height); if (black_key.contains(point)) return note - 1; } @@ -271,7 +271,7 @@ int KeysWidget::note_for_event_position(const Gfx::Point& a_point) const bool black_key_on_right = key_pattern[(note + 1) % notes_per_octave] == Black; if (black_key_on_right) { int black_key_x = ((white_keys + 1) * white_key_width) - black_key_x_offset; - Rect black_key(black_key_x, 0, black_key_width, black_key_height); + Gfx::Rect black_key(black_key_x, 0, black_key_width, black_key_height); if (black_key.contains(point)) return note + 1; } diff --git a/Applications/Piano/RollWidget.cpp b/Applications/Piano/RollWidget.cpp index e39206788d..8b2a8f93cd 100644 --- a/Applications/Piano/RollWidget.cpp +++ b/Applications/Piano/RollWidget.cpp @@ -80,7 +80,7 @@ void RollWidget::paint_event(GUI::PaintEvent& event) int x_pos = x * note_width; int next_x_pos = (x + 1) * note_width; int distance_to_next_x = next_x_pos - x_pos; - Rect rect(x_pos, y_pos, distance_to_next_x, note_height); + Gfx::Rect rect(x_pos, y_pos, distance_to_next_x, note_height); if (m_roll_notes[y + note_offset][x] == On) painter.fill_rect(rect, note_pressed_color); diff --git a/Applications/SystemMonitor/GraphWidget.cpp b/Applications/SystemMonitor/GraphWidget.cpp index 05c60def9a..047911d7ba 100644 --- a/Applications/SystemMonitor/GraphWidget.cpp +++ b/Applications/SystemMonitor/GraphWidget.cpp @@ -69,7 +69,7 @@ void GraphWidget::paint_event(GUI::PaintEvent& event) } if (!m_values.is_empty() && text_formatter) { - Rect text_rect = inner_rect.shrunken(8, 8); + Gfx::Rect text_rect = inner_rect.shrunken(8, 8); text_rect.set_height(font().glyph_height()); auto text = text_formatter(m_values.last(), m_max); painter.draw_text(text_rect.translated(1, 1), text.characters(), Gfx::TextAlignment::CenterRight, Color::Black); diff --git a/Applications/Taskbar/TaskbarWindow.cpp b/Applications/Taskbar/TaskbarWindow.cpp index af367d16a6..73afba57f2 100644 --- a/Applications/Taskbar/TaskbarWindow.cpp +++ b/Applications/Taskbar/TaskbarWindow.cpp @@ -123,7 +123,7 @@ void TaskbarWindow::create_quick_launch_bar() void TaskbarWindow::on_screen_rect_change(const Gfx::Rect& rect) { - Rect new_rect { rect.x(), rect.bottom() - taskbar_height() + 1, rect.width(), taskbar_height() }; + Gfx::Rect new_rect { rect.x(), rect.bottom() - taskbar_height() + 1, rect.width(), taskbar_height() }; set_rect(new_rect); } diff --git a/Applications/Taskbar/WindowList.h b/Applications/Taskbar/WindowList.h index 12a23f5e87..141a81c48d 100644 --- a/Applications/Taskbar/WindowList.h +++ b/Applications/Taskbar/WindowList.h @@ -50,7 +50,7 @@ public: String title() const { return m_title; } void set_title(const String& title) { m_title = title; } - Rect rect() const { return m_rect; } + Gfx::Rect rect() const { return m_rect; } void set_rect(const Gfx::Rect& rect) { m_rect = rect; } GUI::Button* button() { return m_button; } diff --git a/Applications/Welcome/main.cpp b/Applications/Welcome/main.cpp index 624a3f0e4c..3ce100c035 100644 --- a/Applications/Welcome/main.cpp +++ b/Applications/Welcome/main.cpp @@ -90,7 +90,7 @@ int main(int argc, char** argv) auto window = GUI::Window::construct(); window->set_title("Welcome to Serenity"); - Rect window_rect { 0, 0, 640, 360 }; + Gfx::Rect window_rect { 0, 0, 640, 360 }; window_rect.center_within(GUI::Desktop::the().rect()); window->set_resizable(true); window->set_rect(window_rect); diff --git a/DevTools/HackStudio/CursorTool.cpp b/DevTools/HackStudio/CursorTool.cpp index 6f180bb27e..f4ac8ff468 100644 --- a/DevTools/HackStudio/CursorTool.cpp +++ b/DevTools/HackStudio/CursorTool.cpp @@ -168,11 +168,11 @@ void CursorTool::set_rubber_band_position(const Gfx::Point& position) m_editor.form_widget().update(); } -Rect CursorTool::rubber_band_rect() const +Gfx::Rect CursorTool::rubber_band_rect() const { if (!m_rubber_banding) return {}; - return Rect::from_two_points(m_rubber_band_origin, m_rubber_band_position); + return Gfx::Rect::from_two_points(m_rubber_band_origin, m_rubber_band_position); } void CursorTool::on_second_paint(GUI::Painter& painter, GUI::PaintEvent&) diff --git a/DevTools/IPCCompiler/main.cpp b/DevTools/IPCCompiler/main.cpp index c23c8ee1a3..02d7699ad2 100644 --- a/DevTools/IPCCompiler/main.cpp +++ b/DevTools/IPCCompiler/main.cpp @@ -324,23 +324,23 @@ int main(int argc, char** argv) dbg() << " }"; dbg() << " " << parameter.name << " = *" << parameter.name << "_impl;"; dbg() << " }"; - } else if (parameter.type == "Color") { + } else if (parameter.type == "Gfx::Color") { dbg() << " u32 " << parameter.name << "_rgba = 0;"; dbg() << " stream >> " << parameter.name << "_rgba;"; dbg() << " " << parameter.name << " = Gfx::Color::from_rgba(" << parameter.name << "_rgba);"; - } else if (parameter.type == "Size") { + } else if (parameter.type == "Gfx::Size") { dbg() << " int " << parameter.name << "_width = 0;"; dbg() << " stream >> " << parameter.name << "_width;"; dbg() << " int " << parameter.name << "_height = 0;"; dbg() << " stream >> " << parameter.name << "_height;"; dbg() << " " << parameter.name << " = { " << parameter.name << "_width, " << parameter.name << "_height };"; - } else if (parameter.type == "Point") { + } else if (parameter.type == "Gfx::Point") { dbg() << " int " << parameter.name << "_x = 0;"; dbg() << " stream >> " << parameter.name << "_x;"; dbg() << " int " << parameter.name << "_y = 0;"; dbg() << " stream >> " << parameter.name << "_y;"; dbg() << " " << parameter.name << " = { " << parameter.name << "_x, " << parameter.name << "_y };"; - } else if (parameter.type == "Rect") { + } else if (parameter.type == "Gfx::Rect") { dbg() << " int " << parameter.name << "_x = 0;"; dbg() << " stream >> " << parameter.name << "_x;"; dbg() << " int " << parameter.name << "_y = 0;"; @@ -350,7 +350,7 @@ int main(int argc, char** argv) dbg() << " int " << parameter.name << "_height = 0;"; dbg() << " stream >> " << parameter.name << "_height;"; dbg() << " " << parameter.name << " = { " << parameter.name << "_x, " << parameter.name << "_y, " << parameter.name << "_width, " << parameter.name << "_height };"; - } else if (parameter.type == "Vector<Rect>") { + } else if (parameter.type == "Vector<Gfx::Rect>") { dbg() << " int " << parameter.name << "_size = 0;"; dbg() << " stream >> " << parameter.name << "_size;"; dbg() << " for (int i = 0; i < " << parameter.name << "_size; ++i) {"; @@ -399,20 +399,20 @@ int main(int argc, char** argv) dbg() << " stream << static_cast<i32>(m_" << parameter.name << ".length());"; dbg() << " stream << m_" << parameter.name << ";"; dbg() << " }"; - } else if (parameter.type == "Color") { + } else if (parameter.type == "Gfx::Color") { dbg() << " stream << m_" << parameter.name << ".value();"; - } else if (parameter.type == "Size") { + } else if (parameter.type == "Gfx::Size") { dbg() << " stream << m_" << parameter.name << ".width();"; dbg() << " stream << m_" << parameter.name << ".height();"; - } else if (parameter.type == "Point") { + } else if (parameter.type == "Gfx::Point") { dbg() << " stream << m_" << parameter.name << ".x();"; dbg() << " stream << m_" << parameter.name << ".y();"; - } else if (parameter.type == "Rect") { + } else if (parameter.type == "Gfx::Rect") { dbg() << " stream << m_" << parameter.name << ".x();"; dbg() << " stream << m_" << parameter.name << ".y();"; dbg() << " stream << m_" << parameter.name << ".width();"; dbg() << " stream << m_" << parameter.name << ".height();"; - } else if (parameter.type == "Vector<Rect>") { + } else if (parameter.type == "Vector<Gfx::Rect>") { dbg() << " stream << m_" << parameter.name << ".size();"; dbg() << " for (auto& rect : m_" << parameter.name << ") {"; dbg() << " stream << rect.x();"; diff --git a/DevTools/VisualBuilder/VBWidget.cpp b/DevTools/VisualBuilder/VBWidget.cpp index 93cce9648b..307f27218c 100644 --- a/DevTools/VisualBuilder/VBWidget.cpp +++ b/DevTools/VisualBuilder/VBWidget.cpp @@ -59,7 +59,7 @@ VBWidget::~VBWidget() m_gwidget->parent()->remove_child(*m_gwidget); } -Rect VBWidget::rect() const +Gfx::Rect VBWidget::rect() const { return m_gwidget->window_relative_rect(); } @@ -80,7 +80,7 @@ bool VBWidget::is_selected() const return m_form.is_selected(*this); } -Rect VBWidget::grabber_rect(Direction direction) const +Gfx::Rect VBWidget::grabber_rect(Direction direction) const { int grabber_size = 5; int half_grabber_size = grabber_size / 2; diff --git a/DevTools/VisualBuilder/VBWidget.h b/DevTools/VisualBuilder/VBWidget.h index fd898a7555..6d593363da 100644 --- a/DevTools/VisualBuilder/VBWidget.h +++ b/DevTools/VisualBuilder/VBWidget.h @@ -79,10 +79,10 @@ public: bool is_selected() const; - Rect rect() const; + Gfx::Rect rect() const; void set_rect(const Gfx::Rect&); - Rect grabber_rect(Direction) const; + Gfx::Rect grabber_rect(Direction) const; Direction grabber_at(const Gfx::Point&) const; GUI::Widget* gwidget() { return m_gwidget; } @@ -98,7 +98,7 @@ public: void property_did_change(); - Rect transform_origin_rect() const { return m_transform_origin_rect; } + Gfx::Rect transform_origin_rect() const { return m_transform_origin_rect; } void capture_transform_origin_rect(); bool is_in_layout() const; diff --git a/Games/Minesweeper/Field.cpp b/Games/Minesweeper/Field.cpp index 7f4039bc28..5ccd5f0bcf 100644 --- a/Games/Minesweeper/Field.cpp +++ b/Games/Minesweeper/Field.cpp @@ -237,7 +237,7 @@ void Field::reset() for (int c = 0; c < columns(); ++c) { if (!m_squares[i]) m_squares[i] = make<Square>(); - Rect rect = { frame_thickness() + c * square_size(), frame_thickness() + r * square_size(), square_size(), square_size() }; + Gfx::Rect rect = { frame_thickness() + c * square_size(), frame_thickness() + r * square_size(), square_size(), square_size() }; auto& square = this->square(r, c); square.field = this; square.row = r; diff --git a/Games/Snake/SnakeGame.cpp b/Games/Snake/SnakeGame.cpp index 9567499662..1c312c3485 100644 --- a/Games/Snake/SnakeGame.cpp +++ b/Games/Snake/SnakeGame.cpp @@ -90,13 +90,13 @@ void SnakeGame::spawn_fruit() m_fruit_type = rand() % m_fruit_bitmaps.size(); } -Rect SnakeGame::score_rect() const +Gfx::Rect SnakeGame::score_rect() const { int score_width = font().width(m_score_text); return { width() - score_width - 2, height() - font().glyph_height() - 2, score_width, font().glyph_height() }; } -Rect SnakeGame::high_score_rect() const +Gfx::Rect SnakeGame::high_score_rect() const { int high_score_width = font().width(m_high_score_text); return { 2, height() - font().glyph_height() - 2, high_score_width, font().glyph_height() }; @@ -193,7 +193,7 @@ void SnakeGame::keydown_event(GUI::KeyEvent& event) } } -Rect SnakeGame::cell_rect(const Coordinate& coord) const +Gfx::Rect SnakeGame::cell_rect(const Coordinate& coord) const { auto game_rect = rect(); auto cell_size = Size(game_rect.width() / m_columns, game_rect.height() / m_rows); @@ -216,10 +216,10 @@ void SnakeGame::paint_event(GUI::PaintEvent& event) auto rect = cell_rect(part); painter.fill_rect(rect, Color::from_rgb(0xaaaa00)); - Rect left_side(rect.x(), rect.y(), 2, rect.height()); - Rect top_side(rect.x(), rect.y(), rect.width(), 2); - Rect right_side(rect.right() - 1, rect.y(), 2, rect.height()); - Rect bottom_side(rect.x(), rect.bottom() - 1, rect.width(), 2); + Gfx::Rect left_side(rect.x(), rect.y(), 2, rect.height()); + Gfx::Rect top_side(rect.x(), rect.y(), rect.width(), 2); + Gfx::Rect right_side(rect.right() - 1, rect.y(), 2, rect.height()); + Gfx::Rect bottom_side(rect.x(), rect.bottom() - 1, rect.width(), 2); painter.fill_rect(left_side, Color::from_rgb(0xcccc00)); painter.fill_rect(right_side, Color::from_rgb(0x888800)); painter.fill_rect(top_side, Color::from_rgb(0xcccc00)); diff --git a/Games/Snake/SnakeGame.h b/Games/Snake/SnakeGame.h index 3cc2a40f50..2e60715259 100644 --- a/Games/Snake/SnakeGame.h +++ b/Games/Snake/SnakeGame.h @@ -63,9 +63,9 @@ private: bool is_available(const Coordinate&); void queue_velocity(int v, int h); const Velocity& last_velocity() const; - Rect cell_rect(const Coordinate&) const; - Rect score_rect() const; - Rect high_score_rect() const; + Gfx::Rect cell_rect(const Coordinate&) const; + Gfx::Rect score_rect() const; + Gfx::Rect high_score_rect() const; int m_rows { 20 }; int m_columns { 20 }; diff --git a/Libraries/LibGUI/GAbstractTableView.cpp b/Libraries/LibGUI/GAbstractTableView.cpp index fdaa15b73e..265ef25ab4 100644 --- a/Libraries/LibGUI/GAbstractTableView.cpp +++ b/Libraries/LibGUI/GAbstractTableView.cpp @@ -103,7 +103,7 @@ void AbstractTableView::update_content_size() set_size_occupied_by_fixed_elements({ 0, header_height() }); } -Rect AbstractTableView::header_rect(int column_index) const +Gfx::Rect AbstractTableView::header_rect(int column_index) const { if (!model()) return {}; @@ -141,7 +141,7 @@ void AbstractTableView::paint_headers(Painter& painter) continue; int column_width = this->column_width(column_index); bool is_key_column = model()->key_column() == column_index; - Rect cell_rect(x_offset, 0, column_width + horizontal_padding() * 2, header_height()); + Gfx::Rect cell_rect(x_offset, 0, column_width + horizontal_padding() * 2, header_height()); bool pressed = column_index == m_pressed_column_header_index && m_pressed_column_header_is_pressed; bool hovered = column_index == m_hovered_column_header_index && model()->column_metadata(column_index).sortable == Model::ColumnMetadata::Sortable::True; Gfx::StylePainter::paint_button(painter, cell_rect, palette(), Gfx::ButtonStyle::Normal, pressed, hovered); @@ -217,7 +217,7 @@ void AbstractTableView::set_cell_painting_delegate(int column, OwnPtr<TableCellP void AbstractTableView::update_headers() { - Rect rect { 0, 0, frame_inner_rect().width(), header_height() }; + Gfx::Rect rect { 0, 0, frame_inner_rect().width(), header_height() }; rect.move_by(frame_thickness(), frame_thickness()); update(rect); } @@ -229,7 +229,7 @@ AbstractTableView::ColumnData& AbstractTableView::column_data(int column) const return m_column_data.at(column); } -Rect AbstractTableView::column_resize_grabbable_rect(int column) const +Gfx::Rect AbstractTableView::column_resize_grabbable_rect(int column) const { if (!model()) return {}; @@ -525,7 +525,7 @@ void AbstractTableView::leave_event(Core::Event&) set_hovered_header_index(-1); } -Rect AbstractTableView::content_rect(int row, int column) const +Gfx::Rect AbstractTableView::content_rect(int row, int column) const { auto row_rect = this->row_rect(row); int x = 0; @@ -535,12 +535,12 @@ Rect AbstractTableView::content_rect(int row, int column) const return { row_rect.x() + x, row_rect.y(), column_width(column) + horizontal_padding() * 2, item_height() }; } -Rect AbstractTableView::content_rect(const ModelIndex& index) const +Gfx::Rect AbstractTableView::content_rect(const ModelIndex& index) const { return content_rect(index.row(), index.column()); } -Rect AbstractTableView::row_rect(int item_index) const +Gfx::Rect AbstractTableView::row_rect(int item_index) const { return { 0, header_height() + (item_index * item_height()), max(content_size().width(), width()), item_height() }; } diff --git a/Libraries/LibGUI/GAbstractTableView.h b/Libraries/LibGUI/GAbstractTableView.h index 3b01b099a8..c3b221c1df 100644 --- a/Libraries/LibGUI/GAbstractTableView.h +++ b/Libraries/LibGUI/GAbstractTableView.h @@ -64,9 +64,9 @@ public: Point adjusted_position(const Gfx::Point&) const; - virtual Rect content_rect(const ModelIndex&) const override; - Rect content_rect(int row, int column) const; - Rect row_rect(int item_index) const; + virtual Gfx::Rect content_rect(const ModelIndex&) const override; + Gfx::Rect content_rect(int row, int column) const; + Gfx::Rect row_rect(int item_index) const; void scroll_into_view(const ModelIndex&, Orientation); @@ -89,7 +89,7 @@ protected: virtual void toggle_index(const ModelIndex&) {} void paint_headers(Painter&); - Rect header_rect(int column) const; + Gfx::Rect header_rect(int column) const; static const Gfx::Font& header_font(); void update_headers(); @@ -109,7 +109,7 @@ protected: Menu& ensure_header_context_menu(); RefPtr<Menu> m_header_context_menu; - Rect column_resize_grabbable_rect(int) const; + Gfx::Rect column_resize_grabbable_rect(int) const; int column_width(int) const; void update_content_size(); virtual void update_column_sizes(); diff --git a/Libraries/LibGUI/GAbstractView.h b/Libraries/LibGUI/GAbstractView.h index 094b779ff1..7137c8c74d 100644 --- a/Libraries/LibGUI/GAbstractView.h +++ b/Libraries/LibGUI/GAbstractView.h @@ -55,7 +55,7 @@ public: virtual void did_update_model(); virtual void did_update_selection(); - virtual Rect content_rect(const ModelIndex&) const { return {}; } + virtual Gfx::Rect content_rect(const ModelIndex&) const { return {}; } virtual ModelIndex index_at_event_position(const Gfx::Point&) const = 0; void begin_editing(const ModelIndex&); void stop_editing(); diff --git a/Libraries/LibGUI/GApplication.cpp b/Libraries/LibGUI/GApplication.cpp index 90c0796a6f..9c92010167 100644 --- a/Libraries/LibGUI/GApplication.cpp +++ b/Libraries/LibGUI/GApplication.cpp @@ -137,7 +137,7 @@ void Application::show_tooltip(const StringView& tooltip, const Gfx::Point& scre } m_tooltip_window->set_tooltip(tooltip); - Rect desktop_rect = Desktop::the().rect(); + Gfx::Rect desktop_rect = Desktop::the().rect(); const int margin = 30; Point adjusted_pos = screen_location; diff --git a/Libraries/LibGUI/GBoxLayout.cpp b/Libraries/LibGUI/GBoxLayout.cpp index 9707b58bf5..c8c2986c3b 100644 --- a/Libraries/LibGUI/GBoxLayout.cpp +++ b/Libraries/LibGUI/GBoxLayout.cpp @@ -119,7 +119,7 @@ void BoxLayout::run(Widget& widget) continue; if (!entry.widget->is_visible()) continue; - Rect rect(current_x, current_y, 0, 0); + Gfx::Rect rect(current_x, current_y, 0, 0); if (entry.layout) { // FIXME: Implement recursive layout. ASSERT_NOT_REACHED(); diff --git a/Libraries/LibGUI/GButton.cpp b/Libraries/LibGUI/GButton.cpp index 58c4cd1ff6..22d310e04d 100644 --- a/Libraries/LibGUI/GButton.cpp +++ b/Libraries/LibGUI/GButton.cpp @@ -78,7 +78,7 @@ void Button::paint_event(PaintEvent& event) content_rect.set_width(content_rect.width() - m_icon->width() - 4); } - Rect text_rect { 0, 0, font.width(text()), font.glyph_height() }; + Gfx::Rect text_rect { 0, 0, font.width(text()), font.glyph_height() }; if (text_rect.width() > content_rect.width()) text_rect.set_width(content_rect.width()); text_rect.align_within(content_rect, text_alignment()); diff --git a/Libraries/LibGUI/GCheckBox.cpp b/Libraries/LibGUI/GCheckBox.cpp index 085bfa9b79..d24a6b7ff9 100644 --- a/Libraries/LibGUI/GCheckBox.cpp +++ b/Libraries/LibGUI/GCheckBox.cpp @@ -79,7 +79,7 @@ void CheckBox::paint_event(PaintEvent& event) if (fill_with_background_color()) painter.fill_rect(rect(), palette().window()); - Rect box_rect { + Gfx::Rect box_rect { 0, height() / 2 - s_box_height / 2 - 1, s_box_width, s_box_height }; diff --git a/Libraries/LibGUI/GColumnsView.cpp b/Libraries/LibGUI/GColumnsView.cpp index 65ccbaaf50..d12f5895d4 100644 --- a/Libraries/LibGUI/GColumnsView.cpp +++ b/Libraries/LibGUI/GColumnsView.cpp @@ -101,17 +101,17 @@ void ColumnsView::paint_event(PaintEvent& event) text_color = palette().selection_text(); } - Rect row_rect { column_x, row * item_height(), column.width, item_height() }; + Gfx::Rect row_rect { column_x, row * item_height(), column.width, item_height() }; painter.fill_rect(row_rect, background_color); auto icon = model()->data(index, Model::Role::Icon); - Rect icon_rect = { column_x + icon_spacing(), 0, icon_size(), icon_size() }; + Gfx::Rect icon_rect = { column_x + icon_spacing(), 0, icon_size(), icon_size() }; icon_rect.center_vertically_within(row_rect); if (icon.is_icon()) if (auto* bitmap = icon.as_icon().bitmap_for_size(icon_size())) painter.blit(icon_rect.location(), *bitmap, bitmap->rect()); - Rect text_rect = { + Gfx::Rect text_rect = { icon_rect.right() + 1 + icon_spacing(), row * item_height(), column.width - icon_spacing() - icon_size() - icon_spacing() - icon_spacing() - s_arrow_bitmap_width - icon_spacing(), item_height() }; @@ -120,7 +120,7 @@ void ColumnsView::paint_event(PaintEvent& event) bool expandable = model()->row_count(index) > 0; if (expandable) { - Rect arrow_rect = { + Gfx::Rect arrow_rect = { text_rect.right() + 1 + icon_spacing(), 0, s_arrow_bitmap_width, s_arrow_bitmap_height }; diff --git a/Libraries/LibGUI/GComboBox.cpp b/Libraries/LibGUI/GComboBox.cpp index 6d904874a0..a8985ee684 100644 --- a/Libraries/LibGUI/GComboBox.cpp +++ b/Libraries/LibGUI/GComboBox.cpp @@ -118,7 +118,7 @@ void ComboBox::open() model()->row_count() * m_list_view->item_height() + m_list_view->frame_thickness() * 2 }; - Rect list_window_rect { my_screen_rect.bottom_left(), size }; + Gfx::Rect list_window_rect { my_screen_rect.bottom_left(), size }; list_window_rect.intersect(Desktop::the().rect().shrunken(0, 128)); m_list_window->set_rect(list_window_rect); diff --git a/Libraries/LibGUI/GDesktop.h b/Libraries/LibGUI/GDesktop.h index 376aa1beda..4105609e82 100644 --- a/Libraries/LibGUI/GDesktop.h +++ b/Libraries/LibGUI/GDesktop.h @@ -43,7 +43,7 @@ public: String wallpaper() const; bool set_wallpaper(const StringView& path); - Rect rect() const { return m_rect; } + Gfx::Rect rect() const { return m_rect; } void did_receive_screen_rect(Badge<WindowServerConnection>, const Gfx::Rect&); Function<void(const Gfx::Rect&)> on_rect_change; diff --git a/Libraries/LibGUI/GEvent.h b/Libraries/LibGUI/GEvent.h index 745bb8a4b3..bfff565bd4 100644 --- a/Libraries/LibGUI/GEvent.h +++ b/Libraries/LibGUI/GEvent.h @@ -119,7 +119,7 @@ public: } String title() const { return m_title; } - Rect rect() const { return m_rect; } + Gfx::Rect rect() const { return m_rect; } bool is_active() const { return m_active; } WindowType window_type() const { return m_window_type; } bool is_minimized() const { return m_minimized; } @@ -140,7 +140,7 @@ public: { } - Rect rect() const { return m_rect; } + Gfx::Rect rect() const { return m_rect; } private: Gfx::Rect m_rect; @@ -165,18 +165,18 @@ private: class MultiPaintEvent final : public Event { public: - explicit MultiPaintEvent(const Vector<Rect, 32>& rects, const Gfx::Size& window_size) + explicit MultiPaintEvent(const Vector<Gfx::Rect, 32>& rects, const Gfx::Size& window_size) : Event(Event::MultiPaint) , m_rects(rects) , m_window_size(window_size) { } - const Vector<Rect, 32>& rects() const { return m_rects; } + const Vector<Gfx::Rect, 32>& rects() const { return m_rects; } Size window_size() const { return m_window_size; } private: - Vector<Rect, 32> m_rects; + Vector<Gfx::Rect, 32> m_rects; Gfx::Size m_window_size; }; @@ -189,7 +189,7 @@ public: { } - Rect rect() const { return m_rect; } + Gfx::Rect rect() const { return m_rect; } Size window_size() const { return m_window_size; } private: diff --git a/Libraries/LibGUI/GFrame.h b/Libraries/LibGUI/GFrame.h index cfa6bf6c76..35b966aa45 100644 --- a/Libraries/LibGUI/GFrame.h +++ b/Libraries/LibGUI/GFrame.h @@ -45,8 +45,8 @@ public: Gfx::FrameShape frame_shape() const { return m_shape; } void set_frame_shape(Gfx::FrameShape shape) { m_shape = shape; } - Rect frame_inner_rect_for_size(const Gfx::Size& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; } - Rect frame_inner_rect() const { return frame_inner_rect_for_size(size()); } + Gfx::Rect frame_inner_rect_for_size(const Gfx::Size& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; } + Gfx::Rect frame_inner_rect() const { return frame_inner_rect_for_size(size()); } protected: explicit Frame(Widget* parent = nullptr); diff --git a/Libraries/LibGUI/GGroupBox.cpp b/Libraries/LibGUI/GGroupBox.cpp index e5aeff6584..817593d974 100644 --- a/Libraries/LibGUI/GGroupBox.cpp +++ b/Libraries/LibGUI/GGroupBox.cpp @@ -51,13 +51,13 @@ void GroupBox::paint_event(PaintEvent& event) Painter painter(*this); painter.add_clip_rect(event.rect()); - Rect frame_rect { + Gfx::Rect frame_rect { 0, font().glyph_height() / 2, width(), height() - font().glyph_height() / 2 }; Gfx::StylePainter::paint_frame(painter, frame_rect, palette(), Gfx::FrameShape::Box, Gfx::FrameShadow::Sunken, 2); - Rect text_rect { 4, 0, font().width(m_title) + 6, font().glyph_height() }; + Gfx::Rect text_rect { 4, 0, font().width(m_title) + 6, font().glyph_height() }; painter.fill_rect(text_rect, palette().button()); painter.draw_text(text_rect, m_title, Gfx::TextAlignment::Center, palette().button_text()); } diff --git a/Libraries/LibGUI/GItemView.cpp b/Libraries/LibGUI/GItemView.cpp index 17a4567f2d..b5991d634f 100644 --- a/Libraries/LibGUI/GItemView.cpp +++ b/Libraries/LibGUI/GItemView.cpp @@ -85,7 +85,7 @@ void ItemView::update_content_size() set_content_size({ content_width, content_height }); } -Rect ItemView::item_rect(int item_index) const +Gfx::Rect ItemView::item_rect(int item_index) const { if (!m_visual_row_count || !m_visual_column_count) return {}; @@ -106,9 +106,9 @@ Vector<int> ItemView::items_intersecting_rect(const Gfx::Rect& rect) const const auto& font = column_metadata.font ? *column_metadata.font : this->font(); Vector<int> item_indexes; for (int item_index = 0; item_index < item_count(); ++item_index) { - Rect item_rect; - Rect icon_rect; - Rect text_rect; + Gfx::Rect item_rect; + Gfx::Rect icon_rect; + Gfx::Rect text_rect; auto item_text = model()->data(model()->index(item_index, model_column())); get_item_rects(item_index, font, item_text, item_rect, icon_rect, text_rect); if (icon_rect.intersects(rect) || text_rect.intersects(rect)) @@ -126,9 +126,9 @@ ModelIndex ItemView::index_at_event_position(const Gfx::Point& position) const const auto& column_metadata = model()->column_metadata(model_column()); const auto& font = column_metadata.font ? *column_metadata.font : this->font(); for (int item_index = 0; item_index < item_count(); ++item_index) { - Rect item_rect; - Rect icon_rect; - Rect text_rect; + Gfx::Rect item_rect; + Gfx::Rect icon_rect; + Gfx::Rect text_rect; auto index = model()->index(item_index, model_column()); auto item_text = model()->data(index); get_item_rects(item_index, font, item_text, item_rect, icon_rect, text_rect); @@ -186,7 +186,7 @@ void ItemView::mousemove_event(MouseEvent& event) if (m_rubber_banding) { if (m_rubber_band_current != event.position()) { m_rubber_band_current = event.position(); - auto rubber_band_rect = Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current); + auto rubber_band_rect = Gfx::Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current); selection().clear(); for (auto item_index : items_intersecting_rect(rubber_band_rect)) { selection().add(model()->index(item_index, model_column())); @@ -204,7 +204,7 @@ void ItemView::mousemove_event(MouseEvent& event) AbstractView::mousemove_event(event); } -void ItemView::get_item_rects(int item_index, const Gfx::Font& font, const Variant& item_text, Rect& item_rect, Rect& icon_rect, Rect& text_rect) const +void ItemView::get_item_rects(int item_index, const Gfx::Font& font, const Variant& item_text, Gfx::Rect& item_rect, Gfx::Rect& icon_rect, Gfx::Rect& text_rect) const { item_rect = this->item_rect(item_index); icon_rect = { 0, 0, 32, 32 }; @@ -224,7 +224,7 @@ void ItemView::second_paint_event(PaintEvent& event) Painter painter(*this); painter.add_clip_rect(event.rect()); - auto rubber_band_rect = Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current); + auto rubber_band_rect = Gfx::Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current); painter.fill_rect(rubber_band_rect, parent_widget()->palette().rubber_band_fill()); painter.draw_rect(rubber_band_rect, parent_widget()->palette().rubber_band_border()); } @@ -256,9 +256,9 @@ void ItemView::paint_event(PaintEvent& event) auto icon = model()->data(model_index, Model::Role::Icon); auto item_text = model()->data(model_index, Model::Role::Display); - Rect item_rect; - Rect icon_rect; - Rect text_rect; + Gfx::Rect item_rect; + Gfx::Rect icon_rect; + Gfx::Rect text_rect; get_item_rects(item_index, font, item_text, item_rect, icon_rect, text_rect); if (icon.is_icon()) { diff --git a/Libraries/LibGUI/GItemView.h b/Libraries/LibGUI/GItemView.h index 5520f0a596..76c929e92d 100644 --- a/Libraries/LibGUI/GItemView.h +++ b/Libraries/LibGUI/GItemView.h @@ -65,10 +65,10 @@ private: virtual void keydown_event(KeyEvent&) override; int item_count() const; - Rect item_rect(int item_index) const; + Gfx::Rect item_rect(int item_index) const; Vector<int> items_intersecting_rect(const Gfx::Rect&) const; void update_content_size(); - void get_item_rects(int item_index, const Gfx::Font&, const Variant& item_text, Rect& item_rect, Rect& icon_rect, Rect& text_rect) const; + void get_item_rects(int item_index, const Gfx::Font&, const Variant& item_text, Gfx::Rect& item_rect, Gfx::Rect& icon_rect, Gfx::Rect& text_rect) const; int m_horizontal_padding { 5 }; int m_model_column { 0 }; diff --git a/Libraries/LibGUI/GListView.cpp b/Libraries/LibGUI/GListView.cpp index a375a91391..4d11539403 100644 --- a/Libraries/LibGUI/GListView.cpp +++ b/Libraries/LibGUI/GListView.cpp @@ -76,12 +76,12 @@ void ListView::did_update_model() update(); } -Rect ListView::content_rect(int row) const +Gfx::Rect ListView::content_rect(int row) const { return { 0, row * item_height(), content_width(), item_height() }; } -Rect ListView::content_rect(const ModelIndex& index) const +Gfx::Rect ListView::content_rect(const ModelIndex& index) const { return content_rect(index.row()); } @@ -138,7 +138,7 @@ void ListView::paint_event(PaintEvent& event) auto column_metadata = model()->column_metadata(m_model_column); - Rect row_rect(0, y, content_width(), item_height()); + Gfx::Rect row_rect(0, y, content_width(), item_height()); painter.fill_rect(row_rect, background_color); auto index = model()->index(row_index, m_model_column); auto data = model()->data(index); @@ -163,7 +163,7 @@ void ListView::paint_event(PaintEvent& event) ++painted_item_index; }; - Rect unpainted_rect(0, painted_item_index * item_height(), exposed_width, height()); + Gfx::Rect unpainted_rect(0, painted_item_index * item_height(), exposed_width, height()); painter.fill_rect(unpainted_rect, palette().color(background_role())); } diff --git a/Libraries/LibGUI/GListView.h b/Libraries/LibGUI/GListView.h index be0d062a63..e12131d206 100644 --- a/Libraries/LibGUI/GListView.h +++ b/Libraries/LibGUI/GListView.h @@ -54,7 +54,7 @@ public: Point adjusted_position(const Gfx::Point&) const; virtual ModelIndex index_at_event_position(const Gfx::Point&) const override; - virtual Rect content_rect(const ModelIndex&) const override; + virtual Gfx::Rect content_rect(const ModelIndex&) const override; int model_column() const { return m_model_column; } void set_model_column(int column) { m_model_column = column; } @@ -66,7 +66,7 @@ private: virtual void keydown_event(KeyEvent&) override; virtual void resize_event(ResizeEvent&) override; - Rect content_rect(int row) const; + Gfx::Rect content_rect(int row) const; int item_count() const; void update_content_size(); diff --git a/Libraries/LibGUI/GRadioButton.cpp b/Libraries/LibGUI/GRadioButton.cpp index eda447398c..369a6f2a65 100644 --- a/Libraries/LibGUI/GRadioButton.cpp +++ b/Libraries/LibGUI/GRadioButton.cpp @@ -55,12 +55,12 @@ void RadioButton::paint_event(PaintEvent& event) Painter painter(*this); painter.add_clip_rect(event.rect()); - Rect circle_rect { { 2, 0 }, circle_size() }; + Gfx::Rect circle_rect { { 2, 0 }, circle_size() }; circle_rect.center_vertically_within(rect()); Gfx::StylePainter::paint_radio_button(painter, circle_rect, palette(), is_checked(), is_being_pressed()); - Rect text_rect { circle_rect.right() + 4, 0, font().width(text()), font().glyph_height() }; + Gfx::Rect text_rect { circle_rect.right() + 4, 0, font().width(text()), font().glyph_height() }; text_rect.center_vertically_within(rect()); paint_text(painter, text_rect, font(), Gfx::TextAlignment::TopLeft); } diff --git a/Libraries/LibGUI/GScrollBar.cpp b/Libraries/LibGUI/GScrollBar.cpp index 415b38de7f..5f35ca2dbd 100644 --- a/Libraries/LibGUI/GScrollBar.cpp +++ b/Libraries/LibGUI/GScrollBar.cpp @@ -149,12 +149,12 @@ void ScrollBar::set_value(int value) update(); } -Rect ScrollBar::decrement_button_rect() const +Gfx::Rect ScrollBar::decrement_button_rect() const { return { 0, 0, button_width(), button_height() }; } -Rect ScrollBar::increment_button_rect() const +Gfx::Rect ScrollBar::increment_button_rect() const { if (orientation() == Orientation::Vertical) return { 0, height() - button_height(), button_width(), button_height() }; @@ -162,7 +162,7 @@ Rect ScrollBar::increment_button_rect() const return { width() - button_width(), 0, button_width(), button_height() }; } -Rect ScrollBar::decrement_gutter_rect() const +Gfx::Rect ScrollBar::decrement_gutter_rect() const { if (orientation() == Orientation::Vertical) return { 0, button_height(), button_width(), scrubber_rect().top() - button_height() }; @@ -170,7 +170,7 @@ Rect ScrollBar::decrement_gutter_rect() const return { button_width(), 0, scrubber_rect().x() - button_width(), button_height() }; } -Rect ScrollBar::increment_gutter_rect() const +Gfx::Rect ScrollBar::increment_gutter_rect() const { auto scrubber_rect = this->scrubber_rect(); if (orientation() == Orientation::Vertical) @@ -199,7 +199,7 @@ int ScrollBar::scrubber_size() const return ::max(pixel_range - value_range, button_size()); } -Rect ScrollBar::scrubber_rect() const +Gfx::Rect ScrollBar::scrubber_rect() const { if (!has_scrubber() || length(orientation()) <= (button_size() * 2) + scrubber_size()) return {}; diff --git a/Libraries/LibGUI/GScrollBar.h b/Libraries/LibGUI/GScrollBar.h index ec36527c0e..c46534fecc 100644 --- a/Libraries/LibGUI/GScrollBar.h +++ b/Libraries/LibGUI/GScrollBar.h @@ -81,11 +81,11 @@ private: int button_size() const { return length(orientation()) <= (default_button_size() * 2) ? length(orientation()) / 2 : default_button_size(); } int button_width() const { return orientation() == Orientation::Vertical ? width() : button_size(); } int button_height() const { return orientation() == Orientation::Horizontal ? height() : button_size(); } - Rect decrement_button_rect() const; - Rect increment_button_rect() const; - Rect decrement_gutter_rect() const; - Rect increment_gutter_rect() const; - Rect scrubber_rect() const; + Gfx::Rect decrement_button_rect() const; + Gfx::Rect increment_button_rect() const; + Gfx::Rect decrement_gutter_rect() const; + Gfx::Rect increment_gutter_rect() const; + Gfx::Rect scrubber_rect() const; int scrubber_size() const; int scrubbable_range_in_pixels() const; void on_automatic_scrolling_timer_fired(); diff --git a/Libraries/LibGUI/GScrollableWidget.cpp b/Libraries/LibGUI/GScrollableWidget.cpp index 1e4f04cb22..f0141bce78 100644 --- a/Libraries/LibGUI/GScrollableWidget.cpp +++ b/Libraries/LibGUI/GScrollableWidget.cpp @@ -81,7 +81,7 @@ void ScrollableWidget::custom_layout() m_corner_widget->set_visible(m_vertical_scrollbar->is_visible() && m_horizontal_scrollbar->is_visible()); if (m_corner_widget->is_visible()) { - Rect corner_rect { m_horizontal_scrollbar->relative_rect().right() + 1, m_vertical_scrollbar->relative_rect().bottom() + 1, width_occupied_by_vertical_scrollbar(), height_occupied_by_horizontal_scrollbar() }; + Gfx::Rect corner_rect { m_horizontal_scrollbar->relative_rect().right() + 1, m_vertical_scrollbar->relative_rect().bottom() + 1, width_occupied_by_vertical_scrollbar(), height_occupied_by_horizontal_scrollbar() }; m_corner_widget->set_relative_rect(corner_rect); } } @@ -144,7 +144,7 @@ int ScrollableWidget::width_occupied_by_vertical_scrollbar() const return m_vertical_scrollbar->is_visible() ? m_vertical_scrollbar->width() : 0; } -Rect ScrollableWidget::visible_content_rect() const +Gfx::Rect ScrollableWidget::visible_content_rect() const { return { m_horizontal_scrollbar->value(), @@ -201,7 +201,7 @@ void ScrollableWidget::scroll_to_bottom() scroll_into_view({ 0, content_height(), 1, 1 }, Orientation::Vertical); } -Rect ScrollableWidget::widget_inner_rect() const +Gfx::Rect ScrollableWidget::widget_inner_rect() const { auto rect = frame_inner_rect(); rect.set_width(rect.width() - width_occupied_by_vertical_scrollbar()); diff --git a/Libraries/LibGUI/GScrollableWidget.h b/Libraries/LibGUI/GScrollableWidget.h index 72759bc67f..b26c7deef6 100644 --- a/Libraries/LibGUI/GScrollableWidget.h +++ b/Libraries/LibGUI/GScrollableWidget.h @@ -41,9 +41,9 @@ public: int content_width() const { return m_content_size.width(); } int content_height() const { return m_content_size.height(); } - Rect visible_content_rect() const; + Gfx::Rect visible_content_rect() const; - Rect widget_inner_rect() const; + Gfx::Rect widget_inner_rect() const; void scroll_into_view(const Gfx::Rect&, Orientation); void scroll_into_view(const Gfx::Rect&, bool scroll_horizontally, bool scroll_vertically); diff --git a/Libraries/LibGUI/GSlider.cpp b/Libraries/LibGUI/GSlider.cpp index c4fd08344e..24a5736f93 100644 --- a/Libraries/LibGUI/GSlider.cpp +++ b/Libraries/LibGUI/GSlider.cpp @@ -73,7 +73,7 @@ void Slider::paint_event(PaintEvent& event) Painter painter(*this); painter.add_clip_rect(event.rect()); - Rect track_rect; + Gfx::Rect track_rect; if (orientation() == Orientation::Horizontal) { track_rect = { inner_rect().x(), 0, inner_rect().width(), track_size() }; @@ -87,10 +87,10 @@ void Slider::paint_event(PaintEvent& event) Gfx::StylePainter::paint_button(painter, knob_rect(), palette(), Gfx::ButtonStyle::Normal, false, m_knob_hovered); } -Rect Slider::knob_rect() const +Gfx::Rect Slider::knob_rect() const { auto inner_rect = this->inner_rect(); - Rect rect; + Gfx::Rect rect; rect.set_secondary_offset_for_orientation(orientation(), 0); rect.set_secondary_size_for_orientation(orientation(), knob_secondary_size()); diff --git a/Libraries/LibGUI/GSlider.h b/Libraries/LibGUI/GSlider.h index cde8305e55..bb3c52b9ae 100644 --- a/Libraries/LibGUI/GSlider.h +++ b/Libraries/LibGUI/GSlider.h @@ -60,9 +60,9 @@ public: int knob_secondary_size() const { return 20; } bool knob_dragging() const { return m_dragging; } - Rect knob_rect() const; + Gfx::Rect knob_rect() const; - Rect inner_rect() const + Gfx::Rect inner_rect() const { if (orientation() == Orientation::Horizontal) return rect().shrunken(20, 0); diff --git a/Libraries/LibGUI/GTabWidget.cpp b/Libraries/LibGUI/GTabWidget.cpp index f052e278a8..be19e88eba 100644 --- a/Libraries/LibGUI/GTabWidget.cpp +++ b/Libraries/LibGUI/GTabWidget.cpp @@ -70,9 +70,9 @@ void TabWidget::resize_event(ResizeEvent& event) m_active_widget->set_relative_rect(child_rect_for_size(event.size())); } -Rect TabWidget::child_rect_for_size(const Gfx::Size& size) const +Gfx::Rect TabWidget::child_rect_for_size(const Gfx::Size& size) const { - Rect rect; + Gfx::Rect rect; switch (m_tab_position) { case TabPosition::Top: rect = { { container_padding(), bar_height() + container_padding() }, { size.width() - container_padding() * 2, size.height() - bar_height() - container_padding() * 2 } }; @@ -109,7 +109,7 @@ void TabWidget::child_event(Core::ChildEvent& event) Widget::child_event(event); } -Rect TabWidget::bar_rect() const +Gfx::Rect TabWidget::bar_rect() const { switch (m_tab_position) { case TabPosition::Top: @@ -120,7 +120,7 @@ Rect TabWidget::bar_rect() const ASSERT_NOT_REACHED(); } -Rect TabWidget::container_rect() const +Gfx::Rect TabWidget::container_rect() const { switch (m_tab_position) { case TabPosition::Top: @@ -166,12 +166,12 @@ void TabWidget::paint_event(PaintEvent& event) } } -Rect TabWidget::button_rect(int index) const +Gfx::Rect TabWidget::button_rect(int index) const { int x_offset = 2; for (int i = 0; i < index; ++i) x_offset += m_tabs[i].width(font()); - Rect rect { x_offset, 0, m_tabs[index].width(font()), bar_height() }; + Gfx::Rect rect { x_offset, 0, m_tabs[index].width(font()), bar_height() }; if (m_tabs[index].widget != m_active_widget) { rect.move_by(0, 2); rect.set_height(rect.height() - 2); diff --git a/Libraries/LibGUI/GTabWidget.h b/Libraries/LibGUI/GTabWidget.h index 9f6c5fa928..b771a5feb0 100644 --- a/Libraries/LibGUI/GTabWidget.h +++ b/Libraries/LibGUI/GTabWidget.h @@ -64,16 +64,16 @@ protected: virtual void leave_event(Core::Event&) override; private: - Rect child_rect_for_size(const Gfx::Size&) const; - Rect button_rect(int index) const; - Rect bar_rect() const; - Rect container_rect() const; + Gfx::Rect child_rect_for_size(const Gfx::Size&) const; + Gfx::Rect button_rect(int index) const; + Gfx::Rect bar_rect() const; + Gfx::Rect container_rect() const; void update_bar(); RefPtr<Widget> m_active_widget; struct TabData { - Rect rect(const Gfx::Font&) const; + Gfx::Rect rect(const Gfx::Font&) const; int width(const Gfx::Font&) const; String title; Widget* widget { nullptr }; diff --git a/Libraries/LibGUI/GTableView.cpp b/Libraries/LibGUI/GTableView.cpp index f476220d30..cc45d85c6c 100644 --- a/Libraries/LibGUI/GTableView.cpp +++ b/Libraries/LibGUI/GTableView.cpp @@ -106,7 +106,7 @@ void TableView::paint_event(PaintEvent& event) int column_width = this->column_width(column_index); const Gfx::Font& font = column_metadata.font ? *column_metadata.font : this->font(); bool is_key_column = model()->key_column() == column_index; - Rect cell_rect(horizontal_padding() + x_offset, y, column_width, item_height()); + Gfx::Rect cell_rect(horizontal_padding() + x_offset, y, column_width, item_height()); if (is_key_column) { auto cell_rect_for_fill = cell_rect.inflated(horizontal_padding() * 2, 0); painter.fill_rect(cell_rect_for_fill, key_column_background_color); @@ -136,7 +136,7 @@ void TableView::paint_event(PaintEvent& event) ++painted_item_index; }; - Rect unpainted_rect(0, header_height() + painted_item_index * item_height(), exposed_width, height()); + Gfx::Rect unpainted_rect(0, header_height() + painted_item_index * item_height(), exposed_width, height()); painter.fill_rect(unpainted_rect, widget_background_color); // Untranslate the painter vertically and do the column headers. diff --git a/Libraries/LibGUI/GTextEditor.cpp b/Libraries/LibGUI/GTextEditor.cpp index 6940404f6e..9260a33678 100644 --- a/Libraries/LibGUI/GTextEditor.cpp +++ b/Libraries/LibGUI/GTextEditor.cpp @@ -310,7 +310,7 @@ int TextEditor::ruler_width() const return 5 * font().glyph_width('x') + 4; } -Rect TextEditor::ruler_content_rect(size_t line_index) const +Gfx::Rect TextEditor::ruler_content_rect(size_t line_index) const { if (!m_ruler_visible) return {}; @@ -322,12 +322,12 @@ Rect TextEditor::ruler_content_rect(size_t line_index) const }; } -Rect TextEditor::ruler_rect_in_inner_coordinates() const +Gfx::Rect TextEditor::ruler_rect_in_inner_coordinates() const { return { 0, 0, ruler_width(), height() - height_occupied_by_horizontal_scrollbar() }; } -Rect TextEditor::visible_text_rect_in_inner_coordinates() const +Gfx::Rect TextEditor::visible_text_rect_in_inner_coordinates() const { return { m_horizontal_content_padding + (m_ruler_visible ? (ruler_rect_in_inner_coordinates().right() + 1) : 0), @@ -382,7 +382,7 @@ void TextEditor::paint_event(PaintEvent& event) } } - Rect text_clip_rect { + Gfx::Rect text_clip_rect { (m_ruler_visible ? (ruler_rect_in_inner_coordinates().right() + frame_thickness() + 1) : frame_thickness()), frame_thickness(), width() - width_occupied_by_vertical_scrollbar() - ruler_width(), @@ -423,7 +423,7 @@ void TextEditor::paint_event(PaintEvent& event) painter.draw_text(visual_line_rect, visual_line_text, m_text_alignment, palette().color(foreground_role())); } else { int advance = font().glyph_width(' ') + font().glyph_spacing(); - Rect character_rect = { visual_line_rect.location(), { font().glyph_width(' '), line_height() } }; + Gfx::Rect character_rect = { visual_line_rect.location(), { font().glyph_width(' '), line_height() } }; for (size_t i = 0; i < visual_line_text.length(); ++i) { const Gfx::Font* font = &this->font(); Color color; @@ -462,7 +462,7 @@ void TextEditor::paint_event(PaintEvent& event) ? content_x_for_position({ line_index, (size_t)selection_end_column_within_line }) : visual_line_rect.right() + 1; - Rect selection_rect { + Gfx::Rect selection_rect { selection_left, visual_line_rect.y(), selection_right - selection_left, @@ -912,7 +912,7 @@ int TextEditor::content_x_for_position(const TextPosition& position) const } } -Rect TextEditor::content_rect_for_position(const TextPosition& position) const +Gfx::Rect TextEditor::content_rect_for_position(const TextPosition& position) const { if (!position.is_valid()) return {}; @@ -922,12 +922,12 @@ Rect TextEditor::content_rect_for_position(const TextPosition& position) const int x = content_x_for_position(position); if (is_single_line()) { - Rect rect { x, 0, 1, font().glyph_height() + 2 }; + Gfx::Rect rect { x, 0, 1, font().glyph_height() + 2 }; rect.center_vertically_within({ {}, frame_inner_rect().size() }); return rect; } - Rect rect; + Gfx::Rect rect; for_each_visual_line(position.line(), [&](const Gfx::Rect& visual_line_rect, const StringView& view, size_t start_of_visual_line) { if (position.column() >= start_of_visual_line && ((position.column() - start_of_visual_line) <= view.length())) { // NOTE: We have to subtract the horizontal padding here since it's part of the visual line rect @@ -945,12 +945,12 @@ Rect TextEditor::content_rect_for_position(const TextPosition& position) const return rect; } -Rect TextEditor::cursor_content_rect() const +Gfx::Rect TextEditor::cursor_content_rect() const { return content_rect_for_position(m_cursor); } -Rect TextEditor::line_widget_rect(size_t line_index) const +Gfx::Rect TextEditor::line_widget_rect(size_t line_index) const { auto rect = line_content_rect(line_index); rect.set_x(frame_thickness()); @@ -976,11 +976,11 @@ void TextEditor::scroll_cursor_into_view() scroll_position_into_view(m_cursor); } -Rect TextEditor::line_content_rect(size_t line_index) const +Gfx::Rect TextEditor::line_content_rect(size_t line_index) const { auto& line = this->line(line_index); if (is_single_line()) { - Rect line_rect = { content_x_for_position({ line_index, 0 }), 0, (int)line.length() * glyph_width(), font().glyph_height() + 2 }; + Gfx::Rect line_rect = { content_x_for_position({ line_index, 0 }), 0, (int)line.length() * glyph_width(), font().glyph_height() + 2 }; line_rect.center_vertically_within({ {}, frame_inner_rect().size() }); return line_rect; } @@ -1362,7 +1362,7 @@ void TextEditor::for_each_visual_line(size_t line_index, Callback callback) cons for (auto visual_line_break : visual_data.visual_line_breaks) { auto visual_line_view = StringView(line.characters() + start_of_line, visual_line_break - start_of_line); - Rect visual_line_rect { + Gfx::Rect visual_line_rect { visual_data.visual_rect.x(), visual_data.visual_rect.y() + ((int)visual_line_index * line_height()), font().width(visual_line_view), diff --git a/Libraries/LibGUI/GTextEditor.h b/Libraries/LibGUI/GTextEditor.h index eb1099f030..b6424ffa27 100644 --- a/Libraries/LibGUI/GTextEditor.h +++ b/Libraries/LibGUI/GTextEditor.h @@ -173,10 +173,10 @@ private: void update_content_size(); void did_change(); - Rect line_content_rect(size_t item_index) const; - Rect line_widget_rect(size_t line_index) const; - Rect cursor_content_rect() const; - Rect content_rect_for_position(const TextPosition&) const; + Gfx::Rect line_content_rect(size_t item_index) const; + Gfx::Rect line_widget_rect(size_t line_index) const; + Gfx::Rect cursor_content_rect() const; + Gfx::Rect content_rect_for_position(const TextPosition&) const; void update_cursor(); const NonnullOwnPtrVector<TextDocumentLine>& lines() const { return document().lines(); } NonnullOwnPtrVector<TextDocumentLine>& lines() { return document().lines(); } @@ -185,13 +185,13 @@ private: TextDocumentLine& current_line() { return line(m_cursor.line()); } const TextDocumentLine& current_line() const { return line(m_cursor.line()); } int ruler_width() const; - Rect ruler_content_rect(size_t line) const; + Gfx::Rect ruler_content_rect(size_t line) const; void toggle_selection_if_needed_for_event(const KeyEvent&); void delete_selection(); void did_update_selection(); int content_x_for_position(const TextPosition&) const; - Rect ruler_rect_in_inner_coordinates() const; - Rect visible_text_rect_in_inner_coordinates() const; + Gfx::Rect ruler_rect_in_inner_coordinates() const; + Gfx::Rect visible_text_rect_in_inner_coordinates() const; void recompute_all_visual_lines(); void ensure_cursor_is_valid(); void flush_pending_change_notification_if_needed(); @@ -244,7 +244,7 @@ private: struct LineVisualData { Vector<size_t, 1> visual_line_breaks; - Rect visual_rect; + Gfx::Rect visual_rect; }; NonnullOwnPtrVector<LineVisualData> m_line_visual_data; diff --git a/Libraries/LibGUI/GTreeView.cpp b/Libraries/LibGUI/GTreeView.cpp index cd3f8bf58c..88caa31c2d 100644 --- a/Libraries/LibGUI/GTreeView.cpp +++ b/Libraries/LibGUI/GTreeView.cpp @@ -138,11 +138,11 @@ void TreeView::traverse_in_paint_order(Callback callback) const auto& metadata = ensure_metadata_for_index(index); int x_offset = tree_column_x_offset + horizontal_padding() + indent_level * indent_width_in_pixels(); auto node_text = model.data(index, Model::Role::Display).to_string(); - Rect rect = { + Gfx::Rect rect = { x_offset, y_offset, icon_size() + icon_spacing() + text_padding() + font().width(node_text) + text_padding(), item_height() }; - Rect toggle_rect; + Gfx::Rect toggle_rect; if (row_count_at_index > 0) { int toggle_x = tree_column_x_offset + horizontal_padding() + indent_width_in_pixels() * indent_level - icon_size() / 2 - 4; toggle_rect = { toggle_x, rect.y(), toggle_size(), toggle_size() }; @@ -230,7 +230,7 @@ void TreeView::paint_event(PaintEvent& event) } } - Rect row_rect { 0, rect.y(), frame_inner_rect().width(), rect.height() }; + Gfx::Rect row_rect { 0, rect.y(), frame_inner_rect().width(), rect.height() }; painter.fill_rect(row_rect, background_color); int x_offset = 0; @@ -244,7 +244,7 @@ void TreeView::paint_event(PaintEvent& event) painter.draw_rect(toggle_rect, text_color); if (column_index != tree_column) { - Rect cell_rect(horizontal_padding() + x_offset, rect.y(), column_width, item_height()); + Gfx::Rect cell_rect(horizontal_padding() + x_offset, rect.y(), column_width, item_height()); auto cell_index = model.sibling(index.row(), column_index, index.parent()); if (auto* delegate = column_data(column_index).cell_painting_delegate.ptr()) { @@ -265,13 +265,13 @@ void TreeView::paint_event(PaintEvent& event) } } else { // It's the tree column! - Rect icon_rect = { rect.x(), rect.y(), icon_size(), icon_size() }; + Gfx::Rect icon_rect = { rect.x(), rect.y(), icon_size(), icon_size() }; auto icon = model.data(index, Model::Role::Icon); if (icon.is_icon()) { if (auto* bitmap = icon.as_icon().bitmap_for_size(icon_size())) painter.blit(icon_rect.location(), *bitmap, bitmap->rect()); } - Rect text_rect = { + Gfx::Rect text_rect = { icon_rect.right() + 1 + icon_spacing(), rect.y(), rect.width() - icon_size() - icon_spacing(), rect.height() }; @@ -319,7 +319,7 @@ void TreeView::scroll_into_view(const ModelIndex& a_index, Orientation orientati { if (!a_index.is_valid()) return; - Rect found_rect; + Gfx::Rect found_rect; traverse_in_paint_order([&](const ModelIndex& index, const Gfx::Rect& rect, const Gfx::Rect&, int) { if (index == a_index) { found_rect = rect; diff --git a/Libraries/LibGUI/GVariant.h b/Libraries/LibGUI/GVariant.h index 6ef98da39a..a0088bbe35 100644 --- a/Libraries/LibGUI/GVariant.h +++ b/Libraries/LibGUI/GVariant.h @@ -194,7 +194,7 @@ public: return { m_value.as_size.width, m_value.as_size.height }; } - Rect as_rect() const + Gfx::Rect as_rect() const { return { as_point(), as_size() }; } diff --git a/Libraries/LibGUI/GWidget.cpp b/Libraries/LibGUI/GWidget.cpp index 2b0a8edbb4..dc5406bdd4 100644 --- a/Libraries/LibGUI/GWidget.cpp +++ b/Libraries/LibGUI/GWidget.cpp @@ -128,7 +128,7 @@ void Widget::child_event(Core::ChildEvent& event) void Widget::set_relative_rect(const Gfx::Rect& a_rect) { // Get rid of negative width/height values. - Rect rect = { + Gfx::Rect rect = { a_rect.x(), a_rect.y(), max(a_rect.width(), 0), @@ -411,7 +411,7 @@ void Widget::update(const Gfx::Rect& rect) window->update(rect.translated(window_relative_rect().location())); } -Rect Widget::window_relative_rect() const +Gfx::Rect Widget::window_relative_rect() const { auto rect = relative_rect(); for (auto* parent = parent_widget(); parent; parent = parent->parent_widget()) { @@ -420,7 +420,7 @@ Rect Widget::window_relative_rect() const return rect; } -Rect Widget::screen_relative_rect() const +Gfx::Rect Widget::screen_relative_rect() const { return window_relative_rect().translated(window()->position()); } diff --git a/Libraries/LibGUI/GWidget.h b/Libraries/LibGUI/GWidget.h index 512775ddc1..5d1eb1704a 100644 --- a/Libraries/LibGUI/GWidget.h +++ b/Libraries/LibGUI/GWidget.h @@ -143,11 +143,11 @@ public: // This is called after children have been painted. virtual void second_paint_event(PaintEvent&); - Rect relative_rect() const { return m_relative_rect; } + Gfx::Rect relative_rect() const { return m_relative_rect; } Point relative_position() const { return m_relative_rect.location(); } - Rect window_relative_rect() const; - Rect screen_relative_rect() const; + Gfx::Rect window_relative_rect() const; + Gfx::Rect screen_relative_rect() const; int x() const { return m_relative_rect.x(); } int y() const { return m_relative_rect.y(); } @@ -155,7 +155,7 @@ public: int height() const { return m_relative_rect.height(); } int length(Orientation orientation) const { return orientation == Orientation::Vertical ? height() : width(); } - Rect rect() const { return { 0, 0, width(), height() }; } + Gfx::Rect rect() const { return { 0, 0, width(), height() }; } Size size() const { return m_relative_rect.size(); } void update(); diff --git a/Libraries/LibGUI/GWindow.cpp b/Libraries/LibGUI/GWindow.cpp index 1fb7e7e84f..b25c69a197 100644 --- a/Libraries/LibGUI/GWindow.cpp +++ b/Libraries/LibGUI/GWindow.cpp @@ -145,7 +145,7 @@ String Window::title() const return WindowServerConnection::the().send_sync<WindowServer::GetWindowTitle>(m_window_id)->title(); } -Rect Window::rect() const +Gfx::Rect Window::rect() const { if (!m_window_id) return m_rect_when_windowless; @@ -264,7 +264,7 @@ void Window::event(Core::Event& event) set_current_backing_bitmap(*m_back_bitmap, true); if (m_window_id) { - Vector<Rect> rects_to_send; + Vector<Gfx::Rect> rects_to_send; for (auto& r : rects) rects_to_send.append(r); WindowServerConnection::the().post_message(WindowServer::DidFinishPainting(m_window_id, rects_to_send)); @@ -351,7 +351,7 @@ void Window::update(const Gfx::Rect& a_rect) auto rects = move(m_pending_paint_event_rects); if (rects.is_empty()) return; - Vector<Rect> rects_to_send; + Vector<Gfx::Rect> rects_to_send; for (auto& r : rects) rects_to_send.append(r); WindowServerConnection::the().post_message(WindowServer::InvalidateRect(m_window_id, rects_to_send)); @@ -461,7 +461,7 @@ void Window::set_current_backing_bitmap(Gfx::Bitmap& bitmap, bool flush_immediat WindowServerConnection::the().send_sync<WindowServer::SetWindowBackingStore>(m_window_id, 32, bitmap.pitch(), bitmap.shared_buffer_id(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately); } -void Window::flip(const Vector<Rect, 32>& dirty_rects) +void Window::flip(const Vector<Gfx::Rect, 32>& dirty_rects) { swap(m_front_bitmap, m_back_bitmap); diff --git a/Libraries/LibGUI/GWindow.h b/Libraries/LibGUI/GWindow.h index 7cf6eaa913..6eec7ac637 100644 --- a/Libraries/LibGUI/GWindow.h +++ b/Libraries/LibGUI/GWindow.h @@ -101,7 +101,7 @@ public: int width() const { return rect().width(); } int height() const { return rect().height(); } - Rect rect() const; + Gfx::Rect rect() const; Size size() const { return rect().size(); } void set_rect(const Gfx::Rect&); void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); } @@ -186,7 +186,7 @@ private: NonnullRefPtr<Gfx::Bitmap> create_backing_bitmap(const Gfx::Size&); NonnullRefPtr<Gfx::Bitmap> create_shared_bitmap(Gfx::Bitmap::Format, const Gfx::Size&); void set_current_backing_bitmap(Gfx::Bitmap&, bool flush_immediately = false); - void flip(const Vector<Rect, 32>& dirty_rects); + void flip(const Vector<Gfx::Rect, 32>& dirty_rects); RefPtr<Gfx::Bitmap> m_front_bitmap; RefPtr<Gfx::Bitmap> m_back_bitmap; @@ -200,7 +200,7 @@ private: WeakPtr<Widget> m_hovered_widget; Gfx::Rect m_rect_when_windowless; String m_title_when_windowless; - Vector<Rect, 32> m_pending_paint_event_rects; + Vector<Gfx::Rect, 32> m_pending_paint_event_rects; Gfx::Size m_size_increment; Gfx::Size m_base_size; Color m_background_color { Color::WarmGray }; diff --git a/Libraries/LibGfx/Rect.cpp b/Libraries/LibGfx/Rect.cpp index 45b47a1549..bff5d90ae3 100644 --- a/Libraries/LibGfx/Rect.cpp +++ b/Libraries/LibGfx/Rect.cpp @@ -27,6 +27,8 @@ #include "Rect.h" #include <AK/StdLibExtras.h> +namespace Gfx { + void Rect::intersect(const Rect& other) { int l = max(left(), other.left()); @@ -126,3 +128,5 @@ void Rect::align_within(const Rect& other, TextAlignment alignment) return; } } + +} diff --git a/Libraries/LibGfx/Rect.h b/Libraries/LibGfx/Rect.h index 29fbba03fa..2fa67c3c31 100644 --- a/Libraries/LibGfx/Rect.h +++ b/Libraries/LibGfx/Rect.h @@ -333,5 +333,3 @@ inline const LogStream& operator<<(const LogStream& stream, const Rect& value) } } - -using Gfx::Rect; diff --git a/Libraries/LibHTML/Frame.h b/Libraries/LibHTML/Frame.h index 0d98ae4ba5..830653b45e 100644 --- a/Libraries/LibHTML/Frame.h +++ b/Libraries/LibHTML/Frame.h @@ -57,7 +57,7 @@ public: Function<void(const Gfx::Rect&)> on_set_needs_display; void set_viewport_rect(const Gfx::Rect&); - Rect viewport_rect() const { return m_viewport_rect; } + Gfx::Rect viewport_rect() const { return m_viewport_rect; } private: explicit Frame(HtmlView&); diff --git a/Libraries/LibHTML/HtmlView.cpp b/Libraries/LibHTML/HtmlView.cpp index e8deca8265..cfdfa066b5 100644 --- a/Libraries/LibHTML/HtmlView.cpp +++ b/Libraries/LibHTML/HtmlView.cpp @@ -55,7 +55,7 @@ HtmlView::HtmlView(GUI::Widget* parent) update(); return; } - Rect adjusted_rect = content_rect; + Gfx::Rect adjusted_rect = content_rect; adjusted_rect.set_location(to_widget_position(content_rect.location())); update(adjusted_rect); }; diff --git a/Libraries/LibHTML/Layout/LayoutListItemMarker.cpp b/Libraries/LibHTML/Layout/LayoutListItemMarker.cpp index aad050c186..03d793f1f0 100644 --- a/Libraries/LibHTML/Layout/LayoutListItemMarker.cpp +++ b/Libraries/LibHTML/Layout/LayoutListItemMarker.cpp @@ -38,7 +38,7 @@ LayoutListItemMarker::~LayoutListItemMarker() void LayoutListItemMarker::render(RenderingContext& context) { - Rect bullet_rect { 0, 0, 4, 4 }; + Gfx::Rect bullet_rect { 0, 0, 4, 4 }; bullet_rect.center_within(enclosing_int_rect(rect())); // FIXME: It would be nicer to not have to go via the parent here to get our inherited style. auto color = parent()->style().color_or_fallback(CSS::PropertyID::Color, document(), context.palette().base_text()); diff --git a/Libraries/LibHTML/RenderingContext.h b/Libraries/LibHTML/RenderingContext.h index 66814a7981..028555fd2a 100644 --- a/Libraries/LibHTML/RenderingContext.h +++ b/Libraries/LibHTML/RenderingContext.h @@ -47,7 +47,7 @@ public: bool should_show_line_box_borders() const { return m_should_show_line_box_borders; } void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; } - Rect viewport_rect() const { return m_viewport_rect; } + Gfx::Rect viewport_rect() const { return m_viewport_rect; } void set_viewport_rect(const Gfx::Rect& rect) { m_viewport_rect = rect; } private: diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp index 10ce8b7063..c2fc9afab7 100644 --- a/Libraries/LibVT/TerminalWidget.cpp +++ b/Libraries/LibVT/TerminalWidget.cpp @@ -137,17 +137,17 @@ static inline Color lookup_color(unsigned color) return Color::from_rgb(xterm_colors[color]); } -Rect TerminalWidget::glyph_rect(u16 row, u16 column) +Gfx::Rect TerminalWidget::glyph_rect(u16 row, u16 column) { int y = row * m_line_height; int x = column * font().glyph_width('x'); return { x + frame_thickness() + m_inset, y + frame_thickness() + m_inset, font().glyph_width('x'), font().glyph_height() }; } -Rect TerminalWidget::row_rect(u16 row) +Gfx::Rect TerminalWidget::row_rect(u16 row) { int y = row * m_line_height; - Rect rect = { frame_thickness() + m_inset, y + frame_thickness() + m_inset, font().glyph_width('x') * m_terminal.columns(), font().glyph_height() }; + Gfx::Rect rect = { frame_thickness() + m_inset, y + frame_thickness() + m_inset, font().glyph_width('x') * m_terminal.columns(), font().glyph_height() }; rect.inflate(0, m_line_spacing); return rect; } @@ -282,7 +282,7 @@ void TerminalWidget::paint_event(GUI::PaintEvent& event) painter.add_clip_rect(event.rect()); - Rect terminal_buffer_rect(frame_inner_rect().top_left(), { frame_inner_rect().width() - m_scrollbar->width(), frame_inner_rect().height() }); + Gfx::Rect terminal_buffer_rect(frame_inner_rect().top_left(), { frame_inner_rect().width() - m_scrollbar->width(), frame_inner_rect().height() }); painter.add_clip_rect(terminal_buffer_rect); if (m_visual_beep_timer->is_active()) @@ -399,7 +399,7 @@ void TerminalWidget::flush_dirty_lines() m_terminal.m_need_full_flush = false; return; } - Rect rect; + Gfx::Rect rect; for (int i = 0; i < m_terminal.rows(); ++i) { if (m_terminal.line(i).dirty) { rect = rect.united(row_rect(i)); @@ -430,7 +430,7 @@ void TerminalWidget::relayout(const Gfx::Size& size) int new_rows = (size.height() - base_size.height()) / m_line_height; m_terminal.set_size(new_columns, new_rows); - Rect scrollbar_rect = { + Gfx::Rect scrollbar_rect = { size.width() - m_scrollbar->width() - frame_thickness(), frame_thickness(), m_scrollbar->width(), diff --git a/Libraries/LibVT/TerminalWidget.h b/Libraries/LibVT/TerminalWidget.h index 30cd591fb7..e83b0da679 100644 --- a/Libraries/LibVT/TerminalWidget.h +++ b/Libraries/LibVT/TerminalWidget.h @@ -114,8 +114,8 @@ private: void set_logical_focus(bool); - Rect glyph_rect(u16 row, u16 column); - Rect row_rect(u16 row); + Gfx::Rect glyph_rect(u16 row, u16 column); + Gfx::Rect row_rect(u16 row); void update_cursor(); void invalidate_cursor(); diff --git a/Servers/WindowServer/WSCompositor.cpp b/Servers/WindowServer/WSCompositor.cpp index ef8afeaf63..0b8c45a511 100644 --- a/Servers/WindowServer/WSCompositor.cpp +++ b/Servers/WindowServer/WSCompositor.cpp @@ -187,7 +187,7 @@ void WSCompositor::compose() // we want to try to blit the backing store at the same place // it was previously, and fill the rest of the window with its // background color. - Rect backing_rect; + Gfx::Rect backing_rect; backing_rect.set_size(backing_store->size()); switch (WSWindowManager::the().resize_direction_of_window(window)) { case ResizeDirection::None: @@ -212,7 +212,7 @@ void WSCompositor::compose() break; } - Rect dirty_rect_in_backing_coordinates = dirty_rect + Gfx::Rect dirty_rect_in_backing_coordinates = dirty_rect .intersected(window.rect()) .intersected(backing_rect) .translated(-backing_rect.location()); @@ -257,7 +257,7 @@ void WSCompositor::compose() void WSCompositor::flush(const Gfx::Rect& a_rect) { - auto rect = Rect::intersection(a_rect, WSScreen::the().rect()); + auto rect = Gfx::Rect::intersection(a_rect, WSScreen::the().rect()); #ifdef DEBUG_COUNTERS dbgprintf("[WM] flush #%u (%d,%d %dx%d)\n", ++m_flush_count, rect.x(), rect.y(), rect.width(), rect.height()); @@ -302,7 +302,7 @@ void WSCompositor::invalidate() void WSCompositor::invalidate(const Gfx::Rect& a_rect) { - auto rect = Rect::intersection(a_rect, WSScreen::the().rect()); + auto rect = Gfx::Rect::intersection(a_rect, WSScreen::the().rect()); if (rect.is_empty()) return; @@ -369,7 +369,7 @@ void WSCompositor::run_animations() float width_delta_per_step = (float)(from_rect.width() - to_rect.width()) / minimize_animation_steps; float height_delta_per_step = (float)(from_rect.height() - to_rect.height()) / minimize_animation_steps; - Rect rect { + Gfx::Rect rect { from_rect.x() - (int)(x_delta_per_step * animation_index), from_rect.y() - (int)(y_delta_per_step * animation_index), from_rect.width() - (int)(width_delta_per_step * animation_index), @@ -405,7 +405,7 @@ void WSCompositor::set_resolution(int desired_width, int desired_height) compose(); } -Rect WSCompositor::current_cursor_rect() const +Gfx::Rect WSCompositor::current_cursor_rect() const { auto& wm = WSWindowManager::the(); return { WSScreen::the().cursor_location().translated(-wm.active_cursor().hotspot()), wm.active_cursor().size() }; @@ -433,7 +433,7 @@ void WSCompositor::draw_geometry_label() int height_steps = (window_being_moved_or_resized->height() - window_being_moved_or_resized->base_size().height()) / window_being_moved_or_resized->size_increment().height(); geometry_string = String::format("%s (%dx%d)", geometry_string.characters(), width_steps, height_steps); } - auto geometry_label_rect = Rect { 0, 0, wm.font().width(geometry_string) + 16, wm.font().glyph_height() + 10 }; + auto geometry_label_rect = Gfx::Rect { 0, 0, wm.font().width(geometry_string) + 16, wm.font().glyph_height() + 10 }; geometry_label_rect.center_within(window_being_moved_or_resized->rect()); m_back_painter->fill_rect(geometry_label_rect, Color::WarmGray); m_back_painter->draw_rect(geometry_label_rect, Color::DarkGray); @@ -444,7 +444,7 @@ void WSCompositor::draw_geometry_label() void WSCompositor::draw_cursor() { auto& wm = WSWindowManager::the(); - Rect cursor_rect = current_cursor_rect(); + Gfx::Rect cursor_rect = current_cursor_rect(); m_back_painter->blit(cursor_rect.location(), wm.active_cursor().bitmap(), wm.active_cursor().rect()); if (wm.dnd_client()) { diff --git a/Servers/WindowServer/WSCursor.h b/Servers/WindowServer/WSCursor.h index b1d8456111..bdba0e3a60 100644 --- a/Servers/WindowServer/WSCursor.h +++ b/Servers/WindowServer/WSCursor.h @@ -50,7 +50,7 @@ public: Point hotspot() const { return m_hotspot; } const Gfx::Bitmap& bitmap() const { return *m_bitmap; } - Rect rect() const { return m_bitmap->rect(); } + Gfx::Rect rect() const { return m_bitmap->rect(); } Size size() const { return m_bitmap->size(); } private: diff --git a/Servers/WindowServer/WSEvent.h b/Servers/WindowServer/WSEvent.h index f909dc5cc9..48b9afc257 100644 --- a/Servers/WindowServer/WSEvent.h +++ b/Servers/WindowServer/WSEvent.h @@ -135,8 +135,8 @@ public: { } - Rect old_rect() const { return m_old_rect; } - Rect rect() const { return m_rect; } + Gfx::Rect old_rect() const { return m_old_rect; } + Gfx::Rect rect() const { return m_rect; } private: Gfx::Rect m_old_rect; diff --git a/Servers/WindowServer/WSMenuItem.cpp b/Servers/WindowServer/WSMenuItem.cpp index 27bd38af52..d3a495398b 100644 --- a/Servers/WindowServer/WSMenuItem.cpp +++ b/Servers/WindowServer/WSMenuItem.cpp @@ -77,7 +77,7 @@ WSMenu* WSMenuItem::submenu() return WSMenuManager::the().find_internal_menu_by_id(m_submenu_id); } -Rect WSMenuItem::rect() const +Gfx::Rect WSMenuItem::rect() const { if (!m_menu.is_scrollable()) return m_rect; diff --git a/Servers/WindowServer/WSMenuManager.cpp b/Servers/WindowServer/WSMenuManager.cpp index 0250fb06c4..98aa96e746 100644 --- a/Servers/WindowServer/WSMenuManager.cpp +++ b/Servers/WindowServer/WSMenuManager.cpp @@ -214,8 +214,8 @@ void WSMenuManager::draw() if (!existing_applet) continue; - Rect new_applet_rect(right_edge_x - existing_applet->size().width(), 0, existing_applet->size().width(), existing_applet->size().height()); - Rect dummy_menubar_rect(0, 0, 0, 18); + Gfx::Rect new_applet_rect(right_edge_x - existing_applet->size().width(), 0, existing_applet->size().width(), existing_applet->size().height()); + Gfx::Rect dummy_menubar_rect(0, 0, 0, 18); new_applet_rect.center_vertically_within(dummy_menubar_rect); existing_applet->set_rect_in_menubar(new_applet_rect); @@ -463,8 +463,8 @@ void WSMenuManager::add_applet(WSWindow& applet) right_edge_x = existing_applet->rect_in_menubar().x() - 4; } - Rect new_applet_rect(right_edge_x - applet.size().width(), 0, applet.size().width(), applet.size().height()); - Rect dummy_menubar_rect(0, 0, 0, 18); + Gfx::Rect new_applet_rect(right_edge_x - applet.size().width(), 0, applet.size().width(), applet.size().height()); + Gfx::Rect dummy_menubar_rect(0, 0, 0, 18); new_applet_rect.center_vertically_within(dummy_menubar_rect); applet.set_rect_in_menubar(new_applet_rect); @@ -493,7 +493,7 @@ void WSMenuManager::invalidate_applet(const WSWindow& applet, const Gfx::Rect& r window().invalidate(rect.translated(applet.rect_in_menubar().location())); } -Rect WSMenuManager::menubar_rect() const +Gfx::Rect WSMenuManager::menubar_rect() const { return { 0, 0, WSScreen::the().rect().width(), 18 }; } diff --git a/Servers/WindowServer/WSMenuManager.h b/Servers/WindowServer/WSMenuManager.h index 764c1bf7bc..df0074d9b0 100644 --- a/Servers/WindowServer/WSMenuManager.h +++ b/Servers/WindowServer/WSMenuManager.h @@ -50,7 +50,7 @@ public: Vector<WeakPtr<WSMenu>>& open_menu_stack() { return m_open_menu_stack; } - Rect menubar_rect() const; + Gfx::Rect menubar_rect() const; static int menubar_menu_margin() { return 16; } void set_needs_window_resize(); diff --git a/Servers/WindowServer/WSScreen.h b/Servers/WindowServer/WSScreen.h index 34b6234380..918bb9b3c6 100644 --- a/Servers/WindowServer/WSScreen.h +++ b/Servers/WindowServer/WSScreen.h @@ -50,7 +50,7 @@ public: static WSScreen& the(); Size size() const { return { width(), height() }; } - Rect rect() const { return { 0, 0, width(), height() }; } + Gfx::Rect rect() const { return { 0, 0, width(), height() }; } Point cursor_location() const { return m_cursor_location; } unsigned mouse_button_state() const { return m_mouse_button_state; } diff --git a/Servers/WindowServer/WSWindow.cpp b/Servers/WindowServer/WSWindow.cpp index ef149f0fbb..efa0bae41d 100644 --- a/Servers/WindowServer/WSWindow.cpp +++ b/Servers/WindowServer/WSWindow.cpp @@ -94,7 +94,7 @@ void WSWindow::set_title(const String& title) void WSWindow::set_rect(const Gfx::Rect& rect) { - Rect old_rect; + Gfx::Rect old_rect; if (m_rect == rect) return; old_rect = m_rect; @@ -371,7 +371,7 @@ void WSWindow::set_fullscreen(bool fullscreen) if (m_fullscreen == fullscreen) return; m_fullscreen = fullscreen; - Rect new_window_rect = m_rect; + Gfx::Rect new_window_rect = m_rect; if (m_fullscreen) { m_saved_nonfullscreen_rect = m_rect; new_window_rect = WSScreen::the().rect(); diff --git a/Servers/WindowServer/WSWindowFrame.cpp b/Servers/WindowServer/WSWindowFrame.cpp index 998f4d863f..d82f0d83ba 100644 --- a/Servers/WindowServer/WSWindowFrame.cpp +++ b/Servers/WindowServer/WSWindowFrame.cpp @@ -147,12 +147,12 @@ void WSWindowFrame::did_set_maximized(Badge<WSWindow>, bool maximized) m_maximize_button->set_bitmap(maximized ? *s_unmaximize_button_bitmap : *s_maximize_button_bitmap); } -Rect WSWindowFrame::title_bar_rect() const +Gfx::Rect WSWindowFrame::title_bar_rect() const { return { 3, 3, m_window.width(), window_titlebar_height }; } -Rect WSWindowFrame::title_bar_icon_rect() const +Gfx::Rect WSWindowFrame::title_bar_icon_rect() const { auto titlebar_rect = title_bar_rect(); return { @@ -163,7 +163,7 @@ Rect WSWindowFrame::title_bar_icon_rect() const }; } -Rect WSWindowFrame::title_bar_text_rect() const +Gfx::Rect WSWindowFrame::title_bar_text_rect() const { auto titlebar_rect = title_bar_rect(); auto titlebar_icon_rect = title_bar_icon_rect(); @@ -273,7 +273,7 @@ static Gfx::Rect frame_rect_for_window(WSWindow& window) return frame_rect_for_window(window, window.rect()); } -Rect WSWindowFrame::rect() const +Gfx::Rect WSWindowFrame::rect() const { return frame_rect_for_window(m_window); } diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp index daa6f873d6..89663bd654 100644 --- a/Servers/WindowServer/WSWindowManager.cpp +++ b/Servers/WindowServer/WSWindowManager.cpp @@ -372,7 +372,7 @@ void WSWindowManager::start_window_resize(WSWindow& window, const Gfx::Point& po { ResizeDirection::Left, ResizeDirection::None, ResizeDirection::Right }, { ResizeDirection::DownLeft, ResizeDirection::Down, ResizeDirection::DownRight }, }; - Rect outer_rect = window.frame().rect(); + Gfx::Rect outer_rect = window.frame().rect(); ASSERT(outer_rect.contains(position)); int window_relative_x = position.x() - outer_rect.x(); int window_relative_y = position.y() - outer_rect.y(); @@ -937,7 +937,7 @@ bool WSWindowManager::any_opaque_window_above_this_one_contains_rect(const WSWin return found_containing_window; }; -Rect WSWindowManager::menubar_rect() const +Gfx::Rect WSWindowManager::menubar_rect() const { if (active_fullscreen_window()) return {}; @@ -1212,9 +1212,9 @@ ResizeDirection WSWindowManager::resize_direction_of_window(const WSWindow& wind return m_resize_direction; } -Rect WSWindowManager::maximized_window_rect(const WSWindow& window) const +Gfx::Rect WSWindowManager::maximized_window_rect(const WSWindow& window) const { - Rect rect = WSScreen::the().rect(); + Gfx::Rect rect = WSScreen::the().rect(); // Subtract window title bar (leaving the border) rect.set_y(rect.y() + window.frame().title_bar_rect().height()); diff --git a/Servers/WindowServer/WindowClient.ipc b/Servers/WindowServer/WindowClient.ipc index 7c28e9d30c..e1b8e8398a 100644 --- a/Servers/WindowServer/WindowClient.ipc +++ b/Servers/WindowServer/WindowClient.ipc @@ -1,11 +1,11 @@ endpoint WindowClient = 4 { - Paint(i32 window_id, Size window_size, Vector<Rect> rects) =| - MouseMove(i32 window_id, Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =| - MouseDown(i32 window_id, Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =| - MouseDoubleClick(i32 window_id, Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =| - MouseUp(i32 window_id, Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =| - MouseWheel(i32 window_id, Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =| + Paint(i32 window_id, Gfx::Size window_size, Vector<Gfx::Rect> rects) =| + MouseMove(i32 window_id, Gfx::Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =| + MouseDown(i32 window_id, Gfx::Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =| + MouseDoubleClick(i32 window_id, Gfx::Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =| + MouseUp(i32 window_id, Gfx::Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =| + MouseWheel(i32 window_id, Gfx::Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =| WindowEntered(i32 window_id) =| WindowLeft(i32 window_id) =| KeyDown(i32 window_id, u8 character, u32 key, u32 modifiers) =| @@ -14,25 +14,25 @@ endpoint WindowClient = 4 WindowDeactivated(i32 window_id) =| WindowStateChanged(i32 window_id, bool minimized, bool occluded) =| WindowCloseRequest(i32 window_id) =| - WindowResized(i32 window_id, Rect old_rect, Rect new_rect) =| + WindowResized(i32 window_id, Gfx::Rect old_rect, Gfx::Rect new_rect) =| MenuItemActivated(i32 menu_id, i32 identifier) =| - ScreenRectChanged(Rect rect) =| + ScreenRectChanged(Gfx::Rect rect) =| ClipboardContentsChanged(String content_type) =| WM_WindowRemoved(i32 wm_id, i32 client_id, i32 window_id) =| - WM_WindowStateChanged(i32 wm_id, i32 client_id, i32 window_id, bool is_active, bool is_minimized, i32 window_type, String title, Rect rect) =| - WM_WindowIconBitmapChanged(i32 wm_id, i32 client_id, i32 window_id, i32 icon_buffer_id, Size icon_size) =| - WM_WindowRectChanged(i32 wm_id, i32 client_id, i32 window_id, Rect rect) =| + WM_WindowStateChanged(i32 wm_id, i32 client_id, i32 window_id, bool is_active, bool is_minimized, i32 window_type, String title, Gfx::Rect rect) =| + WM_WindowIconBitmapChanged(i32 wm_id, i32 client_id, i32 window_id, i32 icon_buffer_id, Gfx::Size icon_size) =| + WM_WindowRectChanged(i32 wm_id, i32 client_id, i32 window_id, Gfx::Rect rect) =| AsyncSetWallpaperFinished(bool success) =| DragAccepted() =| DragCancelled() =| - DragDropped(i32 window_id, Point mouse_position, String text, String data_type, String data) =| + DragDropped(i32 window_id, Gfx::Point mouse_position, String text, String data_type, String data) =| UpdateSystemTheme(i32 system_theme_buffer_id) =| } diff --git a/Servers/WindowServer/WindowServer.ipc b/Servers/WindowServer/WindowServer.ipc index 5f9e9a0068..0916bade53 100644 --- a/Servers/WindowServer/WindowServer.ipc +++ b/Servers/WindowServer/WindowServer.ipc @@ -1,6 +1,6 @@ endpoint WindowServer = 2 { - Greet() => (i32 client_id, Rect screen_rect, i32 system_theme_buffer_id) + Greet() => (i32 client_id, Gfx::Rect screen_rect, i32 system_theme_buffer_id) CreateMenubar() => (i32 menubar_id) DestroyMenubar(i32 menubar_id) => () @@ -28,7 +28,7 @@ endpoint WindowServer = 2 UpdateMenuItem(i32 menu_id, i32 identifier, i32 submenu_id, String text, bool enabled, bool checkable, bool checked, String shortcut) => () CreateWindow( - Rect rect, + Gfx::Rect rect, bool has_alpha_channel, bool modal, bool minimizable, @@ -36,8 +36,8 @@ endpoint WindowServer = 2 bool fullscreen, bool show_titlebar, float opacity, - Size base_size, - Size size_increment, + Gfx::Size base_size, + Gfx::Size size_increment, i32 type, String title) => (i32 window_id) @@ -46,37 +46,37 @@ endpoint WindowServer = 2 SetWindowTitle(i32 window_id, String title) => () GetWindowTitle(i32 window_id) => (String title) - SetWindowRect(i32 window_id, Rect rect) => () - GetWindowRect(i32 window_id) => (Rect rect) + SetWindowRect(i32 window_id, Gfx::Rect rect) => () + GetWindowRect(i32 window_id) => (Gfx::Rect rect) - InvalidateRect(i32 window_id, Vector<Rect> rects) =| - DidFinishPainting(i32 window_id, Vector<Rect> rects) =| + InvalidateRect(i32 window_id, Vector<Gfx::Rect> rects) =| + DidFinishPainting(i32 window_id, Vector<Gfx::Rect> rects) =| SetGlobalCursorTracking(i32 window_id, bool enabled) => () SetWindowOpacity(i32 window_id, float opacity) => () - SetWindowBackingStore(i32 window_id, i32 bpp, i32 pitch, i32 shared_buffer_id, bool has_alpha_channel, Size size, bool flush_immediately) => () + SetWindowBackingStore(i32 window_id, i32 bpp, i32 pitch, i32 shared_buffer_id, bool has_alpha_channel, Gfx::Size size, bool flush_immediately) => () GetClipboardContents() => (i32 shared_buffer_id, i32 content_size, String content_type) SetClipboardContents(i32 shared_buffer_id, i32 content_size, String content_type) => () WM_SetActiveWindow(i32 client_id, i32 window_id) =| WM_SetWindowMinimized(i32 client_id, i32 window_id, bool minimized) =| WM_StartWindowResize(i32 client_id, i32 window_id) =| - WM_PopupWindowMenu(i32 client_id, i32 window_id, Point screen_position) =| - WM_SetWindowTaskbarRect(i32 client_id, i32 window_id, Rect rect) =| + WM_PopupWindowMenu(i32 client_id, i32 window_id, Gfx::Point screen_position) =| + WM_SetWindowTaskbarRect(i32 client_id, i32 window_id, Gfx::Rect rect) =| SetWindowHasAlphaChannel(i32 window_id, bool has_alpha_channel) => () MoveWindowToFront(i32 window_id) => () SetFullscreen(i32 window_id, bool fullscreen) => () - PopupMenu(i32 menu_id, Point screen_position) => () + PopupMenu(i32 menu_id, Gfx::Point screen_position) => () DismissMenu(i32 menu_id) => () AsyncSetWallpaper(String path) =| - SetResolution(Size resolution) => () - SetWindowIconBitmap(i32 window_id, i32 icon_buffer_id, Size icon_size) => () + SetResolution(Gfx::Size resolution) => () + SetWindowIconBitmap(i32 window_id, i32 icon_buffer_id, Gfx::Size icon_size) => () GetWallpaper() => (String path) SetWindowOverrideCursor(i32 window_id, i32 cursor_type) => () - StartDrag(String text, String data_type, String data, i32 bitmap_id, Size bitmap_size) => (bool started) + StartDrag(String text, String data_type, String data, i32 bitmap_id, Gfx::Size bitmap_size) => (bool started) } |