1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

LibGUI+WindowServer: Rename window "override cursor" to just "cursor"

Let's just say each window has a cursor, there's not really overriding
going on.
This commit is contained in:
Andreas Kling 2020-09-10 20:55:39 +02:00
parent 40fbdd4e9e
commit b4f307f982
21 changed files with 80 additions and 80 deletions

View file

@ -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(Gfx::StandardCursor::Hand);
window()->set_cursor(Gfx::StandardCursor::Hand);
event.accept();
return;
} else {
window()->set_override_cursor(Gfx::StandardCursor::IBeam);
window()->set_cursor(Gfx::StandardCursor::IBeam);
}
TextEditor::mousemove_event(event);

View file

@ -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(Gfx::StandardCursor::ResizeColumn);
window()->set_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(Gfx::StandardCursor::None);
window()->set_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(Gfx::StandardCursor::None);
window()->set_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(Gfx::StandardCursor::None);
window()->set_cursor(Gfx::StandardCursor::None);
}
Gfx::TextAlignment HeaderView::section_alignment(int section) const

View file

@ -112,13 +112,13 @@ void ResizeCorner::mousedown_event(MouseEvent& event)
void ResizeCorner::enter_event(Core::Event& event)
{
window()->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR);
window()->set_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR);
Widget::enter_event(event);
}
void ResizeCorner::leave_event(Core::Event& event)
{
window()->set_override_cursor(Gfx::StandardCursor::None);
window()->set_cursor(Gfx::StandardCursor::None);
Widget::leave_event(event);
}

View file

@ -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 ? Gfx::StandardCursor::ResizeColumn : Gfx::StandardCursor::ResizeRow);
window()->set_cursor(m_orientation == Orientation::Horizontal ? Gfx::StandardCursor::ResizeColumn : Gfx::StandardCursor::ResizeRow);
m_overriding_cursor = true;
}
} else {
if (m_overriding_cursor) {
window()->set_override_cursor(Gfx::StandardCursor::None);
window()->set_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(Gfx::StandardCursor::None);
window()->set_cursor(Gfx::StandardCursor::None);
}
}

View file

@ -1343,7 +1343,7 @@ void TextEditor::enter_event(Core::Event&)
{
ASSERT(window());
if (!is_displayonly())
window()->set_override_cursor(Gfx::StandardCursor::IBeam);
window()->set_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(Gfx::StandardCursor::None);
window()->set_cursor(Gfx::StandardCursor::None);
if (m_in_drag_select)
m_automatic_selection_scroll_timer->start();

View file

@ -93,7 +93,7 @@ void Window::show()
auto* parent_window = find_parent_window();
m_override_cursor = Gfx::StandardCursor::None;
m_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 = Gfx::StandardCursor::None;
m_cursor = Gfx::StandardCursor::None;
}
void Window::hide()
@ -226,25 +226,25 @@ void Window::set_window_type(WindowType window_type)
m_window_type = window_type;
}
void Window::set_override_cursor(Gfx::StandardCursor cursor)
void Window::set_cursor(Gfx::StandardCursor cursor)
{
if (!is_visible())
return;
if (!m_custom_cursor && m_override_cursor == cursor)
if (!m_custom_cursor && m_cursor == cursor)
return;
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowOverrideCursor>(m_window_id, (u32)cursor);
m_override_cursor = cursor;
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowCursor>(m_window_id, (u32)cursor);
m_cursor = cursor;
m_custom_cursor = nullptr;
}
void Window::set_override_cursor(const Gfx::Bitmap& cursor)
void Window::set_cursor(const Gfx::Bitmap& cursor)
{
if (!is_visible())
return;
if (&cursor == m_custom_cursor.ptr())
return;
m_custom_cursor = &cursor;
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowCustomOverrideCursor>(m_window_id, m_custom_cursor->to_shareable_bitmap(WindowServerConnection::the().server_pid()));
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowCustomCursor>(m_window_id, m_custom_cursor->to_shareable_bitmap(WindowServerConnection::the().server_pid()));
}
void Window::handle_drop_event(DropEvent& event)

View file

@ -168,8 +168,8 @@ 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(Gfx::StandardCursor);
void set_override_cursor(const Gfx::Bitmap&);
void set_cursor(Gfx::StandardCursor);
void set_cursor(const Gfx::Bitmap&);
void set_icon(const Gfx::Bitmap*);
void apply_icon();
@ -241,7 +241,7 @@ private:
Gfx::IntSize m_base_size;
Color m_background_color { Color::WarmGray };
WindowType m_window_type { WindowType::Normal };
Gfx::StandardCursor m_override_cursor { Gfx::StandardCursor::None };
Gfx::StandardCursor m_cursor { Gfx::StandardCursor::None };
bool m_is_active { false };
bool m_is_active_input { false };
bool m_has_alpha_channel { false };