1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +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

@ -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_x = text_start_x + (bytes_per_row() * character_width());
auto text_end_y = text_start_y + 5 + (total_rows() * line_height()); auto text_end_y = text_start_y + 5 + (total_rows() * line_height());
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
if ((absolute_x >= hex_start_x && absolute_x <= hex_end_x if ((absolute_x >= hex_start_x && absolute_x <= hex_end_x
&& absolute_y >= hex_start_y && absolute_y <= hex_end_y) && absolute_y >= hex_start_y && absolute_y <= hex_end_y)
|| (absolute_x >= text_start_x && absolute_x <= text_end_x || (absolute_x >= text_start_x && absolute_x <= text_end_x
&& absolute_y >= text_start_y && absolute_y <= text_end_y)) { && absolute_y >= text_start_y && absolute_y <= text_end_y)) {
window()->set_override_cursor(Gfx::StandardCursor::IBeam); window()->set_cursor(Gfx::StandardCursor::IBeam);
} }
if (m_in_drag_select) { if (m_in_drag_select) {
@ -585,5 +585,5 @@ void HexEditor::paint_event(GUI::PaintEvent& event)
void HexEditor::leave_event(Core::Event&) void HexEditor::leave_event(Core::Event&)
{ {
ASSERT(window()); ASSERT(window());
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
} }

View file

@ -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 }; Gfx::IntRect c = { rect().x() + 7, rect().y() + 4, rect().width() - 14, rect().height() - 14 };
if (c.contains(event.position())) { if (c.contains(event.position())) {
window()->set_override_cursor(Gfx::StandardCursor::Hand); window()->set_cursor(Gfx::StandardCursor::Hand);
return; return;
} }
window()->set_override_cursor(Gfx::StandardCursor::Arrow); window()->set_cursor(Gfx::StandardCursor::Arrow);
AbstractButton::mousemove_event(event); AbstractButton::mousemove_event(event);
} }
void KeyButton::leave_event(Core::Event& event) void KeyButton::leave_event(Core::Event& event)
{ {
window()->set_override_cursor(Gfx::StandardCursor::Arrow); window()->set_cursor(Gfx::StandardCursor::Arrow);
AbstractButton::leave_event(event); AbstractButton::leave_event(event);
} }

View file

@ -52,7 +52,7 @@ void MoveTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEven
m_layer_being_moved = layer; m_layer_being_moved = layer;
m_event_origin = image_event.position(); m_event_origin = image_event.position();
m_layer_origin = layer.location(); m_layer_origin = layer.location();
m_editor->window()->set_override_cursor(Gfx::StandardCursor::Move); m_editor->window()->set_cursor(Gfx::StandardCursor::Move);
} }
void MoveTool::on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent& image_event) 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) if (event.button() != GUI::MouseButton::Left)
return; return;
m_layer_being_moved = nullptr; m_layer_being_moved = nullptr;
m_editor->window()->set_override_cursor(Gfx::StandardCursor::None); m_editor->window()->set_cursor(Gfx::StandardCursor::None);
} }
void MoveTool::on_keydown(GUI::KeyEvent& event) void MoveTool::on_keydown(GUI::KeyEvent& event)

View file

@ -515,59 +515,59 @@ int main(int argc, char** argv)
auto& radio_cursor_none = cursor_group_box.add<GUI::RadioButton>("None"); auto& radio_cursor_none = cursor_group_box.add<GUI::RadioButton>("None");
radio_cursor_none.set_checked(true); radio_cursor_none.set_checked(true);
radio_cursor_none.on_checked = [&](bool) { radio_cursor_none.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::None); window->set_cursor(Gfx::StandardCursor::None);
}; };
auto& radio_cursor_arrow = cursor_group_box.add<GUI::RadioButton>("Arrow"); auto& radio_cursor_arrow = cursor_group_box.add<GUI::RadioButton>("Arrow");
radio_cursor_arrow.on_checked = [&](bool) { radio_cursor_arrow.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::Arrow); window->set_cursor(Gfx::StandardCursor::Arrow);
}; };
auto& radio_cursor_i_beam = cursor_group_box.add<GUI::RadioButton>("IBeam"); auto& radio_cursor_i_beam = cursor_group_box.add<GUI::RadioButton>("IBeam");
radio_cursor_i_beam.on_checked = [&](bool) { radio_cursor_i_beam.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::IBeam); window->set_cursor(Gfx::StandardCursor::IBeam);
}; };
auto& radio_cursor_resize_horizontal = cursor_group_box.add<GUI::RadioButton>("ResizeHorizontal"); auto& radio_cursor_resize_horizontal = cursor_group_box.add<GUI::RadioButton>("ResizeHorizontal");
radio_cursor_resize_horizontal.on_checked = [&](bool) { radio_cursor_resize_horizontal.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::ResizeHorizontal); window->set_cursor(Gfx::StandardCursor::ResizeHorizontal);
}; };
auto& radio_cursor_resize_vertical = cursor_group_box.add<GUI::RadioButton>("ResizeVertical"); auto& radio_cursor_resize_vertical = cursor_group_box.add<GUI::RadioButton>("ResizeVertical");
radio_cursor_resize_vertical.on_checked = [&](bool) { radio_cursor_resize_vertical.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::ResizeVertical); window->set_cursor(Gfx::StandardCursor::ResizeVertical);
}; };
auto& radio_cursor_resize_diagonal_tlbr = cursor_group_box.add<GUI::RadioButton>("ResizeDiagonalTLBR"); auto& radio_cursor_resize_diagonal_tlbr = cursor_group_box.add<GUI::RadioButton>("ResizeDiagonalTLBR");
radio_cursor_resize_diagonal_tlbr.on_checked = [&](bool) { radio_cursor_resize_diagonal_tlbr.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR); window->set_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR);
}; };
auto& radio_cursor_resize_diagonal_bltr = cursor_group_box.add<GUI::RadioButton>("ResizeDiagonalBLTR"); auto& radio_cursor_resize_diagonal_bltr = cursor_group_box.add<GUI::RadioButton>("ResizeDiagonalBLTR");
radio_cursor_resize_diagonal_bltr.on_checked = [&](bool) { radio_cursor_resize_diagonal_bltr.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalBLTR); window->set_cursor(Gfx::StandardCursor::ResizeDiagonalBLTR);
}; };
auto& radio_cursor_resize_column = cursor_group_box.add<GUI::RadioButton>("ResizeColumn"); auto& radio_cursor_resize_column = cursor_group_box.add<GUI::RadioButton>("ResizeColumn");
radio_cursor_resize_column.on_checked = [&](bool) { radio_cursor_resize_column.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::ResizeColumn); window->set_cursor(Gfx::StandardCursor::ResizeColumn);
}; };
auto& radio_cursor_resize_row = cursor_group_box.add<GUI::RadioButton>("ResizeRow"); auto& radio_cursor_resize_row = cursor_group_box.add<GUI::RadioButton>("ResizeRow");
radio_cursor_resize_row.on_checked = [&](bool) { radio_cursor_resize_row.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::ResizeRow); window->set_cursor(Gfx::StandardCursor::ResizeRow);
}; };
auto& radio_cursor_hand = cursor_group_box.add<GUI::RadioButton>("Hand"); auto& radio_cursor_hand = cursor_group_box.add<GUI::RadioButton>("Hand");
radio_cursor_hand.on_checked = [&](bool) { radio_cursor_hand.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::Hand); window->set_cursor(Gfx::StandardCursor::Hand);
}; };
auto& radio_cursor_help = cursor_group_box.add<GUI::RadioButton>("Help"); auto& radio_cursor_help = cursor_group_box.add<GUI::RadioButton>("Help");
radio_cursor_help.on_checked = [&](bool) { radio_cursor_help.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::Help); window->set_cursor(Gfx::StandardCursor::Help);
}; };
auto& radio_cursor_drag = cursor_group_box.add<GUI::RadioButton>("Drag"); auto& radio_cursor_drag = cursor_group_box.add<GUI::RadioButton>("Drag");
radio_cursor_drag.on_checked = [&](bool) { radio_cursor_drag.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::Drag); window->set_cursor(Gfx::StandardCursor::Drag);
}; };
auto& radio_cursor_move = cursor_group_box.add<GUI::RadioButton>("Move"); auto& radio_cursor_move = cursor_group_box.add<GUI::RadioButton>("Move");
radio_cursor_move.on_checked = [&](bool) { radio_cursor_move.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::Move); window->set_cursor(Gfx::StandardCursor::Move);
}; };
auto& radio_cursor_wait = cursor_group_box.add<GUI::RadioButton>("Wait"); auto& radio_cursor_wait = cursor_group_box.add<GUI::RadioButton>("Wait");
radio_cursor_wait.on_checked = [&](bool) { radio_cursor_wait.on_checked = [&](bool) {
window->set_override_cursor(Gfx::StandardCursor::Wait); window->set_cursor(Gfx::StandardCursor::Wait);
}; };
app->set_menubar(move(menubar)); app->set_menubar(move(menubar));

View file

@ -209,9 +209,9 @@ void Editor::mousemove_event(GUI::MouseEvent& event)
auto ruler_line_rect = ruler_content_rect(text_position.line()); auto ruler_line_rect = ruler_content_rect(text_position.line());
auto hovering_lines_ruler = (event.position().x() < ruler_line_rect.width()); auto hovering_lines_ruler = (event.position().x() < ruler_line_rect.width());
if (hovering_lines_ruler && !is_in_drag_select()) if (hovering_lines_ruler && !is_in_drag_select())
window()->set_override_cursor(Gfx::StandardCursor::Arrow); window()->set_cursor(Gfx::StandardCursor::Arrow);
else if (m_hovering_editor) else if (m_hovering_editor)
window()->set_override_cursor(m_hovering_link && m_holding_ctrl ? Gfx::StandardCursor::Hand : Gfx::StandardCursor::IBeam); window()->set_cursor(m_hovering_link && m_holding_ctrl ? Gfx::StandardCursor::Hand : Gfx::StandardCursor::IBeam);
for (auto& span : document().spans()) { for (auto& span : document().spans()) {
if (span.range.contains(m_previous_text_position) && !span.range.contains(text_position)) { if (span.range.contains(m_previous_text_position) && !span.range.contains(text_position)) {

View file

@ -497,22 +497,22 @@ void VBForm::set_cursor_type_from_grabber(Direction grabber)
switch (grabber) { switch (grabber) {
case Direction::Up: case Direction::Up:
case Direction::Down: case Direction::Down:
window()->set_override_cursor(Gfx::StandardCursor::ResizeVertical); window()->set_cursor(Gfx::StandardCursor::ResizeVertical);
break; break;
case Direction::Left: case Direction::Left:
case Direction::Right: case Direction::Right:
window()->set_override_cursor(Gfx::StandardCursor::ResizeHorizontal); window()->set_cursor(Gfx::StandardCursor::ResizeHorizontal);
break; break;
case Direction::UpLeft: case Direction::UpLeft:
case Direction::DownRight: case Direction::DownRight:
window()->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR); window()->set_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR);
break; break;
case Direction::UpRight: case Direction::UpRight:
case Direction::DownLeft: case Direction::DownLeft:
window()->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalBLTR); window()->set_cursor(Gfx::StandardCursor::ResizeDiagonalBLTR);
break; break;
case Direction::None: case Direction::None:
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
break; break;
} }

View file

@ -100,11 +100,11 @@ void ColorInput::mouseup_event(MouseEvent& event)
void ColorInput::mousemove_event(MouseEvent& event) void ColorInput::mousemove_event(MouseEvent& event)
{ {
if (color_rect().contains(event.position())) { if (color_rect().contains(event.position())) {
window()->set_override_cursor(Gfx::StandardCursor::Hand); window()->set_cursor(Gfx::StandardCursor::Hand);
event.accept(); event.accept();
return; return;
} else { } else {
window()->set_override_cursor(Gfx::StandardCursor::IBeam); window()->set_cursor(Gfx::StandardCursor::IBeam);
} }
TextEditor::mousemove_event(event); TextEditor::mousemove_event(event);

View file

@ -180,7 +180,7 @@ void HeaderView::mousemove_event(MouseEvent& event)
bool found_hovered_header = false; bool found_hovered_header = false;
for (int i = 0; i < section_count; ++i) { for (int i = 0; i < section_count; ++i) {
if (section_resize_grabbable_rect(i).contains(event.position())) { 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); set_hovered_section(-1);
return; return;
} }
@ -192,7 +192,7 @@ void HeaderView::mousemove_event(MouseEvent& event)
if (!found_hovered_header) if (!found_hovered_header)
set_hovered_section(-1); set_hovered_section(-1);
} }
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
} }
void HeaderView::mouseup_event(MouseEvent& event) void HeaderView::mouseup_event(MouseEvent& event)
@ -200,7 +200,7 @@ void HeaderView::mouseup_event(MouseEvent& event)
if (event.button() == MouseButton::Left) { if (event.button() == MouseButton::Left) {
if (m_in_section_resize) { if (m_in_section_resize) {
if (!section_resize_grabbable_rect(m_resizing_section).contains(event.position())) 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; m_in_section_resize = false;
return; return;
} }
@ -337,7 +337,7 @@ void HeaderView::leave_event(Core::Event& event)
{ {
Widget::leave_event(event); Widget::leave_event(event);
set_hovered_section(-1); 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 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) void ResizeCorner::enter_event(Core::Event& event)
{ {
window()->set_override_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR); window()->set_cursor(Gfx::StandardCursor::ResizeDiagonalTLBR);
Widget::enter_event(event); Widget::enter_event(event);
} }
void ResizeCorner::leave_event(Core::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); Widget::leave_event(event);
} }

View file

@ -62,12 +62,12 @@ void Splitter::override_cursor(bool do_override)
{ {
if (do_override) { if (do_override) {
if (!m_overriding_cursor) { 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; m_overriding_cursor = true;
} }
} else { } else {
if (m_overriding_cursor) { if (m_overriding_cursor) {
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
m_overriding_cursor = false; m_overriding_cursor = false;
} }
} }
@ -198,7 +198,7 @@ void Splitter::mouseup_event(MouseEvent& event)
m_first_resizee = nullptr; m_first_resizee = nullptr;
m_second_resizee = nullptr; m_second_resizee = nullptr;
if (!rect().contains(event.position())) 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()); ASSERT(window());
if (!is_displayonly()) if (!is_displayonly())
window()->set_override_cursor(Gfx::StandardCursor::IBeam); window()->set_cursor(Gfx::StandardCursor::IBeam);
m_automatic_selection_scroll_timer->stop(); m_automatic_selection_scroll_timer->stop();
} }
@ -1351,7 +1351,7 @@ void TextEditor::enter_event(Core::Event&)
void TextEditor::leave_event(Core::Event&) void TextEditor::leave_event(Core::Event&)
{ {
ASSERT(window()); ASSERT(window());
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
if (m_in_drag_select) if (m_in_drag_select)
m_automatic_selection_scroll_timer->start(); m_automatic_selection_scroll_timer->start();

View file

@ -93,7 +93,7 @@ void Window::show()
auto* parent_window = find_parent_window(); 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>( auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateWindow>(
m_rect_when_windowless, m_rect_when_windowless,
!m_moved_by_client, !m_moved_by_client,
@ -138,7 +138,7 @@ void Window::server_did_destroy()
m_pending_paint_event_rects.clear(); m_pending_paint_event_rects.clear();
m_back_bitmap = nullptr; m_back_bitmap = nullptr;
m_front_bitmap = nullptr; m_front_bitmap = nullptr;
m_override_cursor = Gfx::StandardCursor::None; m_cursor = Gfx::StandardCursor::None;
} }
void Window::hide() void Window::hide()
@ -226,25 +226,25 @@ void Window::set_window_type(WindowType window_type)
m_window_type = 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()) if (!is_visible())
return; return;
if (!m_custom_cursor && m_override_cursor == cursor) if (!m_custom_cursor && m_cursor == cursor)
return; return;
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowOverrideCursor>(m_window_id, (u32)cursor); WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowCursor>(m_window_id, (u32)cursor);
m_override_cursor = cursor; m_cursor = cursor;
m_custom_cursor = nullptr; m_custom_cursor = nullptr;
} }
void Window::set_override_cursor(const Gfx::Bitmap& cursor) void Window::set_cursor(const Gfx::Bitmap& cursor)
{ {
if (!is_visible()) if (!is_visible())
return; return;
if (&cursor == m_custom_cursor.ptr()) if (&cursor == m_custom_cursor.ptr())
return; return;
m_custom_cursor = &cursor; 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) 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_no_resize_aspect_ratio() { set_resize_aspect_ratio({}); }
void set_resize_aspect_ratio(const Optional<Gfx::IntSize>& ratio); void set_resize_aspect_ratio(const Optional<Gfx::IntSize>& ratio);
void set_override_cursor(Gfx::StandardCursor); void set_cursor(Gfx::StandardCursor);
void set_override_cursor(const Gfx::Bitmap&); void set_cursor(const Gfx::Bitmap&);
void set_icon(const Gfx::Bitmap*); void set_icon(const Gfx::Bitmap*);
void apply_icon(); void apply_icon();
@ -241,7 +241,7 @@ private:
Gfx::IntSize m_base_size; Gfx::IntSize m_base_size;
Color m_background_color { Color::WarmGray }; Color m_background_color { Color::WarmGray };
WindowType m_window_type { WindowType::Normal }; 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 { false };
bool m_is_active_input { false }; bool m_is_active_input { false };
bool m_has_alpha_channel { false }; bool m_has_alpha_channel { false };

View file

@ -629,9 +629,9 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
m_hovered_href = {}; m_hovered_href = {};
} }
if (!m_hovered_href.is_empty()) if (!m_hovered_href.is_empty())
window()->set_override_cursor(Gfx::StandardCursor::Hand); window()->set_cursor(Gfx::StandardCursor::Hand);
else else
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
update(); update();
} }
@ -667,7 +667,7 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
void TerminalWidget::leave_event(Core::Event&) void TerminalWidget::leave_event(Core::Event&)
{ {
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
bool should_update = !m_hovered_href.is_empty(); bool should_update = !m_hovered_href.is_empty();
m_hovered_href = {}; m_hovered_href = {};
m_hovered_href_id = {}; m_hovered_href_id = {};

View file

@ -153,7 +153,7 @@ void InProcessWebView::page_did_change_selection()
void InProcessWebView::page_did_request_cursor_change(Gfx::StandardCursor cursor) void InProcessWebView::page_did_request_cursor_change(Gfx::StandardCursor cursor)
{ {
if (window()) if (window())
window()->set_override_cursor(cursor); window()->set_cursor(cursor);
} }
void InProcessWebView::page_did_request_context_menu(const Gfx::IntPoint& content_position) void InProcessWebView::page_did_request_context_menu(const Gfx::IntPoint& content_position)
@ -358,7 +358,7 @@ void InProcessWebView::load_html(const StringView& html, const URL& url)
bool InProcessWebView::load(const URL& url) bool InProcessWebView::load(const URL& url)
{ {
if (window()) if (window())
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
return page().main_frame().loader().load(url, FrameLoader::Type::Navigation); 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) void InProcessWebView::page_did_request_scroll_into_view(const Gfx::IntRect& rect)
{ {
scroll_into_view(rect, true, true); scroll_into_view(rect, true, true);
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
} }
void InProcessWebView::load_empty_document() void InProcessWebView::load_empty_document()

View file

@ -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) void OutOfProcessWebView::notify_server_did_hover_link(Badge<WebContentClient>, const URL& url)
{ {
if (window()) if (window())
window()->set_override_cursor(Gfx::StandardCursor::Hand); window()->set_cursor(Gfx::StandardCursor::Hand);
if (on_link_hover) if (on_link_hover)
on_link_hover(url); 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>) void OutOfProcessWebView::notify_server_did_unhover_link(Badge<WebContentClient>)
{ {
if (window()) if (window())
window()->set_override_cursor(Gfx::StandardCursor::None); window()->set_cursor(Gfx::StandardCursor::None);
if (on_link_hover) if (on_link_hover)
on_link_hover({}); on_link_hover({});
} }

View file

@ -602,36 +602,36 @@ OwnPtr<Messages::WindowServer::SetGlobalCursorTrackingResponse> ClientConnection
return make<Messages::WindowServer::SetGlobalCursorTrackingResponse>(); return make<Messages::WindowServer::SetGlobalCursorTrackingResponse>();
} }
OwnPtr<Messages::WindowServer::SetWindowOverrideCursorResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowOverrideCursor& message) OwnPtr<Messages::WindowServer::SetWindowCursorResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowCursor& message)
{ {
auto it = m_windows.find(message.window_id()); auto it = m_windows.find(message.window_id());
if (it == m_windows.end()) { if (it == m_windows.end()) {
did_misbehave("SetWindowOverrideCursor: Bad window ID"); did_misbehave("SetWindowCursor: Bad window ID");
return nullptr; return nullptr;
} }
auto& window = *(*it).value; auto& window = *(*it).value;
window.set_override_cursor(Cursor::create((Gfx::StandardCursor)message.cursor_type())); window.set_cursor(Cursor::create((Gfx::StandardCursor)message.cursor_type()));
Compositor::the().invalidate_cursor(); Compositor::the().invalidate_cursor();
return make<Messages::WindowServer::SetWindowOverrideCursorResponse>(); return make<Messages::WindowServer::SetWindowCursorResponse>();
} }
OwnPtr<Messages::WindowServer::SetWindowCustomOverrideCursorResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowCustomOverrideCursor& message) OwnPtr<Messages::WindowServer::SetWindowCustomCursorResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowCustomCursor& message)
{ {
auto it = m_windows.find(message.window_id()); auto it = m_windows.find(message.window_id());
if (it == m_windows.end()) { if (it == m_windows.end()) {
did_misbehave("SetWindowCustomOverrideCursor: Bad window ID"); did_misbehave("SetWindowCustomCursor: Bad window ID");
return nullptr; return nullptr;
} }
auto& window = *(*it).value; auto& window = *(*it).value;
if (!message.cursor().is_valid()) { if (!message.cursor().is_valid()) {
did_misbehave("SetWindowCustomOverrideCursor: Bad cursor"); did_misbehave("SetWindowCustomCursor: Bad cursor");
return nullptr; return nullptr;
} }
window.set_override_cursor(Cursor::create(*message.cursor().bitmap())); window.set_cursor(Cursor::create(*message.cursor().bitmap()));
Compositor::the().invalidate_cursor(); Compositor::the().invalidate_cursor();
return make<Messages::WindowServer::SetWindowCustomOverrideCursorResponse>(); return make<Messages::WindowServer::SetWindowCustomCursorResponse>();
} }
OwnPtr<Messages::WindowServer::SetWindowHasAlphaChannelResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowHasAlphaChannel& message) OwnPtr<Messages::WindowServer::SetWindowHasAlphaChannelResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowHasAlphaChannel& message)
@ -880,7 +880,7 @@ void ClientConnection::set_unresponsive(bool unresponsive)
auto& window = *it.value; auto& window = *it.value;
window.invalidate(); window.invalidate();
if (unresponsive) if (unresponsive)
window.set_override_cursor(WindowManager::the().wait_cursor()); window.set_cursor(WindowManager::the().wait_cursor());
} }
Compositor::the().invalidate_cursor(); Compositor::the().invalidate_cursor();
} }

View file

@ -127,8 +127,8 @@ private:
virtual OwnPtr<Messages::WindowServer::SetWallpaperModeResponse> handle(const Messages::WindowServer::SetWallpaperMode&) override; virtual OwnPtr<Messages::WindowServer::SetWallpaperModeResponse> handle(const Messages::WindowServer::SetWallpaperMode&) override;
virtual OwnPtr<Messages::WindowServer::GetWallpaperResponse> handle(const Messages::WindowServer::GetWallpaper&) override; virtual OwnPtr<Messages::WindowServer::GetWallpaperResponse> handle(const Messages::WindowServer::GetWallpaper&) override;
virtual OwnPtr<Messages::WindowServer::SetResolutionResponse> handle(const Messages::WindowServer::SetResolution&) override; virtual OwnPtr<Messages::WindowServer::SetResolutionResponse> handle(const Messages::WindowServer::SetResolution&) override;
virtual OwnPtr<Messages::WindowServer::SetWindowOverrideCursorResponse> handle(const Messages::WindowServer::SetWindowOverrideCursor&) override; virtual OwnPtr<Messages::WindowServer::SetWindowCursorResponse> handle(const Messages::WindowServer::SetWindowCursor&) override;
virtual OwnPtr<Messages::WindowServer::SetWindowCustomOverrideCursorResponse> handle(const Messages::WindowServer::SetWindowCustomOverrideCursor&) override; virtual OwnPtr<Messages::WindowServer::SetWindowCustomCursorResponse> handle(const Messages::WindowServer::SetWindowCustomCursor&) override;
virtual OwnPtr<Messages::WindowServer::PopupMenuResponse> handle(const Messages::WindowServer::PopupMenu&) override; virtual OwnPtr<Messages::WindowServer::PopupMenuResponse> handle(const Messages::WindowServer::PopupMenu&) override;
virtual OwnPtr<Messages::WindowServer::DismissMenuResponse> handle(const Messages::WindowServer::DismissMenu&) override; virtual OwnPtr<Messages::WindowServer::DismissMenuResponse> handle(const Messages::WindowServer::DismissMenu&) override;
virtual OwnPtr<Messages::WindowServer::SetWindowIconBitmapResponse> handle(const Messages::WindowServer::SetWindowIconBitmap&) override; virtual OwnPtr<Messages::WindowServer::SetWindowIconBitmapResponse> handle(const Messages::WindowServer::SetWindowIconBitmap&) override;

View file

@ -218,8 +218,8 @@ public:
void set_default_icon(); void set_default_icon();
const Cursor* override_cursor() const { return m_override_cursor.ptr(); } const Cursor* cursor() const { return m_cursor.ptr(); }
void set_override_cursor(RefPtr<Cursor>&& cursor) { m_override_cursor = move(cursor); } void set_cursor(RefPtr<Cursor> cursor) { m_cursor = move(cursor); }
void request_update(const Gfx::IntRect&, bool ignore_occlusion = false); void request_update(const Gfx::IntRect&, bool ignore_occlusion = false);
Gfx::DisjointRectSet take_pending_paint_rects() { return move(m_pending_paint_rects); } Gfx::DisjointRectSet take_pending_paint_rects() { return move(m_pending_paint_rects); }
@ -340,7 +340,7 @@ private:
Gfx::IntSize m_size_increment; Gfx::IntSize m_size_increment;
Gfx::IntSize m_base_size; Gfx::IntSize m_base_size;
NonnullRefPtr<Gfx::Bitmap> m_icon; NonnullRefPtr<Gfx::Bitmap> m_icon;
RefPtr<Cursor> m_override_cursor; RefPtr<Cursor> m_cursor;
WindowFrame m_frame; WindowFrame m_frame;
unsigned m_wm_event_mask { 0 }; unsigned m_wm_event_mask { 0 };
Gfx::DisjointRectSet m_pending_paint_rects; Gfx::DisjointRectSet m_pending_paint_rects;

View file

@ -1304,8 +1304,8 @@ const Cursor& WindowManager::active_cursor() const
} }
} }
if (m_hovered_window && m_hovered_window->override_cursor()) if (m_hovered_window && m_hovered_window->cursor())
return *m_hovered_window->override_cursor(); return *m_hovered_window->cursor();
return *m_arrow_cursor; return *m_arrow_cursor;
} }

View file

@ -91,8 +91,8 @@ endpoint WindowServer = 2
SetWindowIconBitmap(i32 window_id, Gfx::ShareableBitmap icon) => () SetWindowIconBitmap(i32 window_id, Gfx::ShareableBitmap icon) => ()
GetWallpaper() => (String path) GetWallpaper() => (String path)
SetWindowOverrideCursor(i32 window_id, i32 cursor_type) => () SetWindowCursor(i32 window_id, i32 cursor_type) => ()
SetWindowCustomOverrideCursor(i32 window_id, Gfx::ShareableBitmap cursor) => () SetWindowCustomCursor(i32 window_id, Gfx::ShareableBitmap cursor) => ()
StartDrag([UTF8] String text, String data_type, String data, i32 bitmap_id, Gfx::IntSize bitmap_size) => (bool started) StartDrag([UTF8] String text, String data_type, String data, i32 bitmap_id, Gfx::IntSize bitmap_size) => (bool started)