diff options
author | Filiph Sandström <filiph.sandstrom@filfatstudios.com> | 2021-10-27 13:20:27 +0200 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-10-27 22:05:58 +0300 |
commit | d6a072630268eeccee8ce1da0c13fd4a169caa8c (patch) | |
tree | 169e8d0ec79b6c6918a0425986d9c09d9a0b30c7 /Userland/Libraries | |
parent | a6ccf6659a706eb985cf5e62cd8e8db05ab18ab9 (diff) | |
download | serenity-d6a072630268eeccee8ce1da0c13fd4a169caa8c.zip |
Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
Diffstat (limited to 'Userland/Libraries')
29 files changed, 66 insertions, 66 deletions
diff --git a/Userland/Libraries/LibGUI/AbstractButton.cpp b/Userland/Libraries/LibGUI/AbstractButton.cpp index d3f82f345a..3e1c58e96f 100644 --- a/Userland/Libraries/LibGUI/AbstractButton.cpp +++ b/Userland/Libraries/LibGUI/AbstractButton.cpp @@ -96,7 +96,7 @@ void AbstractButton::mousemove_event(MouseEvent& event) { bool is_over = rect().contains(event.position()); m_hovered = is_over; - if (event.buttons() & MouseButton::Left) { + if (event.buttons() & MouseButton::Primary) { bool being_pressed = is_over; if (being_pressed != m_being_pressed) { m_being_pressed = being_pressed; @@ -114,7 +114,7 @@ void AbstractButton::mousemove_event(MouseEvent& event) void AbstractButton::mousedown_event(MouseEvent& event) { - if (event.button() == MouseButton::Left) { + if (event.button() == MouseButton::Primary) { m_being_pressed = true; repaint(); @@ -129,7 +129,7 @@ void AbstractButton::mousedown_event(MouseEvent& event) void AbstractButton::mouseup_event(MouseEvent& event) { - if (event.button() == MouseButton::Left && m_being_pressed) { + if (event.button() == MouseButton::Primary && m_being_pressed) { bool was_auto_repeating = m_auto_repeat_timer->is_active(); m_auto_repeat_timer->stop(); bool was_being_pressed = m_being_pressed; diff --git a/Userland/Libraries/LibGUI/AbstractTableView.cpp b/Userland/Libraries/LibGUI/AbstractTableView.cpp index f3efa24bbb..52d92f4632 100644 --- a/Userland/Libraries/LibGUI/AbstractTableView.cpp +++ b/Userland/Libraries/LibGUI/AbstractTableView.cpp @@ -207,7 +207,7 @@ void AbstractTableView::mousedown_event(MouseEvent& event) if (!model()) return AbstractView::mousedown_event(event); - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return AbstractView::mousedown_event(event); bool is_toggle; diff --git a/Userland/Libraries/LibGUI/AbstractView.cpp b/Userland/Libraries/LibGUI/AbstractView.cpp index 1e71261c28..77eab48f55 100644 --- a/Userland/Libraries/LibGUI/AbstractView.cpp +++ b/Userland/Libraries/LibGUI/AbstractView.cpp @@ -224,7 +224,7 @@ void AbstractView::mousedown_event(MouseEvent& event) if (!model()) return; - if (event.button() == MouseButton::Left) + if (event.button() == MouseButton::Primary) m_left_mousedown_position = event.position(); auto index = index_at_event_position(event.position()); @@ -236,10 +236,10 @@ void AbstractView::mousedown_event(MouseEvent& event) set_cursor(index, SelectionUpdate::Ctrl); } else if (event.modifiers() & Mod_Shift) { set_cursor(index, SelectionUpdate::Shift); - } else if (event.button() == MouseButton::Left && m_selection.contains(index) && !m_model->drag_data_type().is_null()) { + } else if (event.button() == MouseButton::Primary && m_selection.contains(index) && !m_model->drag_data_type().is_null()) { // We might be starting a drag, so don't throw away other selected items yet. m_might_drag = true; - } else if (event.button() == MouseButton::Right) { + } else if (event.button() == MouseButton::Secondary) { set_cursor(index, SelectionUpdate::ClearIfNotSelected); } else { set_cursor(index, SelectionUpdate::Set); @@ -285,7 +285,7 @@ void AbstractView::mousemove_event(MouseEvent& event) if (!m_might_drag) return AbstractScrollableWidget::mousemove_event(event); - if (!(event.buttons() & MouseButton::Left) || m_selection.is_empty()) { + if (!(event.buttons() & MouseButton::Primary) || m_selection.is_empty()) { m_might_drag = false; return AbstractScrollableWidget::mousemove_event(event); } @@ -360,7 +360,7 @@ void AbstractView::doubleclick_event(MouseEvent& event) if (!model()) return; - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; m_might_drag = false; diff --git a/Userland/Libraries/LibGUI/ColorInput.cpp b/Userland/Libraries/LibGUI/ColorInput.cpp index d5420dadbe..383df59025 100644 --- a/Userland/Libraries/LibGUI/ColorInput.cpp +++ b/Userland/Libraries/LibGUI/ColorInput.cpp @@ -59,7 +59,7 @@ void ColorInput::set_color(Color color) void ColorInput::mousedown_event(MouseEvent& event) { - if (event.button() == MouseButton::Left && color_rect().contains(event.position())) { + if (event.button() == MouseButton::Primary && color_rect().contains(event.position())) { m_may_be_color_rect_click = true; return; } @@ -69,7 +69,7 @@ void ColorInput::mousedown_event(MouseEvent& event) void ColorInput::mouseup_event(MouseEvent& event) { - if (event.button() == MouseButton::Left) { + if (event.button() == MouseButton::Primary) { bool is_color_rect_click = m_may_be_color_rect_click && color_rect().contains(event.position()); m_may_be_color_rect_click = false; if (is_color_rect_click) { diff --git a/Userland/Libraries/LibGUI/ColorPicker.cpp b/Userland/Libraries/LibGUI/ColorPicker.cpp index d4e3a0d1ce..d6c02a6408 100644 --- a/Userland/Libraries/LibGUI/ColorPicker.cpp +++ b/Userland/Libraries/LibGUI/ColorPicker.cpp @@ -611,7 +611,7 @@ void ColorField::pick_color_at_position(GUI::MouseEvent& event) void ColorField::mousedown_event(GUI::MouseEvent& event) { - if (event.button() == GUI::MouseButton::Left) { + if (event.button() == GUI::MouseButton::Primary) { m_being_pressed = true; pick_color_at_position(event); } @@ -619,7 +619,7 @@ void ColorField::mousedown_event(GUI::MouseEvent& event) void ColorField::mouseup_event(GUI::MouseEvent& event) { - if (event.button() == GUI::MouseButton::Left) { + if (event.button() == GUI::MouseButton::Primary) { m_being_pressed = false; pick_color_at_position(event); } @@ -627,7 +627,7 @@ void ColorField::mouseup_event(GUI::MouseEvent& event) void ColorField::mousemove_event(GUI::MouseEvent& event) { - if (event.buttons() & GUI::MouseButton::Left) + if (event.buttons() & GUI::MouseButton::Primary) pick_color_at_position(event); } @@ -705,7 +705,7 @@ void ColorSlider::pick_value_at_position(GUI::MouseEvent& event) void ColorSlider::mousedown_event(GUI::MouseEvent& event) { - if (event.button() == GUI::MouseButton::Left) { + if (event.button() == GUI::MouseButton::Primary) { m_being_pressed = true; pick_value_at_position(event); } @@ -713,7 +713,7 @@ void ColorSlider::mousedown_event(GUI::MouseEvent& event) void ColorSlider::mouseup_event(GUI::MouseEvent& event) { - if (event.button() == GUI::MouseButton::Left) { + if (event.button() == GUI::MouseButton::Primary) { m_being_pressed = false; pick_value_at_position(event); } @@ -721,7 +721,7 @@ void ColorSlider::mouseup_event(GUI::MouseEvent& event) void ColorSlider::mousemove_event(GUI::MouseEvent& event) { - if (event.buttons() & GUI::MouseButton::Left) + if (event.buttons() & GUI::MouseButton::Primary) pick_value_at_position(event); } diff --git a/Userland/Libraries/LibGUI/ColumnsView.cpp b/Userland/Libraries/LibGUI/ColumnsView.cpp index d02898b345..3c6b086fa0 100644 --- a/Userland/Libraries/LibGUI/ColumnsView.cpp +++ b/Userland/Libraries/LibGUI/ColumnsView.cpp @@ -246,7 +246,7 @@ void ColumnsView::mousedown_event(MouseEvent& event) if (!model()) return; - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; auto index = index_at_event_position(event.position()); diff --git a/Userland/Libraries/LibGUI/Event.h b/Userland/Libraries/LibGUI/Event.h index 28b328f312..c305e96845 100644 --- a/Userland/Libraries/LibGUI/Event.h +++ b/Userland/Libraries/LibGUI/Event.h @@ -311,8 +311,8 @@ public: enum MouseButton : u8 { None = 0, - Left = 1, - Right = 2, + Primary = 1, + Secondary = 2, Middle = 4, Back = 8, Forward = 16, diff --git a/Userland/Libraries/LibGUI/HeaderView.cpp b/Userland/Libraries/LibGUI/HeaderView.cpp index 29798d8d35..14f40f84a0 100644 --- a/Userland/Libraries/LibGUI/HeaderView.cpp +++ b/Userland/Libraries/LibGUI/HeaderView.cpp @@ -142,7 +142,7 @@ void HeaderView::doubleclick_event(MouseEvent& event) void HeaderView::mousedown_event(MouseEvent& event) { - if (event.button() != GUI::MouseButton::Left) + if (event.button() != GUI::MouseButton::Primary) return; if (!model()) @@ -227,7 +227,7 @@ void HeaderView::mousemove_event(MouseEvent& event) void HeaderView::mouseup_event(MouseEvent& event) { - if (event.button() == MouseButton::Left) { + if (event.button() == MouseButton::Primary) { if (m_in_section_resize) { if (!section_resize_grabbable_rect(m_resizing_section).contains(event.position())) set_override_cursor(Gfx::StandardCursor::None); diff --git a/Userland/Libraries/LibGUI/IconView.cpp b/Userland/Libraries/LibGUI/IconView.cpp index b894c67ca1..8f91d8a339 100644 --- a/Userland/Libraries/LibGUI/IconView.cpp +++ b/Userland/Libraries/LibGUI/IconView.cpp @@ -214,7 +214,7 @@ void IconView::mousedown_event(MouseEvent& event) if (!model()) return AbstractView::mousedown_event(event); - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return AbstractView::mousedown_event(event); auto index = index_at_event_position(event.position()); @@ -239,7 +239,7 @@ void IconView::mousedown_event(MouseEvent& event) void IconView::mouseup_event(MouseEvent& event) { - if (m_rubber_banding && event.button() == MouseButton::Left) { + if (m_rubber_banding && event.button() == MouseButton::Primary) { m_rubber_banding = false; if (m_out_of_view_timer) m_out_of_view_timer->stop(); diff --git a/Userland/Libraries/LibGUI/LinkLabel.cpp b/Userland/Libraries/LibGUI/LinkLabel.cpp index 1135c6e702..2bf199a978 100644 --- a/Userland/Libraries/LibGUI/LinkLabel.cpp +++ b/Userland/Libraries/LibGUI/LinkLabel.cpp @@ -54,7 +54,7 @@ void LinkLabel::mousemove_event(MouseEvent& event) void LinkLabel::mousedown_event(MouseEvent& event) { - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; Label::mousedown_event(event); diff --git a/Userland/Libraries/LibGUI/OpacitySlider.cpp b/Userland/Libraries/LibGUI/OpacitySlider.cpp index 717b2dc7bf..f97d7a0ef4 100644 --- a/Userland/Libraries/LibGUI/OpacitySlider.cpp +++ b/Userland/Libraries/LibGUI/OpacitySlider.cpp @@ -111,7 +111,7 @@ int OpacitySlider::value_at(const Gfx::IntPoint& position) const void OpacitySlider::mousedown_event(MouseEvent& event) { - if (event.button() == MouseButton::Left) { + if (event.button() == MouseButton::Primary) { m_dragging = true; set_value(value_at(event.position())); return; @@ -130,7 +130,7 @@ void OpacitySlider::mousemove_event(MouseEvent& event) void OpacitySlider::mouseup_event(MouseEvent& event) { - if (event.button() == MouseButton::Left) { + if (event.button() == MouseButton::Primary) { m_dragging = false; return; } diff --git a/Userland/Libraries/LibGUI/ResizeCorner.cpp b/Userland/Libraries/LibGUI/ResizeCorner.cpp index d4bb24455f..89fb44a5c6 100644 --- a/Userland/Libraries/LibGUI/ResizeCorner.cpp +++ b/Userland/Libraries/LibGUI/ResizeCorner.cpp @@ -85,7 +85,7 @@ void ResizeCorner::paint_event(PaintEvent& event) void ResizeCorner::mousedown_event(MouseEvent& event) { - if (event.button() == MouseButton::Left) + if (event.button() == MouseButton::Primary) window()->start_interactive_resize(); Widget::mousedown_event(event); } diff --git a/Userland/Libraries/LibGUI/Scrollbar.cpp b/Userland/Libraries/LibGUI/Scrollbar.cpp index 4d9bf7c5c7..df8bab1687 100644 --- a/Userland/Libraries/LibGUI/Scrollbar.cpp +++ b/Userland/Libraries/LibGUI/Scrollbar.cpp @@ -220,7 +220,7 @@ void Scrollbar::on_automatic_scrolling_timer_fired() void Scrollbar::mousedown_event(MouseEvent& event) { - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; if (!has_scrubber()) return; @@ -259,7 +259,7 @@ void Scrollbar::mousedown_event(MouseEvent& event) void Scrollbar::mouseup_event(MouseEvent& event) { - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; set_automatic_scrolling_active(false, Component::None); update(); diff --git a/Userland/Libraries/LibGUI/Slider.cpp b/Userland/Libraries/LibGUI/Slider.cpp index 5c07c19d36..355d407132 100644 --- a/Userland/Libraries/LibGUI/Slider.cpp +++ b/Userland/Libraries/LibGUI/Slider.cpp @@ -80,7 +80,7 @@ Gfx::IntRect Slider::knob_rect() const void Slider::mousedown_event(MouseEvent& event) { - if (event.button() == MouseButton::Left) { + if (event.button() == MouseButton::Primary) { if (knob_rect().contains(event.position())) { m_dragging = true; m_drag_origin = event.position(); @@ -128,7 +128,7 @@ void Slider::mousemove_event(MouseEvent& event) void Slider::mouseup_event(MouseEvent& event) { - if (event.button() == MouseButton::Left) { + if (event.button() == MouseButton::Primary) { m_dragging = false; return; } diff --git a/Userland/Libraries/LibGUI/Splitter.cpp b/Userland/Libraries/LibGUI/Splitter.cpp index 74e9074f0f..060780f819 100644 --- a/Userland/Libraries/LibGUI/Splitter.cpp +++ b/Userland/Libraries/LibGUI/Splitter.cpp @@ -121,7 +121,7 @@ Splitter::Grabbable* Splitter::grabbable_at(Gfx::IntPoint const& position) void Splitter::mousedown_event(MouseEvent& event) { - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; auto* grabbable = grabbable_at(event.position()); @@ -235,7 +235,7 @@ void Splitter::did_layout() void Splitter::mouseup_event(MouseEvent& event) { - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; m_resizing = false; m_first_resizee = nullptr; diff --git a/Userland/Libraries/LibGUI/TabWidget.cpp b/Userland/Libraries/LibGUI/TabWidget.cpp index ecf530a8e5..88fe7977a4 100644 --- a/Userland/Libraries/LibGUI/TabWidget.cpp +++ b/Userland/Libraries/LibGUI/TabWidget.cpp @@ -416,7 +416,7 @@ void TabWidget::mousedown_event(MouseEvent& event) if (!button_rect.contains(event.position())) continue; - if (event.button() == MouseButton::Left) { + if (event.button() == MouseButton::Primary) { if (m_close_button_enabled && close_button_rect.contains(event.position())) { m_pressed_close_button_index = i; update_bar(); @@ -437,7 +437,7 @@ void TabWidget::mousedown_event(MouseEvent& event) void TabWidget::mouseup_event(MouseEvent& event) { - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; if (m_dragging_active_tab) { diff --git a/Userland/Libraries/LibGUI/TextBox.cpp b/Userland/Libraries/LibGUI/TextBox.cpp index b02b69b9cb..909cd9627a 100644 --- a/Userland/Libraries/LibGUI/TextBox.cpp +++ b/Userland/Libraries/LibGUI/TextBox.cpp @@ -103,7 +103,7 @@ void UrlBox::mousedown_event(GUI::MouseEvent& event) if (is_displayonly()) return; - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; if (is_focus_transition()) { diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 149f9f2804..0f59e511e7 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -205,7 +205,7 @@ TextPosition TextEditor::text_position_at(Gfx::IntPoint const& widget_position) void TextEditor::doubleclick_event(MouseEvent& event) { - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; if (is_displayonly()) @@ -244,7 +244,7 @@ void TextEditor::doubleclick_event(MouseEvent& event) void TextEditor::mousedown_event(MouseEvent& event) { - if (event.button() != MouseButton::Left) { + if (event.button() != MouseButton::Primary) { return; } @@ -287,7 +287,7 @@ void TextEditor::mousedown_event(MouseEvent& event) void TextEditor::mouseup_event(MouseEvent& event) { - if (event.button() == MouseButton::Left) { + if (event.button() == MouseButton::Primary) { if (m_in_drag_select) { m_in_drag_select = false; } diff --git a/Userland/Libraries/LibGUI/Tray.cpp b/Userland/Libraries/LibGUI/Tray.cpp index 856e81cd1c..a15c095fce 100644 --- a/Userland/Libraries/LibGUI/Tray.cpp +++ b/Userland/Libraries/LibGUI/Tray.cpp @@ -122,7 +122,7 @@ void Tray::mousemove_event(GUI::MouseEvent& event) void Tray::mousedown_event(GUI::MouseEvent& event) { - if (event.button() != GUI::MouseButton::Left) + if (event.button() != GUI::MouseButton::Primary) return; auto* pressed_item = item_at(event.position()); @@ -137,7 +137,7 @@ void Tray::mousedown_event(GUI::MouseEvent& event) void Tray::mouseup_event(GUI::MouseEvent& event) { - if (event.button() != GUI::MouseButton::Left) + if (event.button() != GUI::MouseButton::Primary) return; if (auto* pressed_item = item_at(event.position()); pressed_item && m_pressed_item_index == pressed_item->index) { diff --git a/Userland/Libraries/LibGUI/TreeView.cpp b/Userland/Libraries/LibGUI/TreeView.cpp index ebe6259684..2da6e07fe5 100644 --- a/Userland/Libraries/LibGUI/TreeView.cpp +++ b/Userland/Libraries/LibGUI/TreeView.cpp @@ -79,7 +79,7 @@ void TreeView::doubleclick_event(MouseEvent& event) if (!index.is_valid()) return; - if (event.button() == MouseButton::Left) { + if (event.button() == MouseButton::Primary) { set_cursor(index, SelectionUpdate::Set); if (model.row_count(index)) diff --git a/Userland/Libraries/LibGUI/ValueSlider.cpp b/Userland/Libraries/LibGUI/ValueSlider.cpp index 4033a4e31e..64f3cf2f35 100644 --- a/Userland/Libraries/LibGUI/ValueSlider.cpp +++ b/Userland/Libraries/LibGUI/ValueSlider.cpp @@ -180,7 +180,7 @@ void ValueSlider::mousemove_event(MouseEvent& event) void ValueSlider::mousedown_event(MouseEvent& event) { - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; m_textbox->set_focus(true); @@ -193,7 +193,7 @@ void ValueSlider::mousedown_event(MouseEvent& event) void ValueSlider::mouseup_event(MouseEvent& event) { - if (event.button() != MouseButton::Left) + if (event.button() != MouseButton::Primary) return; m_dragging = false; diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index a0cb514a30..811ec1a312 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -422,7 +422,7 @@ void Widget::handle_mousedown_event(MouseEvent& event) if (has_flag(focus_policy(), FocusPolicy::ClickFocus)) set_focus(true, FocusSource::Mouse); mousedown_event(event); - if (event.button() == MouseButton::Right) { + if (event.button() == MouseButton::Secondary) { ContextMenuEvent c_event(event.position(), screen_relative_rect().location().translated(event.position())); dispatch_event(c_event); } diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp index a56d45ea8a..9cfe743817 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp @@ -212,9 +212,9 @@ static MouseButton to_mouse_button(u32 button) case 0: return MouseButton::None; case 1: - return MouseButton::Left; + return MouseButton::Primary; case 2: - return MouseButton::Right; + return MouseButton::Secondary; case 4: return MouseButton::Middle; case 8: diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 3d75402c20..441311ddcd 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -715,7 +715,7 @@ VT::Range TerminalWidget::find_previous(const StringView& needle, const VT::Posi void TerminalWidget::doubleclick_event(GUI::MouseEvent& event) { - if (event.button() == GUI::MouseButton::Left) { + if (event.button() == GUI::MouseButton::Primary) { auto attribute = m_terminal.attribute_at(buffer_position_at(event.position())); if (!attribute.href_id.is_null()) { dbgln("Open hyperlinked URL: '{}'", attribute.href); @@ -769,7 +769,7 @@ void TerminalWidget::copy() void TerminalWidget::mouseup_event(GUI::MouseEvent& event) { - if (event.button() == GUI::MouseButton::Left) { + if (event.button() == GUI::MouseButton::Primary) { if (!m_active_href_id.is_null()) { m_active_href = {}; m_active_href_id = {}; @@ -781,7 +781,7 @@ void TerminalWidget::mouseup_event(GUI::MouseEvent& event) void TerminalWidget::mousedown_event(GUI::MouseEvent& event) { - if (event.button() == GUI::MouseButton::Left) { + if (event.button() == GUI::MouseButton::Primary) { m_left_mousedown_position = event.position(); m_left_mousedown_position_buffer = buffer_position_at(m_left_mousedown_position); @@ -836,7 +836,7 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event) update(); } - if (!(event.buttons() & GUI::MouseButton::Left)) + if (!(event.buttons() & GUI::MouseButton::Primary)) return; if (!m_active_href_id.is_null()) { diff --git a/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp b/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp index 1e16176122..c632cb53f5 100644 --- a/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp @@ -53,7 +53,7 @@ void ButtonBox::paint(PaintContext& context, PaintPhase phase) void ButtonBox::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned) { - if (button != GUI::MouseButton::Left || !dom_node().enabled()) + if (button != GUI::MouseButton::Primary || !dom_node().enabled()) return; m_being_pressed = true; @@ -65,7 +65,7 @@ void ButtonBox::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsi void ButtonBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned) { - if (!m_tracking_mouse || button != GUI::MouseButton::Left || !dom_node().enabled()) + if (!m_tracking_mouse || button != GUI::MouseButton::Primary || !dom_node().enabled()) return; // NOTE: Handling the click may run arbitrary JS, which could disappear this node. diff --git a/Userland/Libraries/LibWeb/Layout/CheckBox.cpp b/Userland/Libraries/LibWeb/Layout/CheckBox.cpp index 1b6fa930be..6e8a6c9788 100644 --- a/Userland/Libraries/LibWeb/Layout/CheckBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/CheckBox.cpp @@ -39,7 +39,7 @@ void CheckBox::paint(PaintContext& context, PaintPhase phase) void CheckBox::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned) { - if (button != GUI::MouseButton::Left || !dom_node().enabled()) + if (button != GUI::MouseButton::Primary || !dom_node().enabled()) return; m_being_pressed = true; @@ -51,7 +51,7 @@ void CheckBox::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsig void CheckBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned) { - if (!m_tracking_mouse || button != GUI::MouseButton::Left || !dom_node().enabled()) + if (!m_tracking_mouse || button != GUI::MouseButton::Primary || !dom_node().enabled()) return; // NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node. diff --git a/Userland/Libraries/LibWeb/Layout/Label.cpp b/Userland/Libraries/LibWeb/Layout/Label.cpp index 1de04583e3..4d26b59438 100644 --- a/Userland/Libraries/LibWeb/Layout/Label.cpp +++ b/Userland/Libraries/LibWeb/Layout/Label.cpp @@ -28,7 +28,7 @@ Label::~Label() void Label::handle_mousedown_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button) { - if (button != GUI::MouseButton::Left) + if (button != GUI::MouseButton::Primary) return; if (auto* control = control_node(); control) @@ -39,7 +39,7 @@ void Label::handle_mousedown_on_label(Badge<TextNode>, const Gfx::IntPoint&, uns void Label::handle_mouseup_on_label(Badge<TextNode>, const Gfx::IntPoint& position, unsigned button) { - if (!m_tracking_mouse || button != GUI::MouseButton::Left) + if (!m_tracking_mouse || button != GUI::MouseButton::Primary) return; // NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node. diff --git a/Userland/Libraries/LibWeb/Layout/RadioButton.cpp b/Userland/Libraries/LibWeb/Layout/RadioButton.cpp index d34844b265..2c574d0480 100644 --- a/Userland/Libraries/LibWeb/Layout/RadioButton.cpp +++ b/Userland/Libraries/LibWeb/Layout/RadioButton.cpp @@ -39,7 +39,7 @@ void RadioButton::paint(PaintContext& context, PaintPhase phase) void RadioButton::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned) { - if (button != GUI::MouseButton::Left || !dom_node().enabled()) + if (button != GUI::MouseButton::Primary || !dom_node().enabled()) return; m_being_pressed = true; @@ -51,7 +51,7 @@ void RadioButton::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, un void RadioButton::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned) { - if (!m_tracking_mouse || button != GUI::MouseButton::Left || !dom_node().enabled()) + if (!m_tracking_mouse || button != GUI::MouseButton::Primary || !dom_node().enabled()) return; // NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node. diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index 17744f14fb..2250e86aee 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -168,7 +168,7 @@ bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button handled_event = true; } - if (button == GUI::MouseButton::Left) + if (button == GUI::MouseButton::Primary) m_in_mouse_selection = false; return handled_event; } @@ -224,7 +224,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt if (!layout_root() || layout_root() != node->document().layout_node()) return true; - if (button == GUI::MouseButton::Right && is<HTML::HTMLImageElement>(*node)) { + if (button == GUI::MouseButton::Secondary && is<HTML::HTMLImageElement>(*node)) { auto& image_element = verify_cast<HTML::HTMLImageElement>(*node); auto image_url = image_element.document().parse_url(image_element.src()); if (auto* page = m_frame.page()) @@ -236,7 +236,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt auto href = link->href(); auto url = document->parse_url(href); dbgln("Web::EventHandler: Clicking on a link to {}", url); - if (button == GUI::MouseButton::Left) { + if (button == GUI::MouseButton::Primary) { if (href.starts_with("javascript:")) { document->run_javascript(href.substring_view(11, href.length() - 11)); } else if (href.starts_with('#')) { @@ -252,7 +252,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt m_frame.loader().load(url, FrameLoader::Type::Navigation); } } - } else if (button == GUI::MouseButton::Right) { + } else if (button == GUI::MouseButton::Secondary) { if (auto* page = m_frame.page()) page->client().page_did_request_link_context_menu(m_frame.to_top_level_position(position), url, link->target(), modifiers); } else if (button == GUI::MouseButton::Middle) { @@ -260,14 +260,14 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt page->client().page_did_middle_click_link(url, link->target(), modifiers); } } else { - if (button == GUI::MouseButton::Left) { + if (button == GUI::MouseButton::Primary) { auto result = layout_root()->hit_test(position, Layout::HitTestType::TextCursor); if (result.layout_node && result.layout_node->dom_node()) { m_frame.set_cursor_position(DOM::Position(*result.layout_node->dom_node(), result.index_in_node)); layout_root()->set_selection({ { result.layout_node, result.index_in_node }, {} }); m_in_mouse_selection = true; } - } else if (button == GUI::MouseButton::Right) { + } else if (button == GUI::MouseButton::Secondary) { if (auto* page = m_frame.page()) page->client().page_did_request_context_menu(m_frame.to_top_level_position(position)); } |