summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-10 19:25:13 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-10 19:25:13 +0200
commit0f9be828264a44faa281a655754319c667f81aa6 (patch)
treed5e73bac994730e737d44b10a379dbf0ec8caa8e
parentc063a02979a70ea66fd2aa56576bbb0b62c2745b (diff)
downloadserenity-0f9be828264a44faa281a655754319c667f81aa6.zip
LibGfx: Move StandardCursor enum to LibGfx
This enum existed both in LibGUI and WindowServer which was silly and error-prone.
-rw-r--r--Applications/HexEditor/HexEditor.cpp6
-rw-r--r--Applications/KeyboardMapper/KeyButton.cpp6
-rw-r--r--Applications/PixelPaint/MoveTool.cpp4
-rw-r--r--Demos/WidgetGallery/main.cpp28
-rw-r--r--DevTools/HackStudio/Editor.cpp4
-rw-r--r--DevTools/VisualBuilder/VBForm.cpp10
-rw-r--r--Libraries/LibGUI/ColorInput.cpp4
-rw-r--r--Libraries/LibGUI/HeaderView.cpp8
-rw-r--r--Libraries/LibGUI/ResizeCorner.cpp4
-rw-r--r--Libraries/LibGUI/Splitter.cpp6
-rw-r--r--Libraries/LibGUI/TextEditor.cpp4
-rw-r--r--Libraries/LibGUI/Window.cpp6
-rw-r--r--Libraries/LibGUI/Window.h22
-rw-r--r--Libraries/LibGfx/StandardCursor.h48
-rw-r--r--Libraries/LibVT/TerminalWidget.cpp6
-rw-r--r--Libraries/LibWeb/InProcessWebView.cpp6
-rw-r--r--Libraries/LibWeb/InProcessWebView.h2
-rw-r--r--Libraries/LibWeb/OutOfProcessWebView.cpp4
-rw-r--r--Libraries/LibWeb/Page/EventHandler.cpp6
-rw-r--r--Libraries/LibWeb/Page/Page.h2
-rw-r--r--Services/WindowServer/ClientConnection.cpp2
-rw-r--r--Services/WindowServer/Cursor.cpp30
-rw-r--r--Services/WindowServer/Cursor.h20
23 files changed, 127 insertions, 111 deletions
diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp
index fc041d47ad..615667731a 100644
--- a/Applications/HexEditor/HexEditor.cpp
+++ b/Applications/HexEditor/HexEditor.cpp
@@ -274,12 +274,12 @@ void HexEditor::mousemove_event(GUI::MouseEvent& event)
auto text_end_x = text_start_x + (bytes_per_row() * character_width());
auto text_end_y = text_start_y + 5 + (total_rows() * line_height());
- window()->set_override_cursor(GUI::StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
if ((absolute_x >= hex_start_x && absolute_x <= hex_end_x
&& absolute_y >= hex_start_y && absolute_y <= hex_end_y)
|| (absolute_x >= text_start_x && absolute_x <= text_end_x
&& absolute_y >= text_start_y && absolute_y <= text_end_y)) {
- window()->set_override_cursor(GUI::StandardCursor::IBeam);
+ window()->set_override_cursor(Gfx::StandardCursor::IBeam);
}
if (m_in_drag_select) {
@@ -585,5 +585,5 @@ void HexEditor::paint_event(GUI::PaintEvent& event)
void HexEditor::leave_event(Core::Event&)
{
ASSERT(window());
- window()->set_override_cursor(GUI::StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
}
diff --git a/Applications/KeyboardMapper/KeyButton.cpp b/Applications/KeyboardMapper/KeyButton.cpp
index de090602aa..95b2309688 100644
--- a/Applications/KeyboardMapper/KeyButton.cpp
+++ b/Applications/KeyboardMapper/KeyButton.cpp
@@ -81,16 +81,16 @@ void KeyButton::mousemove_event(GUI::MouseEvent& event)
Gfx::IntRect c = { rect().x() + 7, rect().y() + 4, rect().width() - 14, rect().height() - 14 };
if (c.contains(event.position())) {
- window()->set_override_cursor(GUI::StandardCursor::Hand);
+ window()->set_override_cursor(Gfx::StandardCursor::Hand);
return;
}
- window()->set_override_cursor(GUI::StandardCursor::Arrow);
+ window()->set_override_cursor(Gfx::StandardCursor::Arrow);
AbstractButton::mousemove_event(event);
}
void KeyButton::leave_event(Core::Event& event)
{
- window()->set_override_cursor(GUI::StandardCursor::Arrow);
+ window()->set_override_cursor(Gfx::StandardCursor::Arrow);
AbstractButton::leave_event(event);
}
diff --git a/Applications/PixelPaint/MoveTool.cpp b/Applications/PixelPaint/MoveTool.cpp
index f52b407380..0d545c8185 100644
--- a/Applications/PixelPaint/MoveTool.cpp
+++ b/Applications/PixelPaint/MoveTool.cpp
@@ -52,7 +52,7 @@ void MoveTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEven
m_layer_being_moved = layer;
m_event_origin = image_event.position();
m_layer_origin = layer.location();
- m_editor->window()->set_override_cursor(GUI::StandardCursor::Move);
+ m_editor->window()->set_override_cursor(Gfx::StandardCursor::Move);
}
void MoveTool::on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent& image_event)
@@ -69,7 +69,7 @@ void MoveTool::on_mouseup(Layer&, GUI::MouseEvent& event, GUI::MouseEvent&)
if (event.button() != GUI::MouseButton::Left)
return;
m_layer_being_moved = nullptr;
- m_editor->window()->set_override_cursor(GUI::StandardCursor::None);
+ m_editor->window()->set_override_cursor(Gfx::StandardCursor::None);
}
void MoveTool::on_keydown(GUI::KeyEvent& event)
diff --git a/Demos/WidgetGallery/main.cpp b/Demos/WidgetGallery/main.cpp
index 26d8605cac..989d7f1fbe 100644
--- a/Demos/WidgetGallery/main.cpp
+++ b/Demos/WidgetGallery/main.cpp
@@ -515,59 +515,59 @@ int main(int argc, char** argv)
auto& radio_cursor_none = cursor_group_box.add<GUI::RadioButton>("None");
radio_cursor_none.set_checked(true);
radio_cursor_none.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::None);
+ window->set_override_cursor(Gfx::StandardCursor::None);
};
auto& radio_cursor_arrow = cursor_group_box.add<GUI::RadioButton>("Arrow");
radio_cursor_arrow.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::Arrow);
+ window->set_override_cursor(Gfx::StandardCursor::Arrow);
};
auto& radio_cursor_i_beam = cursor_group_box.add<GUI::RadioButton>("IBeam");
radio_cursor_i_beam.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::IBeam);
+ window->set_override_cursor(Gfx::StandardCursor::IBeam);
};
auto& radio_cursor_resize_horizontal = cursor_group_box.add<GUI::RadioButton>("ResizeHorizontal");
radio_cursor_resize_horizontal.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::ResizeHorizontal);
+ window->set_override_cursor(Gfx::StandardCursor::ResizeHorizontal);
};
auto& radio_cursor_resize_vertical = cursor_group_box.add<GUI::RadioButton>("ResizeVertical");
radio_cursor_resize_vertical.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::ResizeVertical);
+ window->set_override_cursor(Gfx::StandardCursor::ResizeVertical);
};
auto& radio_cursor_resize_diagonal_tlbr = cursor_group_box.add<GUI::RadioButton>("ResizeDiagonalTLBR");
radio_cursor_resize_diagonal_tlbr.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::ResizeDiagonalTLBR);
+ window->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR);
};
auto& radio_cursor_resize_diagonal_bltr = cursor_group_box.add<GUI::RadioButton>("ResizeDiagonalBLTR");
radio_cursor_resize_diagonal_bltr.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::ResizeDiagonalBLTR);
+ window->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalBLTR);
};
auto& radio_cursor_resize_column = cursor_group_box.add<GUI::RadioButton>("ResizeColumn");
radio_cursor_resize_column.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::ResizeColumn);
+ window->set_override_cursor(Gfx::StandardCursor::ResizeColumn);
};
auto& radio_cursor_resize_row = cursor_group_box.add<GUI::RadioButton>("ResizeRow");
radio_cursor_resize_row.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::ResizeRow);
+ window->set_override_cursor(Gfx::StandardCursor::ResizeRow);
};
auto& radio_cursor_hand = cursor_group_box.add<GUI::RadioButton>("Hand");
radio_cursor_hand.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::Hand);
+ window->set_override_cursor(Gfx::StandardCursor::Hand);
};
auto& radio_cursor_help = cursor_group_box.add<GUI::RadioButton>("Help");
radio_cursor_help.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::Help);
+ window->set_override_cursor(Gfx::StandardCursor::Help);
};
auto& radio_cursor_drag = cursor_group_box.add<GUI::RadioButton>("Drag");
radio_cursor_drag.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::Drag);
+ window->set_override_cursor(Gfx::StandardCursor::Drag);
};
auto& radio_cursor_move = cursor_group_box.add<GUI::RadioButton>("Move");
radio_cursor_move.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::Move);
+ window->set_override_cursor(Gfx::StandardCursor::Move);
};
auto& radio_cursor_wait = cursor_group_box.add<GUI::RadioButton>("Wait");
radio_cursor_wait.on_checked = [&](bool) {
- window->set_override_cursor(GUI::StandardCursor::Wait);
+ window->set_override_cursor(Gfx::StandardCursor::Wait);
};
app->set_menubar(move(menubar));
diff --git a/DevTools/HackStudio/Editor.cpp b/DevTools/HackStudio/Editor.cpp
index 322ba6220c..cfd660e275 100644
--- a/DevTools/HackStudio/Editor.cpp
+++ b/DevTools/HackStudio/Editor.cpp
@@ -209,9 +209,9 @@ void Editor::mousemove_event(GUI::MouseEvent& event)
auto ruler_line_rect = ruler_content_rect(text_position.line());
auto hovering_lines_ruler = (event.position().x() < ruler_line_rect.width());
if (hovering_lines_ruler && !is_in_drag_select())
- window()->set_override_cursor(GUI::StandardCursor::Arrow);
+ window()->set_override_cursor(Gfx::StandardCursor::Arrow);
else if (m_hovering_editor)
- window()->set_override_cursor(m_hovering_link && m_holding_ctrl ? GUI::StandardCursor::Hand : GUI::StandardCursor::IBeam);
+ window()->set_override_cursor(m_hovering_link && m_holding_ctrl ? Gfx::StandardCursor::Hand : Gfx::StandardCursor::IBeam);
for (auto& span : document().spans()) {
if (span.range.contains(m_previous_text_position) && !span.range.contains(text_position)) {
diff --git a/DevTools/VisualBuilder/VBForm.cpp b/DevTools/VisualBuilder/VBForm.cpp
index d56dc82702..148de9d3b5 100644
--- a/DevTools/VisualBuilder/VBForm.cpp
+++ b/DevTools/VisualBuilder/VBForm.cpp
@@ -497,22 +497,22 @@ void VBForm::set_cursor_type_from_grabber(Direction grabber)
switch (grabber) {
case Direction::Up:
case Direction::Down:
- window()->set_override_cursor(GUI::StandardCursor::ResizeVertical);
+ window()->set_override_cursor(Gfx::StandardCursor::ResizeVertical);
break;
case Direction::Left:
case Direction::Right:
- window()->set_override_cursor(GUI::StandardCursor::ResizeHorizontal);
+ window()->set_override_cursor(Gfx::StandardCursor::ResizeHorizontal);
break;
case Direction::UpLeft:
case Direction::DownRight:
- window()->set_override_cursor(GUI::StandardCursor::ResizeDiagonalTLBR);
+ window()->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR);
break;
case Direction::UpRight:
case Direction::DownLeft:
- window()->set_override_cursor(GUI::StandardCursor::ResizeDiagonalBLTR);
+ window()->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalBLTR);
break;
case Direction::None:
- window()->set_override_cursor(GUI::StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
break;
}
diff --git a/Libraries/LibGUI/ColorInput.cpp b/Libraries/LibGUI/ColorInput.cpp
index b68d4b3862..3f3ebd197e 100644
--- a/Libraries/LibGUI/ColorInput.cpp
+++ b/Libraries/LibGUI/ColorInput.cpp
@@ -100,11 +100,11 @@ void ColorInput::mouseup_event(MouseEvent& event)
void ColorInput::mousemove_event(MouseEvent& event)
{
if (color_rect().contains(event.position())) {
- window()->set_override_cursor(StandardCursor::Hand);
+ window()->set_override_cursor(Gfx::StandardCursor::Hand);
event.accept();
return;
} else {
- window()->set_override_cursor(StandardCursor::IBeam);
+ window()->set_override_cursor(Gfx::StandardCursor::IBeam);
}
TextEditor::mousemove_event(event);
diff --git a/Libraries/LibGUI/HeaderView.cpp b/Libraries/LibGUI/HeaderView.cpp
index 99bd38fdec..6b3495e836 100644
--- a/Libraries/LibGUI/HeaderView.cpp
+++ b/Libraries/LibGUI/HeaderView.cpp
@@ -180,7 +180,7 @@ void HeaderView::mousemove_event(MouseEvent& event)
bool found_hovered_header = false;
for (int i = 0; i < section_count; ++i) {
if (section_resize_grabbable_rect(i).contains(event.position())) {
- window()->set_override_cursor(StandardCursor::ResizeColumn);
+ window()->set_override_cursor(Gfx::StandardCursor::ResizeColumn);
set_hovered_section(-1);
return;
}
@@ -192,7 +192,7 @@ void HeaderView::mousemove_event(MouseEvent& event)
if (!found_hovered_header)
set_hovered_section(-1);
}
- window()->set_override_cursor(StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
}
void HeaderView::mouseup_event(MouseEvent& event)
@@ -200,7 +200,7 @@ void HeaderView::mouseup_event(MouseEvent& event)
if (event.button() == MouseButton::Left) {
if (m_in_section_resize) {
if (!section_resize_grabbable_rect(m_resizing_section).contains(event.position()))
- window()->set_override_cursor(StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
m_in_section_resize = false;
return;
}
@@ -337,7 +337,7 @@ void HeaderView::leave_event(Core::Event& event)
{
Widget::leave_event(event);
set_hovered_section(-1);
- window()->set_override_cursor(StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
}
Gfx::TextAlignment HeaderView::section_alignment(int section) const
diff --git a/Libraries/LibGUI/ResizeCorner.cpp b/Libraries/LibGUI/ResizeCorner.cpp
index bf12e6dee3..e3fda70ccc 100644
--- a/Libraries/LibGUI/ResizeCorner.cpp
+++ b/Libraries/LibGUI/ResizeCorner.cpp
@@ -112,13 +112,13 @@ void ResizeCorner::mousedown_event(MouseEvent& event)
void ResizeCorner::enter_event(Core::Event& event)
{
- window()->set_override_cursor(StandardCursor::ResizeDiagonalTLBR);
+ window()->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR);
Widget::enter_event(event);
}
void ResizeCorner::leave_event(Core::Event& event)
{
- window()->set_override_cursor(StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
Widget::leave_event(event);
}
diff --git a/Libraries/LibGUI/Splitter.cpp b/Libraries/LibGUI/Splitter.cpp
index 665f84d1b9..b4c5777278 100644
--- a/Libraries/LibGUI/Splitter.cpp
+++ b/Libraries/LibGUI/Splitter.cpp
@@ -62,12 +62,12 @@ void Splitter::override_cursor(bool do_override)
{
if (do_override) {
if (!m_overriding_cursor) {
- window()->set_override_cursor(m_orientation == Orientation::Horizontal ? StandardCursor::ResizeColumn : StandardCursor::ResizeRow);
+ window()->set_override_cursor(m_orientation == Orientation::Horizontal ? Gfx::StandardCursor::ResizeColumn : Gfx::StandardCursor::ResizeRow);
m_overriding_cursor = true;
}
} else {
if (m_overriding_cursor) {
- window()->set_override_cursor(StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
m_overriding_cursor = false;
}
}
@@ -198,7 +198,7 @@ void Splitter::mouseup_event(MouseEvent& event)
m_first_resizee = nullptr;
m_second_resizee = nullptr;
if (!rect().contains(event.position()))
- window()->set_override_cursor(StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
}
}
diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp
index 8384358d4b..02d9216d70 100644
--- a/Libraries/LibGUI/TextEditor.cpp
+++ b/Libraries/LibGUI/TextEditor.cpp
@@ -1343,7 +1343,7 @@ void TextEditor::enter_event(Core::Event&)
{
ASSERT(window());
if (!is_displayonly())
- window()->set_override_cursor(StandardCursor::IBeam);
+ window()->set_override_cursor(Gfx::StandardCursor::IBeam);
m_automatic_selection_scroll_timer->stop();
}
@@ -1351,7 +1351,7 @@ void TextEditor::enter_event(Core::Event&)
void TextEditor::leave_event(Core::Event&)
{
ASSERT(window());
- window()->set_override_cursor(StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
if (m_in_drag_select)
m_automatic_selection_scroll_timer->start();
diff --git a/Libraries/LibGUI/Window.cpp b/Libraries/LibGUI/Window.cpp
index 72a6885b54..d8c2c1de5d 100644
--- a/Libraries/LibGUI/Window.cpp
+++ b/Libraries/LibGUI/Window.cpp
@@ -93,7 +93,7 @@ void Window::show()
auto* parent_window = find_parent_window();
- m_override_cursor = StandardCursor::None;
+ m_override_cursor = Gfx::StandardCursor::None;
auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateWindow>(
m_rect_when_windowless,
!m_moved_by_client,
@@ -138,7 +138,7 @@ void Window::server_did_destroy()
m_pending_paint_event_rects.clear();
m_back_bitmap = nullptr;
m_front_bitmap = nullptr;
- m_override_cursor = StandardCursor::None;
+ m_override_cursor = Gfx::StandardCursor::None;
}
void Window::hide()
@@ -226,7 +226,7 @@ void Window::set_window_type(WindowType window_type)
m_window_type = window_type;
}
-void Window::set_override_cursor(StandardCursor cursor)
+void Window::set_override_cursor(Gfx::StandardCursor cursor)
{
if (!is_visible())
return;
diff --git a/Libraries/LibGUI/Window.h b/Libraries/LibGUI/Window.h
index 88b7b39fa6..0249738802 100644
--- a/Libraries/LibGUI/Window.h
+++ b/Libraries/LibGUI/Window.h
@@ -36,26 +36,10 @@
#include <LibGfx/Color.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Rect.h>
+#include <LibGfx/StandardCursor.h>
namespace GUI {
-enum class StandardCursor {
- None = 0,
- Arrow,
- IBeam,
- ResizeHorizontal,
- ResizeVertical,
- ResizeDiagonalTLBR,
- ResizeDiagonalBLTR,
- ResizeColumn,
- ResizeRow,
- Hand,
- Help,
- Drag,
- Move,
- Wait,
-};
-
class Window : public Core::Object {
C_OBJECT(Window)
public:
@@ -184,7 +168,7 @@ public:
void set_no_resize_aspect_ratio() { set_resize_aspect_ratio({}); }
void set_resize_aspect_ratio(const Optional<Gfx::IntSize>& ratio);
- void set_override_cursor(StandardCursor);
+ void set_override_cursor(Gfx::StandardCursor);
void set_override_cursor(const Gfx::Bitmap&);
void set_icon(const Gfx::Bitmap*);
@@ -257,7 +241,7 @@ private:
Gfx::IntSize m_base_size;
Color m_background_color { Color::WarmGray };
WindowType m_window_type { WindowType::Normal };
- StandardCursor m_override_cursor { StandardCursor::None };
+ Gfx::StandardCursor m_override_cursor { Gfx::StandardCursor::None };
bool m_is_active { false };
bool m_is_active_input { false };
bool m_has_alpha_channel { false };
diff --git a/Libraries/LibGfx/StandardCursor.h b/Libraries/LibGfx/StandardCursor.h
new file mode 100644
index 0000000000..09a8206c01
--- /dev/null
+++ b/Libraries/LibGfx/StandardCursor.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace Gfx {
+
+enum class StandardCursor {
+ None = 0,
+ Arrow,
+ IBeam,
+ ResizeHorizontal,
+ ResizeVertical,
+ ResizeDiagonalTLBR,
+ ResizeDiagonalBLTR,
+ ResizeColumn,
+ ResizeRow,
+ Hand,
+ Help,
+ Drag,
+ Move,
+ Wait,
+};
+
+}
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp
index 8e5483acac..83d4bd614b 100644
--- a/Libraries/LibVT/TerminalWidget.cpp
+++ b/Libraries/LibVT/TerminalWidget.cpp
@@ -629,9 +629,9 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
m_hovered_href = {};
}
if (!m_hovered_href.is_empty())
- window()->set_override_cursor(GUI::StandardCursor::Hand);
+ window()->set_override_cursor(Gfx::StandardCursor::Hand);
else
- window()->set_override_cursor(GUI::StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
update();
}
@@ -667,7 +667,7 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
void TerminalWidget::leave_event(Core::Event&)
{
- window()->set_override_cursor(GUI::StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
bool should_update = !m_hovered_href.is_empty();
m_hovered_href = {};
m_hovered_href_id = {};
diff --git a/Libraries/LibWeb/InProcessWebView.cpp b/Libraries/LibWeb/InProcessWebView.cpp
index 765b76a6b7..747a06b0cf 100644
--- a/Libraries/LibWeb/InProcessWebView.cpp
+++ b/Libraries/LibWeb/InProcessWebView.cpp
@@ -150,7 +150,7 @@ void InProcessWebView::page_did_change_selection()
update();
}
-void InProcessWebView::page_did_request_cursor_change(GUI::StandardCursor cursor)
+void InProcessWebView::page_did_request_cursor_change(Gfx::StandardCursor cursor)
{
if (window())
window()->set_override_cursor(cursor);
@@ -358,7 +358,7 @@ void InProcessWebView::load_html(const StringView& html, const URL& url)
bool InProcessWebView::load(const URL& url)
{
if (window())
- window()->set_override_cursor(GUI::StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
return page().main_frame().loader().load(url, FrameLoader::Type::Navigation);
}
@@ -378,7 +378,7 @@ LayoutDocument* InProcessWebView::layout_root()
void InProcessWebView::page_did_request_scroll_into_view(const Gfx::IntRect& rect)
{
scroll_into_view(rect, true, true);
- window()->set_override_cursor(GUI::StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
}
void InProcessWebView::load_empty_document()
diff --git a/Libraries/LibWeb/InProcessWebView.h b/Libraries/LibWeb/InProcessWebView.h
index c8a78dd6b5..544079d1d8 100644
--- a/Libraries/LibWeb/InProcessWebView.h
+++ b/Libraries/LibWeb/InProcessWebView.h
@@ -91,7 +91,7 @@ private:
virtual void page_did_set_document_in_main_frame(DOM::Document*) override;
virtual void page_did_start_loading(const URL&) override;
virtual void page_did_change_selection() override;
- virtual void page_did_request_cursor_change(GUI::StandardCursor) override;
+ virtual void page_did_request_cursor_change(Gfx::StandardCursor) override;
virtual void page_did_request_context_menu(const Gfx::IntPoint&) override;
virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const URL&, const String& target, unsigned modifiers) override;
virtual void page_did_click_link(const URL&, const String& target, unsigned modifiers) override;
diff --git a/Libraries/LibWeb/OutOfProcessWebView.cpp b/Libraries/LibWeb/OutOfProcessWebView.cpp
index fdd4ac38f1..443bea72b5 100644
--- a/Libraries/LibWeb/OutOfProcessWebView.cpp
+++ b/Libraries/LibWeb/OutOfProcessWebView.cpp
@@ -138,7 +138,7 @@ void OutOfProcessWebView::notify_server_did_request_scroll_into_view(Badge<WebCo
void OutOfProcessWebView::notify_server_did_hover_link(Badge<WebContentClient>, const URL& url)
{
if (window())
- window()->set_override_cursor(GUI::StandardCursor::Hand);
+ window()->set_override_cursor(Gfx::StandardCursor::Hand);
if (on_link_hover)
on_link_hover(url);
}
@@ -146,7 +146,7 @@ void OutOfProcessWebView::notify_server_did_hover_link(Badge<WebContentClient>,
void OutOfProcessWebView::notify_server_did_unhover_link(Badge<WebContentClient>)
{
if (window())
- window()->set_override_cursor(GUI::StandardCursor::None);
+ window()->set_override_cursor(Gfx::StandardCursor::None);
if (on_link_hover)
on_link_hover({});
}
diff --git a/Libraries/LibWeb/Page/EventHandler.cpp b/Libraries/LibWeb/Page/EventHandler.cpp
index d9623b8105..32b750a821 100644
--- a/Libraries/LibWeb/Page/EventHandler.cpp
+++ b/Libraries/LibWeb/Page/EventHandler.cpp
@@ -216,11 +216,11 @@ bool EventHandler::handle_mousemove(const Gfx::IntPoint& position, unsigned butt
}
if (is_hovering_link)
- page_client.page_did_request_cursor_change(GUI::StandardCursor::Hand);
+ page_client.page_did_request_cursor_change(Gfx::StandardCursor::Hand);
else if (is_hovering_text)
- page_client.page_did_request_cursor_change(GUI::StandardCursor::IBeam);
+ page_client.page_did_request_cursor_change(Gfx::StandardCursor::IBeam);
else
- page_client.page_did_request_cursor_change(GUI::StandardCursor::None);
+ page_client.page_did_request_cursor_change(Gfx::StandardCursor::None);
if (hovered_node_changed) {
RefPtr<HTML::HTMLElement> hovered_html_element = document.hovered_node() ? document.hovered_node()->enclosing_html_element() : nullptr;
diff --git a/Libraries/LibWeb/Page/Page.h b/Libraries/LibWeb/Page/Page.h
index b686b943c4..1af2fec572 100644
--- a/Libraries/LibWeb/Page/Page.h
+++ b/Libraries/LibWeb/Page/Page.h
@@ -82,7 +82,7 @@ public:
virtual void page_did_change_title(const String&) { }
virtual void page_did_start_loading(const URL&) { }
virtual void page_did_change_selection() { }
- virtual void page_did_request_cursor_change(GUI::StandardCursor) { }
+ virtual void page_did_request_cursor_change(Gfx::StandardCursor) { }
virtual void page_did_request_context_menu(const Gfx::IntPoint&) { }
virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
virtual void page_did_click_link(const URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
diff --git a/Services/WindowServer/ClientConnection.cpp b/Services/WindowServer/ClientConnection.cpp
index 5f1e13f76b..5a60e792ea 100644
--- a/Services/WindowServer/ClientConnection.cpp
+++ b/Services/WindowServer/ClientConnection.cpp
@@ -610,7 +610,7 @@ OwnPtr<Messages::WindowServer::SetWindowOverrideCursorResponse> ClientConnection
return nullptr;
}
auto& window = *(*it).value;
- window.set_override_cursor(Cursor::create((StandardCursor)message.cursor_type()));
+ window.set_override_cursor(Cursor::create((Gfx::StandardCursor)message.cursor_type()));
Compositor::the().invalidate_cursor();
return make<Messages::WindowServer::SetWindowOverrideCursorResponse>();
}
diff --git a/Services/WindowServer/Cursor.cpp b/Services/WindowServer/Cursor.cpp
index 876b92634e..c1c34df804 100644
--- a/Services/WindowServer/Cursor.cpp
+++ b/Services/WindowServer/Cursor.cpp
@@ -49,36 +49,36 @@ NonnullRefPtr<Cursor> Cursor::create(NonnullRefPtr<Gfx::Bitmap>&& bitmap, const
return adopt(*new Cursor(move(bitmap), hotspot));
}
-RefPtr<Cursor> Cursor::create(StandardCursor standard_cursor)
+RefPtr<Cursor> Cursor::create(Gfx::StandardCursor standard_cursor)
{
switch (standard_cursor) {
- case StandardCursor::None:
+ case Gfx::StandardCursor::None:
return nullptr;
- case StandardCursor::Arrow:
+ case Gfx::StandardCursor::Arrow:
return WindowManager::the().arrow_cursor();
- case StandardCursor::IBeam:
+ case Gfx::StandardCursor::IBeam:
return WindowManager::the().i_beam_cursor();
- case StandardCursor::ResizeHorizontal:
+ case Gfx::StandardCursor::ResizeHorizontal:
return WindowManager::the().resize_horizontally_cursor();
- case StandardCursor::ResizeVertical:
+ case Gfx::StandardCursor::ResizeVertical:
return WindowManager::the().resize_vertically_cursor();
- case StandardCursor::ResizeDiagonalTLBR:
+ case Gfx::StandardCursor::ResizeDiagonalTLBR:
return WindowManager::the().resize_diagonally_tlbr_cursor();
- case StandardCursor::ResizeDiagonalBLTR:
+ case Gfx::StandardCursor::ResizeDiagonalBLTR:
return WindowManager::the().resize_diagonally_bltr_cursor();
- case StandardCursor::ResizeColumn:
+ case Gfx::StandardCursor::ResizeColumn:
return WindowManager::the().resize_column_cursor();
- case StandardCursor::ResizeRow:
+ case Gfx::StandardCursor::ResizeRow:
return WindowManager::the().resize_row_cursor();
- case StandardCursor::Hand:
+ case Gfx::StandardCursor::Hand:
return WindowManager::the().hand_cursor();
- case StandardCursor::Help:
+ case Gfx::StandardCursor::Help:
return WindowManager::the().help_cursor();
- case StandardCursor::Drag:
+ case Gfx::StandardCursor::Drag:
return WindowManager::the().drag_cursor();
- case StandardCursor::Move:
+ case Gfx::StandardCursor::Move:
return WindowManager::the().move_cursor();
- case StandardCursor::Wait:
+ case Gfx::StandardCursor::Wait:
return WindowManager::the().wait_cursor();
}
ASSERT_NOT_REACHED();
diff --git a/Services/WindowServer/Cursor.h b/Services/WindowServer/Cursor.h
index c0b6f1aed3..384ba357b6 100644
--- a/Services/WindowServer/Cursor.h
+++ b/Services/WindowServer/Cursor.h
@@ -27,31 +27,15 @@
#pragma once
#include <LibGfx/Bitmap.h>
+#include <LibGfx/StandardCursor.h>
namespace WindowServer {
-enum class StandardCursor {
- None = 0,
- Arrow,
- IBeam,
- ResizeHorizontal,
- ResizeVertical,
- ResizeDiagonalTLBR,
- ResizeDiagonalBLTR,
- ResizeColumn,
- ResizeRow,
- Hand,
- Help,
- Drag,
- Move,
- Wait,
-};
-
class Cursor : public RefCounted<Cursor> {
public:
static NonnullRefPtr<Cursor> create(NonnullRefPtr<Gfx::Bitmap>&&, const Gfx::IntPoint& hotspot);
static NonnullRefPtr<Cursor> create(NonnullRefPtr<Gfx::Bitmap>&&);
- static RefPtr<Cursor> create(StandardCursor);
+ static RefPtr<Cursor> create(Gfx::StandardCursor);
~Cursor();
Gfx::IntPoint hotspot() const { return m_hotspot; }