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

Everywhere: Rename left/right-click to primary/secondary

This resolves #10641.
This commit is contained in:
Filiph Sandström 2021-10-27 13:20:27 +02:00 committed by Idan Horowitz
parent a6ccf6659a
commit d6a0726302
79 changed files with 183 additions and 183 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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);
}

View file

@ -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());

View file

@ -311,8 +311,8 @@ public:
enum MouseButton : u8 {
None = 0,
Left = 1,
Right = 2,
Primary = 1,
Secondary = 2,
Middle = 4,
Back = 8,
Forward = 16,

View file

@ -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);

View file

@ -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();

View file

@ -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);

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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();

View file

@ -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;
}

View file

@ -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;

View file

@ -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) {

View file

@ -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()) {

View file

@ -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;
}

View file

@ -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) {

View file

@ -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))

View file

@ -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;

View file

@ -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);
}

View file

@ -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: