diff --git a/Userland/Applications/PixelPaint/LayerListWidget.cpp b/Userland/Applications/PixelPaint/LayerListWidget.cpp index 1e41f1faa7..a3857a9817 100644 --- a/Userland/Applications/PixelPaint/LayerListWidget.cpp +++ b/Userland/Applications/PixelPaint/LayerListWidget.cpp @@ -287,7 +287,7 @@ void LayerListWidget::mousemove_event(GUI::MouseEvent& event) gadget.movement_delta.set_y(inner_rect_max_height - gadget.rect.bottom()); m_automatic_scroll_delta = automatic_scroll_delta_from_position(event.position()); - set_automatic_scrolling_timer_active(vertical_scrollbar().is_scrollable() && !m_automatic_scroll_delta.is_null()); + set_automatic_scrolling_timer_active(vertical_scrollbar().is_scrollable() && !m_automatic_scroll_delta.is_zero()); relayout_gadgets(); } diff --git a/Userland/Libraries/LibGUI/AbstractView.cpp b/Userland/Libraries/LibGUI/AbstractView.cpp index ec95d5f2b6..8ad6ba9d3a 100644 --- a/Userland/Libraries/LibGUI/AbstractView.cpp +++ b/Userland/Libraries/LibGUI/AbstractView.cpp @@ -796,7 +796,7 @@ void AbstractView::drag_move_event(DragEvent& event) if (acceptable) { m_automatic_scroll_delta = automatic_scroll_delta_from_position(event.position()); - set_automatic_scrolling_timer_active(!m_automatic_scroll_delta.is_null()); + set_automatic_scrolling_timer_active(!m_automatic_scroll_delta.is_zero()); } if (m_drop_candidate_index != new_drop_candidate_index) { @@ -819,7 +819,7 @@ void AbstractView::drag_leave_event(Event&) void AbstractView::automatic_scrolling_timer_did_fire() { - if (m_automatic_scroll_delta.is_null()) + if (m_automatic_scroll_delta.is_zero()) return; vertical_scrollbar().increase_slider_by(m_automatic_scroll_delta.y()); diff --git a/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp b/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp index e228c536df..d8108baeff 100644 --- a/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp +++ b/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp @@ -13,7 +13,7 @@ constexpr float wheel_zoom_factor = 8.0f; void AbstractZoomPanWidget::set_scale(float new_scale) { - if (m_original_rect.is_null()) + if (m_original_rect.is_empty()) return; m_scale = clamp(new_scale, m_min_scale, m_max_scale); @@ -36,7 +36,7 @@ void AbstractZoomPanWidget::scale_by(float delta) void AbstractZoomPanWidget::scale_centered(float new_scale, Gfx::IntPoint center) { - if (m_original_rect.is_null()) + if (m_original_rect.is_empty()) return; new_scale = clamp(new_scale, m_min_scale, m_max_scale); @@ -154,7 +154,7 @@ void AbstractZoomPanWidget::mouseup_event(GUI::MouseEvent& event) void AbstractZoomPanWidget::relayout() { - if (m_original_rect.is_null()) + if (m_original_rect.is_empty()) return; m_content_rect.set_location({ diff --git a/Userland/Libraries/LibGUI/IconView.cpp b/Userland/Libraries/LibGUI/IconView.cpp index fe18cca72b..b9af27130b 100644 --- a/Userland/Libraries/LibGUI/IconView.cpp +++ b/Userland/Libraries/LibGUI/IconView.cpp @@ -329,7 +329,7 @@ void IconView::mousemove_event(MouseEvent& event) if (m_rubber_banding) { m_out_of_view_position = event.position(); - set_automatic_scrolling_timer_active(!m_rubber_band_scroll_delta.is_null()); + set_automatic_scrolling_timer_active(!m_rubber_band_scroll_delta.is_zero()); if (update_rubber_banding(event.position())) return; @@ -342,7 +342,7 @@ void IconView::automatic_scrolling_timer_did_fire() { AbstractView::automatic_scrolling_timer_did_fire(); - if (m_rubber_band_scroll_delta.is_null()) + if (m_rubber_band_scroll_delta.is_zero()) return; vertical_scrollbar().increase_slider_by(m_rubber_band_scroll_delta.y()); diff --git a/Userland/Libraries/LibGUI/Scrollbar.cpp b/Userland/Libraries/LibGUI/Scrollbar.cpp index 7fcdab5f47..7797b0c572 100644 --- a/Userland/Libraries/LibGUI/Scrollbar.cpp +++ b/Userland/Libraries/LibGUI/Scrollbar.cpp @@ -175,7 +175,7 @@ void Scrollbar::paint_event(PaintEvent& event) hovered_component_for_painting = Component::None; painter.fill_rect_with_dither_pattern(rect(), palette().button().lightened(1.3f), palette().button()); - if (m_gutter_click_state != GutterClickState::NotPressed && has_scrubber() && !scrubber_rect().is_null() && hovered_component_for_painting == Component::Gutter) { + if (m_gutter_click_state != GutterClickState::NotPressed && has_scrubber() && !scrubber_rect().is_empty() && hovered_component_for_painting == Component::Gutter) { Gfx::IntRect rect_to_fill = rect(); if (orientation() == Orientation::Vertical) { if (m_gutter_click_state == GutterClickState::BeforeScrubber) { @@ -221,7 +221,7 @@ void Scrollbar::paint_event(PaintEvent& event) painter.draw_triangle(increment_location, orientation() == Orientation::Vertical ? s_down_arrow_coords : s_right_arrow_coords, (has_scrubber() && is_enabled() && !is_max()) ? palette().button_text() : palette().threed_shadow1()); } - if (has_scrubber() && !scrubber_rect().is_null()) + if (has_scrubber() && !scrubber_rect().is_empty()) Gfx::StylePainter::paint_button(painter, scrubber_rect(), palette(), Gfx::ButtonStyle::ThickCap, false, hovered_component_for_painting == Component::Scrubber || m_pressed_component == Component::Scrubber); } diff --git a/Userland/Libraries/LibGUI/Variant.h b/Userland/Libraries/LibGUI/Variant.h index 57ad3a5094..73322111df 100644 --- a/Userland/Libraries/LibGUI/Variant.h +++ b/Userland/Libraries/LibGUI/Variant.h @@ -100,7 +100,8 @@ public: [](Detail::Boolean v) { return v.value; }, [](DeprecatedString const& v) { return !v.is_null(); }, [](Integral auto v) { return v != 0; }, - [](OneOf auto const& v) { return !v.is_null(); }, + [](Gfx::IntPoint const& v) { return !v.is_zero(); }, + [](OneOf auto const& v) { return !v.is_empty(); }, [](Enum auto const&) { return true; }, [](OneOf, NonnullRefPtr, GUI::Icon> auto const&) { return true; }); } diff --git a/Userland/Libraries/LibGfx/Point.h b/Userland/Libraries/LibGfx/Point.h index ea601edc5e..00ee992bca 100644 --- a/Userland/Libraries/LibGfx/Point.h +++ b/Userland/Libraries/LibGfx/Point.h @@ -48,8 +48,7 @@ public: ALWAYS_INLINE void set_x(T x) { m_x = x; } ALWAYS_INLINE void set_y(T y) { m_y = y; } - [[nodiscard]] ALWAYS_INLINE bool is_null() const { return !m_x && !m_y; } - [[nodiscard]] ALWAYS_INLINE bool is_empty() const { return m_x <= 0 && m_y <= 0; } + [[nodiscard]] ALWAYS_INLINE bool is_zero() const { return m_x == 0 && m_y == 0; } void translate_by(T dx, T dy) { diff --git a/Userland/Libraries/LibGfx/Rect.h b/Userland/Libraries/LibGfx/Rect.h index 440f4bb885..0c02cff68c 100644 --- a/Userland/Libraries/LibGfx/Rect.h +++ b/Userland/Libraries/LibGfx/Rect.h @@ -76,7 +76,6 @@ public: [[nodiscard]] ALWAYS_INLINE Point const& location() const { return m_location; } [[nodiscard]] ALWAYS_INLINE Size const& size() const { return m_size; } - [[nodiscard]] ALWAYS_INLINE bool is_null() const { return width() == 0 && height() == 0; } [[nodiscard]] ALWAYS_INLINE bool is_empty() const { return width() <= 0 || height() <= 0; } ALWAYS_INLINE void translate_by(T dx, T dy) { m_location.translate_by(dx, dy); } @@ -831,7 +830,7 @@ public: deltas.clear_with_capacity(); for (auto& rect : rects) { auto delta = calc_delta(rect); - if (!delta.is_null()) + if (!delta.is_zero()) changes = true; deltas.append(delta); } @@ -868,9 +867,9 @@ public: [[nodiscard]] Rect united(Rect const& other) const { - if (is_null()) + if (is_empty()) return other; - if (other.is_null()) + if (other.is_empty()) return *this; Rect rect; rect.set_left(min(left(), other.left())); diff --git a/Userland/Libraries/LibGfx/Size.h b/Userland/Libraries/LibGfx/Size.h index ff71e7d16a..ae55b44042 100644 --- a/Userland/Libraries/LibGfx/Size.h +++ b/Userland/Libraries/LibGfx/Size.h @@ -45,7 +45,6 @@ public: ALWAYS_INLINE constexpr void set_width(T w) { m_width = w; } ALWAYS_INLINE constexpr void set_height(T h) { m_height = h; } - [[nodiscard]] ALWAYS_INLINE constexpr bool is_null() const { return !m_width && !m_height; } [[nodiscard]] ALWAYS_INLINE constexpr bool is_empty() const { return m_width <= 0 || m_height <= 0; } constexpr void scale_by(T dx, T dy) diff --git a/Userland/Services/WindowServer/ConnectionFromClient.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp index faec4a77ed..3030b4c8e8 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.cpp +++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp @@ -154,7 +154,7 @@ void ConnectionFromClient::popup_menu(i32 menu_id, Gfx::IntPoint screen_position return; } auto& menu = *(*it).value; - if (!button_rect.is_null()) + if (!button_rect.is_empty()) menu.open_button_menu(position, button_rect); else menu.popup(position); @@ -654,7 +654,7 @@ void ConnectionFromClient::create_window(i32 window_id, Gfx::IntRect const& rect window->set_alpha_hit_threshold(alpha_hit_threshold); window->set_size_increment(size_increment); window->set_base_size(base_size); - if (resize_aspect_ratio.has_value() && !resize_aspect_ratio.value().is_null()) + if (resize_aspect_ratio.has_value() && !resize_aspect_ratio.value().is_empty()) window->set_resize_aspect_ratio(resize_aspect_ratio); window->invalidate(true, true); if (window->type() == WindowType::Applet) diff --git a/Userland/Services/WindowServer/Overlays.cpp b/Userland/Services/WindowServer/Overlays.cpp index 9ffecde958..1a7066c746 100644 --- a/Userland/Services/WindowServer/Overlays.cpp +++ b/Userland/Services/WindowServer/Overlays.cpp @@ -236,7 +236,7 @@ void WindowGeometryOverlay::update_rect() { if (auto* window = m_window.ptr()) { auto& wm = WindowManager::the(); - if (!window->size_increment().is_null()) { + if (!window->size_increment().is_empty()) { int width_steps = (window->width() - window->base_size().width()) / window->size_increment().width(); int height_steps = (window->height() - window->base_size().height()) / window->size_increment().height(); m_label = DeprecatedString::formatted("{} ({}x{})", window->rect(), width_steps, height_steps); diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 95fd787e4e..899ab2624a 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -943,7 +943,7 @@ bool WindowManager::process_ongoing_window_resize(MouseEvent const& event) m_resize_window->apply_minimum_size(new_rect); - if (!m_resize_window->size_increment().is_null()) { + if (!m_resize_window->size_increment().is_empty()) { int horizontal_incs = (new_rect.width() - m_resize_window->base_size().width()) / m_resize_window->size_increment().width(); new_rect.set_width(m_resize_window->base_size().width() + horizontal_incs * m_resize_window->size_increment().width()); int vertical_incs = (new_rect.height() - m_resize_window->base_size().height()) / m_resize_window->size_increment().height();