From 7750e6952b8d71b18b7be1e040e5421ebdd23b4f Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 16 Jan 2019 17:54:06 +0100 Subject: [PATCH] Move some more classes to the new coding style. --- Terminal/Terminal.cpp | 14 +++++----- Widgets/Button.cpp | 2 +- Widgets/CharacterBitmap.cpp | 6 ++-- Widgets/CharacterBitmap.h | 2 +- Widgets/CheckBox.cpp | 8 +++--- Widgets/Font.cpp | 25 ++++++++--------- Widgets/Font.h | 18 ++++++------ Widgets/ListBox.cpp | 2 +- Widgets/Painter.cpp | 32 ++++++++++----------- Widgets/Peanut8x10.h | 8 +++--- Widgets/Peanut8x8.h | 8 +++--- Widgets/Point.h | 10 +++---- Widgets/Rect.cpp | 8 +++--- Widgets/Rect.h | 48 ++++++++++++++++---------------- Widgets/Size.h | 4 +-- Widgets/TerminalWidget.cpp | 8 +++--- Widgets/TextBox.cpp | 10 +++---- Widgets/Widget.cpp | 2 +- WindowServer/WSScreen.cpp | 6 ++-- WindowServer/WSWindowManager.cpp | 6 ++-- 20 files changed, 113 insertions(+), 114 deletions(-) diff --git a/Terminal/Terminal.cpp b/Terminal/Terminal.cpp index 853d2fcc0e..2def507447 100644 --- a/Terminal/Terminal.cpp +++ b/Terminal/Terminal.cpp @@ -11,10 +11,10 @@ void Terminal::create_window() { - auto& font = Font::defaultFont(); + auto& font = Font::default_font(); - m_pixel_width = m_columns * font.glyphWidth() + m_inset * 2; - m_pixel_height = (m_rows * (font.glyphHeight() + m_line_spacing)) + (m_inset * 2) - m_line_spacing; + m_pixel_width = m_columns * font.glyph_width() + m_inset * 2; + m_pixel_height = (m_rows * (font.glyph_height() + m_line_spacing)) + (m_inset * 2) - m_line_spacing; GUI_CreateWindowParameters params; params.rect = { { 300, 300 }, { m_pixel_width, m_pixel_height } }; @@ -398,9 +398,9 @@ void Terminal::set_size(word columns, word rows) void Terminal::paint() { Rect rect { 0, 0, m_pixel_width, m_pixel_height }; - Font& font = Font::defaultFont(); + Font& font = Font::default_font(); Painter painter(*m_backing); - int line_height = Font::defaultFont().glyphHeight() + m_line_spacing; + int line_height = Font::default_font().glyph_height() + m_line_spacing; #ifdef FAST_SCROLL if (m_rows_to_scroll_backing_store && m_rows_to_scroll_backing_store < m_rows) { int first_scanline = m_inset; @@ -424,8 +424,8 @@ void Terminal::paint() continue; attribute.dirty = false; char ch = m_buffer[(row * m_columns) + (column)]; - int x = column * font.glyphWidth(); - Rect glyph_rect { x + m_inset, y + m_inset, font.glyphWidth(), line_height }; + int x = column * font.glyph_width(); + Rect glyph_rect { x + m_inset, y + m_inset, font.glyph_width(), line_height }; auto glyph_background = ansi_color(attribute.background_color); painter.fill_rect(glyph_rect, glyph_background); if (ch == ' ') diff --git a/Widgets/Button.cpp b/Widgets/Button.cpp index 26dc377cd9..7f6b7cfc89 100644 --- a/Widgets/Button.cpp +++ b/Widgets/Button.cpp @@ -59,7 +59,7 @@ void Button::paintEvent(PaintEvent&) if (!caption().is_empty()) { auto textRect = rect(); if (m_beingPressed) - textRect.moveBy(1, 1); + textRect.move_by(1, 1); painter.draw_text(textRect, caption(), Painter::TextAlignment::Center, Color::Black); } } diff --git a/Widgets/CharacterBitmap.cpp b/Widgets/CharacterBitmap.cpp index 4ea7a14467..3ba69c8e99 100644 --- a/Widgets/CharacterBitmap.cpp +++ b/Widgets/CharacterBitmap.cpp @@ -1,7 +1,7 @@ #include "CharacterBitmap.h" -CharacterBitmap::CharacterBitmap(const char* asciiData, unsigned width, unsigned height) - : m_bits(asciiData) +CharacterBitmap::CharacterBitmap(const char* ascii_data, unsigned width, unsigned height) + : m_bits(ascii_data) , m_size(width, height) { } @@ -10,7 +10,7 @@ CharacterBitmap::~CharacterBitmap() { } -RetainPtr CharacterBitmap::createFromASCII(const char* asciiData, unsigned width, unsigned height) +RetainPtr CharacterBitmap::create_from_ascii(const char* asciiData, unsigned width, unsigned height) { return adopt(*new CharacterBitmap(asciiData, width, height)); } diff --git a/Widgets/CharacterBitmap.h b/Widgets/CharacterBitmap.h index 8c9f9e3d3e..917cff92a5 100644 --- a/Widgets/CharacterBitmap.h +++ b/Widgets/CharacterBitmap.h @@ -6,7 +6,7 @@ class CharacterBitmap : public Retainable { public: - static RetainPtr createFromASCII(const char* asciiData, unsigned width, unsigned height); + static RetainPtr create_from_ascii(const char* asciiData, unsigned width, unsigned height); ~CharacterBitmap(); const char* bits() const { return m_bits; } diff --git a/Widgets/CheckBox.cpp b/Widgets/CheckBox.cpp index 637a391f49..2340d382bb 100644 --- a/Widgets/CheckBox.cpp +++ b/Widgets/CheckBox.cpp @@ -75,15 +75,15 @@ static const char* checkedBitmap = { void CheckBox::paintEvent(PaintEvent&) { Painter painter(*this); - auto bitmap = CharacterBitmap::createFromASCII(isChecked() ? checkedBitmap : uncheckedBitmap, 11, 11); + auto bitmap = CharacterBitmap::create_from_ascii(isChecked() ? checkedBitmap : uncheckedBitmap, 11, 11); auto textRect = rect(); textRect.set_left(bitmap->width() + 4); - textRect.set_top(height() / 2 - font().glyphHeight() / 2); + textRect.set_top(height() / 2 - font().glyph_height() / 2); Point bitmapPosition; - bitmapPosition.setX(2); - bitmapPosition.setY(height() / 2 - bitmap->height() / 2 - 1); + bitmapPosition.set_x(2); + bitmapPosition.set_y(height() / 2 - bitmap->height() / 2 - 1); painter.fill_rect(rect(), backgroundColor()); painter.draw_bitmap(bitmapPosition, *bitmap, foregroundColor()); diff --git a/Widgets/Font.cpp b/Widgets/Font.cpp index f73b62484f..31c918db58 100644 --- a/Widgets/Font.cpp +++ b/Widgets/Font.cpp @@ -1,6 +1,5 @@ #include "Font.h" #include "Peanut8x10.h" -#include static Font* s_default_font; @@ -9,19 +8,19 @@ void Font::initialize() s_default_font = nullptr; } -Font& Font::defaultFont() +Font& Font::default_font() { if (!s_default_font) - s_default_font = adopt(*new Font(Peanut8x10::glyphs, Peanut8x10::glyphWidth, Peanut8x10::glyphHeight, Peanut8x10::firstGlyph, Peanut8x10::lastGlyph)).leakRef(); + s_default_font = adopt(*new Font(Peanut8x10::glyphs, Peanut8x10::glyph_width, Peanut8x10::glyph_height, Peanut8x10::first_glyph, Peanut8x10::last_glyph)).leakRef(); return *s_default_font; } -Font::Font(const char* const* glyphs, byte glyphWidth, byte glyphHeight, byte firstGlyph, byte lastGlyph) +Font::Font(const char* const* glyphs, byte glyph_width, byte glyph_height, byte first_glyph, byte last_glyph) : m_glyphs(glyphs) - , m_glyphWidth(glyphWidth) - , m_glyphHeight(glyphHeight) - , m_firstGlyph(firstGlyph) - , m_lastGlyph(lastGlyph) + , m_glyph_width(glyph_width) + , m_glyph_height(glyph_height) + , m_first_glyph(first_glyph) + , m_last_glyph(last_glyph) { } @@ -29,14 +28,14 @@ Font::~Font() { } -const CharacterBitmap* Font::glyphBitmap(byte ch) const +const CharacterBitmap* Font::glyph_bitmap(byte ch) const { if (!m_bitmaps[ch]) { - if (ch < m_firstGlyph || ch > m_lastGlyph) + if (ch < m_first_glyph || ch > m_last_glyph) return nullptr; - const char* data = m_glyphs[(unsigned)ch - m_firstGlyph]; - m_bitmaps[ch] = CharacterBitmap::createFromASCII(data, m_glyphWidth, m_glyphHeight); + const char* data = m_glyphs[(unsigned)ch - m_first_glyph]; + m_bitmaps[ch] = CharacterBitmap::create_from_ascii(data, m_glyph_width, m_glyph_height); } - ASSERT(ch >= m_firstGlyph && ch <= m_lastGlyph); + ASSERT(ch >= m_first_glyph && ch <= m_last_glyph); return m_bitmaps[ch].ptr(); } diff --git a/Widgets/Font.h b/Widgets/Font.h index 3c9158f761..c420b8eef9 100644 --- a/Widgets/Font.h +++ b/Widgets/Font.h @@ -7,26 +7,26 @@ class Font : public Retainable { public: - static Font& defaultFont(); + static Font& default_font(); ~Font(); - const CharacterBitmap* glyphBitmap(byte) const; + const CharacterBitmap* glyph_bitmap(byte) const; - byte glyphWidth() const { return m_glyphWidth; } - byte glyphHeight() const { return m_glyphHeight; } + byte glyph_width() const { return m_glyph_width; } + byte glyph_height() const { return m_glyph_height; } static void initialize(); private: - Font(const char* const* glyphs, byte glyphWidth, byte glyphHeight, byte firstGlyph, byte lastGlyph); + Font(const char* const* glyphs, byte glyph_width, byte glyph_height, byte firstGlyph, byte lastGlyph); const char* const* m_glyphs { nullptr }; mutable RetainPtr m_bitmaps[256]; - byte m_glyphWidth { 0 }; - byte m_glyphHeight { 0 }; + byte m_glyph_width { 0 }; + byte m_glyph_height { 0 }; - byte m_firstGlyph { 0 }; - byte m_lastGlyph { 0 }; + byte m_first_glyph { 0 }; + byte m_last_glyph { 0 }; }; diff --git a/Widgets/ListBox.cpp b/Widgets/ListBox.cpp index d74a69cd0e..1a0525252c 100644 --- a/Widgets/ListBox.cpp +++ b/Widgets/ListBox.cpp @@ -14,7 +14,7 @@ ListBox::~ListBox() Rect ListBox::item_rect(int index) const { - int item_height = font().glyphHeight() + 2; + int item_height = font().glyph_height() + 2; return Rect { 2, 2 + (index * item_height), width() - 4, item_height }; } diff --git a/Widgets/Painter.cpp b/Widgets/Painter.cpp index c2e1ad1386..088420d68a 100644 --- a/Widgets/Painter.cpp +++ b/Widgets/Painter.cpp @@ -9,7 +9,7 @@ Painter::Painter(GraphicsBitmap& bitmap) { - m_font = &Font::defaultFont(); + m_font = &Font::default_font(); m_target = &bitmap; m_clip_rect = { { 0, 0 }, bitmap.size() }; } @@ -20,7 +20,7 @@ Painter::Painter(Widget& widget) m_target = widget.backing(); ASSERT(m_target); m_window = widget.window(); - m_translation.moveBy(widget.relativePosition()); + m_translation.move_by(widget.relativePosition()); // NOTE: m_clip_rect is in Window coordinates since we are painting into its backing store. m_clip_rect = widget.relativeRect(); @@ -38,7 +38,7 @@ Painter::~Painter() void Painter::fill_rect(const Rect& rect, Color color) { Rect r = rect; - r.moveBy(m_translation); + r.move_by(m_translation); int min_y = max(r.top(), m_clip_rect.top()); int max_y = min(r.bottom(), m_clip_rect.bottom()); @@ -53,7 +53,7 @@ void Painter::fill_rect(const Rect& rect, Color color) void Painter::draw_rect(const Rect& rect, Color color) { Rect r = rect; - r.moveBy(m_translation); + r.move_by(m_translation); int min_y = max(r.top(), m_clip_rect.top()); int max_y = min(r.bottom(), m_clip_rect.bottom()); @@ -76,7 +76,7 @@ void Painter::draw_rect(const Rect& rect, Color color) void Painter::draw_bitmap(const Point& p, const CharacterBitmap& bitmap, Color color) { Point point = p; - point.moveBy(m_translation); + point.move_by(m_translation); for (unsigned row = 0; row < bitmap.height(); ++row) { int y = point.y() + row; if (y < m_clip_rect.top() || y > m_clip_rect.bottom()) @@ -95,7 +95,7 @@ void Painter::draw_bitmap(const Point& p, const CharacterBitmap& bitmap, Color c void Painter::draw_glyph(const Point& point, char ch, Color color) { - auto* bitmap = font().glyphBitmap(ch); + auto* bitmap = font().glyph_bitmap(ch); if (!bitmap) { dbgprintf("Font doesn't have 0x%b ('%c')\n", (byte)ch, ch); ASSERT_NOT_REACHED(); @@ -112,16 +112,16 @@ void Painter::draw_text(const Rect& rect, const String& text, TextAlignment alig if (alignment == TextAlignment::TopLeft) { point = rect.location(); } else if (alignment == TextAlignment::CenterLeft) { - point = { rect.x(), rect.center().y() - (font().glyphHeight() / 2) }; + point = { rect.x(), rect.center().y() - (font().glyph_height() / 2) }; } else if (alignment == TextAlignment::Center) { - int textWidth = text.length() * font().glyphWidth(); + int textWidth = text.length() * font().glyph_width(); point = rect.center(); - point.moveBy(-(textWidth / 2), -(font().glyphHeight() / 2)); + point.move_by(-(textWidth / 2), -(font().glyph_height() / 2)); } else { ASSERT_NOT_REACHED(); } - for (unsigned i = 0; i < text.length(); ++i, point.moveBy(font().glyphWidth(), 0)) { + for (unsigned i = 0; i < text.length(); ++i, point.move_by(font().glyph_width(), 0)) { byte ch = text[i]; if (ch == ' ') continue; @@ -132,7 +132,7 @@ void Painter::draw_text(const Rect& rect, const String& text, TextAlignment alig void Painter::set_pixel(const Point& p, Color color) { auto point = p; - point.moveBy(m_translation); + point.move_by(m_translation); if (!m_clip_rect.contains(point)) return; m_target->scanline(point.y())[point.x()] = color.value(); @@ -149,10 +149,10 @@ ALWAYS_INLINE void Painter::set_pixel_with_draw_op(dword& pixel, const Color& co void Painter::draw_line(const Point& p1, const Point& p2, Color color) { auto point1 = p1; - point1.moveBy(m_translation); + point1.move_by(m_translation); auto point2 = p2; - point2.moveBy(m_translation); + point2.move_by(m_translation); // Special case: vertical line. if (point1.x() == point2.x()) { @@ -215,9 +215,9 @@ void Painter::draw_line(const Point& p1, const Point& p2, Color color) void Painter::draw_focus_rect(const Rect& rect) { Rect focus_rect = rect; - focus_rect.moveBy(1, 1); - focus_rect.setWidth(focus_rect.width() - 2); - focus_rect.setHeight(focus_rect.height() - 2); + focus_rect.move_by(1, 1); + focus_rect.set_width(focus_rect.width() - 2); + focus_rect.set_height(focus_rect.height() - 2); draw_rect(focus_rect, Color(96, 96, 192)); } diff --git a/Widgets/Peanut8x10.h b/Widgets/Peanut8x10.h index 973027e9f6..3a9d3a6b53 100644 --- a/Widgets/Peanut8x10.h +++ b/Widgets/Peanut8x10.h @@ -2,10 +2,10 @@ namespace Peanut8x10 { -static constexpr char firstGlyph = '!'; -static constexpr char lastGlyph = '~'; -static constexpr byte glyphWidth = 8; -static constexpr byte glyphHeight = 10; +static constexpr char first_glyph = '!'; +static constexpr char last_glyph = '~'; +static constexpr byte glyph_width = 8; +static constexpr byte glyph_height = 10; static constexpr const char* glyphs[] { diff --git a/Widgets/Peanut8x8.h b/Widgets/Peanut8x8.h index a7c97c2fab..d4e9815a0b 100644 --- a/Widgets/Peanut8x8.h +++ b/Widgets/Peanut8x8.h @@ -2,10 +2,10 @@ namespace Peanut8x8 { -static constexpr char firstCharacter = '!'; -static constexpr char lastCharacter = '~'; -static constexpr byte fontWidth = 8; -static constexpr byte fontHeight = 8; +static constexpr char first_character = '!'; +static constexpr char last_character = '~'; +static constexpr byte font_width = 8; +static constexpr byte font_height = 8; static constexpr const char* font[] { diff --git a/Widgets/Point.h b/Widgets/Point.h index 895bfa4441..222eddcb46 100644 --- a/Widgets/Point.h +++ b/Widgets/Point.h @@ -12,18 +12,18 @@ public: int x() const { return m_x; } int y() const { return m_y; } - void setX(int x) { m_x = x; } - void setY(int y) { m_y = y; } + void set_x(int x) { m_x = x; } + void set_y(int y) { m_y = y; } - void moveBy(int dx, int dy) + void move_by(int dx, int dy) { m_x += dx; m_y += dy; } - void moveBy(const Point& delta) + void move_by(const Point& delta) { - moveBy(delta.x(), delta.y()); + move_by(delta.x(), delta.y()); } void constrain(const Rect&); diff --git a/Widgets/Rect.cpp b/Widgets/Rect.cpp index 95704357dc..b21cc730bd 100644 --- a/Widgets/Rect.cpp +++ b/Widgets/Rect.cpp @@ -15,10 +15,10 @@ void Rect::intersect(const Rect& other) return; } - m_location.setX(l); - m_location.setY(t); - m_size.setWidth((r - l) + 1); - m_size.setHeight((b - t) + 1); + m_location.set_x(l); + m_location.set_y(t); + m_size.set_width((r - l) + 1); + m_size.set_height((b - t) + 1); } Rect Rect::united(const Rect& other) const diff --git a/Widgets/Rect.h b/Widgets/Rect.h index 4131cbba85..aa9b02b536 100644 --- a/Widgets/Rect.h +++ b/Widgets/Rect.h @@ -25,14 +25,14 @@ public: return width() == 0 || height() == 0; } - void moveBy(int dx, int dy) + void move_by(int dx, int dy) { - m_location.moveBy(dx, dy); + m_location.move_by(dx, dy); } - void moveBy(const Point& delta) + void move_by(const Point& delta) { - m_location.moveBy(delta); + m_location.move_by(delta); } Point center() const @@ -42,18 +42,18 @@ public: void inflate(int w, int h) { - setX(x() - w / 2); - setWidth(width() + w); - setY(y() - h / 2); - setHeight(height() + h); + set_x(x() - w / 2); + set_width(width() + w); + set_y(y() - h / 2); + set_height(height() + h); } void shrink(int w, int h) { - setX(x() + w / 2); - setWidth(width() - w); - setY(y() + h / 2); - setHeight(height() - h); + set_x(x() + w / 2); + set_width(width() - w); + set_y(y() + h / 2); + set_height(height() - h); } bool contains(int x, int y) const @@ -81,22 +81,22 @@ public: void set_left(int left) { - setX(left); + set_x(left); } void set_top(int top) { - setY(top); + set_y(top); } void set_right(int right) { - setWidth(right - x() + 1); + set_width(right - x() + 1); } void set_bottom(int bottom) { - setHeight(bottom - y() + 1); + set_height(bottom - y() + 1); } bool intersects(const Rect& other) const @@ -112,10 +112,10 @@ public: int width() const { return m_size.width(); } int height() const { return m_size.height(); } - void setX(int x) { m_location.setX(x); } - void setY(int y) { m_location.setY(y); } - void setWidth(int width) { m_size.setWidth(width); } - void setHeight(int height) { m_size.setHeight(height); } + void set_x(int x) { m_location.set_x(x); } + void set_y(int y) { m_location.set_y(y); } + void set_width(int width) { m_size.set_width(width); } + void set_height(int height) { m_size.set_height(height); } Point location() const { return m_location; } Size size() const { return m_size; } @@ -147,11 +147,11 @@ private: inline void Point::constrain(const Rect& rect) { if (x() < rect.left()) - setX(rect.left()); + set_x(rect.left()); else if (x() > rect.right()) - setX(rect.right()); + set_x(rect.right()); if (y() < rect.top()) - setY(rect.top()); + set_y(rect.top()); else if (y() > rect.bottom()) - setY(rect.bottom()); + set_y(rect.bottom()); } diff --git a/Widgets/Size.h b/Widgets/Size.h index 197a848d34..4e5a4ea811 100644 --- a/Widgets/Size.h +++ b/Widgets/Size.h @@ -13,8 +13,8 @@ public: int width() const { return m_width; } int height() const { return m_height; } - void setWidth(int w) { m_width = w; } - void setHeight(int h) { m_height = h; } + void set_width(int w) { m_width = w; } + void set_height(int h) { m_height = h; } bool operator==(const Size& other) const { diff --git a/Widgets/TerminalWidget.cpp b/Widgets/TerminalWidget.cpp index cb934fafb6..efa3b2abb6 100644 --- a/Widgets/TerminalWidget.cpp +++ b/Widgets/TerminalWidget.cpp @@ -14,7 +14,7 @@ TerminalWidget::TerminalWidget(Widget* parent) { g_tw = this; - setWindowRelativeRect({ 0, 0, int(columns() * font().glyphWidth()) + 4, int(rows() * font().glyphHeight()) + 4 }); + setWindowRelativeRect({ 0, 0, int(columns() * font().glyph_width()) + 4, int(rows() * font().glyph_height()) + 4 }); printf("rekt: %d x %d\n", width(), height()); m_screen = new CharacterWithAttributes[rows() * columns()]; @@ -71,11 +71,11 @@ void TerminalWidget::paintEvent(PaintEvent&) char buf[2] = { 0, 0 }; for (unsigned row = 0; row < m_rows; ++row) { - int y = row * font().glyphHeight(); + int y = row * font().glyph_height(); for (unsigned column = 0; column < m_columns; ++column) { - int x = column * font().glyphWidth(); + int x = column * font().glyph_width(); buf[0] = at(row, column).character; - painter.draw_text({ x + 2, y + 2, width(), font().glyphHeight() }, buf, Painter::TextAlignment::TopLeft, Color(0xa0, 0xa0, 0xa0)); + painter.draw_text({ x + 2, y + 2, width(), font().glyph_height() }, buf, Painter::TextAlignment::TopLeft, Color(0xa0, 0xa0, 0xa0)); } } diff --git a/Widgets/TextBox.cpp b/Widgets/TextBox.cpp index 9b7535a6da..052bd423c6 100644 --- a/Widgets/TextBox.cpp +++ b/Widgets/TextBox.cpp @@ -35,18 +35,18 @@ void TextBox::paintEvent(PaintEvent&) Rect innerRect = rect(); innerRect.shrink(6, 6); - size_t maxCharsToPaint = innerRect.width() / font().glyphWidth(); + size_t maxCharsToPaint = innerRect.width() / font().glyph_width(); int firstVisibleChar = max((int)m_cursorPosition - (int)maxCharsToPaint, 0); size_t charsToPaint = min(m_text.length() - firstVisibleChar, maxCharsToPaint); - int y = innerRect.center().y() - font().glyphHeight() / 2; + int y = innerRect.center().y() - font().glyph_height() / 2; for (size_t i = 0; i < charsToPaint; ++i) { char ch = m_text[firstVisibleChar + i]; if (ch == ' ') continue; - int x = innerRect.x() + (i * font().glyphWidth()); - auto* bitmap = font().glyphBitmap(ch); + int x = innerRect.x() + (i * font().glyph_width()); + auto* bitmap = font().glyph_bitmap(ch); if (!bitmap) { printf("TextBox: glyph missing: %02x\n", ch); ASSERT_NOT_REACHED(); @@ -56,7 +56,7 @@ void TextBox::paintEvent(PaintEvent&) if (isFocused() && m_cursorBlinkState) { unsigned visibleCursorPosition = m_cursorPosition - firstVisibleChar; - Rect cursorRect(innerRect.x() + visibleCursorPosition * font().glyphWidth(), innerRect.y(), 1, innerRect.height()); + Rect cursorRect(innerRect.x() + visibleCursorPosition * font().glyph_width(), innerRect.y(), 1, innerRect.height()); painter.fill_rect(cursorRect, foregroundColor()); } } diff --git a/Widgets/Widget.cpp b/Widgets/Widget.cpp index 66d5b0cf01..18aa00929d 100644 --- a/Widgets/Widget.cpp +++ b/Widgets/Widget.cpp @@ -151,7 +151,7 @@ void Widget::setFocus(bool focus) void Widget::setFont(RetainPtr&& font) { if (!font) - m_font = Font::defaultFont(); + m_font = Font::default_font(); else m_font = move(font); } diff --git a/WindowServer/WSScreen.cpp b/WindowServer/WSScreen.cpp index d1ce9ec132..1fa81a3a0d 100644 --- a/WindowServer/WSScreen.cpp +++ b/WindowServer/WSScreen.cpp @@ -34,12 +34,12 @@ WSScreen::~WSScreen() void WSScreen::on_receive_mouse_data(int dx, int dy, bool left_button, bool right_button) { auto prev_location = m_cursor_location; - m_cursor_location.moveBy(dx, dy); + m_cursor_location.move_by(dx, dy); m_cursor_location.constrain(rect()); if (m_cursor_location.x() >= width()) - m_cursor_location.setX(width() - 1); + m_cursor_location.set_x(width() - 1); if (m_cursor_location.y() >= height()) - m_cursor_location.setY(height() - 1); + m_cursor_location.set_y(height() - 1); if (m_cursor_location != prev_location) { auto event = make(WSEvent::MouseMove, m_cursor_location.x(), m_cursor_location.y()); WSEventLoop::the().post_event(&WSWindowManager::the(), move(event)); diff --git a/WindowServer/WSWindowManager.cpp b/WindowServer/WSWindowManager.cpp index 1f0162e20b..2ccd5e22ff 100644 --- a/WindowServer/WSWindowManager.cpp +++ b/WindowServer/WSWindowManager.cpp @@ -128,8 +128,8 @@ WSWindowManager::WSWindowManager() m_inactiveWindowBorderColor = Color(64, 64, 64); m_inactiveWindowTitleColor = Color::White; - m_cursor_bitmap_inner = CharacterBitmap::createFromASCII(cursor_bitmap_inner_ascii, 12, 17); - m_cursor_bitmap_outer = CharacterBitmap::createFromASCII(cursor_bitmap_outer_ascii, 12, 17); + m_cursor_bitmap_inner = CharacterBitmap::create_from_ascii(cursor_bitmap_inner_ascii, 12, 17); + m_cursor_bitmap_outer = CharacterBitmap::create_from_ascii(cursor_bitmap_outer_ascii, 12, 17); invalidate(); compose(); @@ -237,7 +237,7 @@ void WSWindowManager::processMouseEvent(MouseEvent& event) auto old_window_rect = m_dragWindow->rect(); Point pos = m_dragWindowOrigin; printf("[WM] Dragging [origin: %d,%d] now: %d,%d\n", m_dragOrigin.x(), m_dragOrigin.y(), event.x(), event.y()); - pos.moveBy(event.x() - m_dragOrigin.x(), event.y() - m_dragOrigin.y()); + pos.move_by(event.x() - m_dragOrigin.x(), event.y() - m_dragOrigin.y()); m_dragWindow->set_position_without_repaint(pos); invalidate(outerRectForWindow(old_window_rect)); invalidate(outerRectForWindow(m_dragWindow->rect()));