Skip to content

Commit

Permalink
Everywhere: Rename left/right-click to primary/secondary
Browse files Browse the repository at this point in the history
This resolves SerenityOS#10641.
  • Loading branch information
filiphsps authored and IdanHo committed Oct 27, 2021
1 parent a6ccf66 commit d6a0726
Showing 79 changed files with 183 additions and 183 deletions.
4 changes: 2 additions & 2 deletions Userland/Applets/Audio/main.cpp
Original file line number Diff line number Diff line change
@@ -120,14 +120,14 @@ class AudioWidget final : public GUI::Widget {
private:
virtual void mousedown_event(GUI::MouseEvent& event) override
{
if (event.button() == GUI::MouseButton::Left) {
if (event.button() == GUI::MouseButton::Primary) {
if (!m_slider_window->is_visible())
open();
else
close();
return;
}
if (event.button() == GUI::MouseButton::Right) {
if (event.button() == GUI::MouseButton::Secondary) {
m_audio_client->set_muted(!m_audio_muted);
update();
}
2 changes: 1 addition & 1 deletion Userland/Applets/Network/main.cpp
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ class NetworkWidget final : public GUI::ImageWidget {

virtual void mousedown_event(GUI::MouseEvent& event) override
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;

pid_t child_pid;
2 changes: 1 addition & 1 deletion Userland/Applets/ResourceGraph/main.cpp
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ class GraphWidget final : public GUI::Frame {

virtual void mousedown_event(GUI::MouseEvent& event) override
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
pid_t child_pid;
const char* argv[] = { "SystemMonitor", "-t", "graphs", nullptr };
2 changes: 1 addition & 1 deletion Userland/Applications/3DFileViewer/main.cpp
Original file line number Diff line number Diff line change
@@ -132,7 +132,7 @@ void GLContextWidget::resize_event(GUI::ResizeEvent& event)

void GLContextWidget::mousemove_event(GUI::MouseEvent& event)
{
if (event.buttons() == GUI::MouseButton::Left) {
if (event.buttons() == GUI::MouseButton::Primary) {
int delta_x = m_last_mouse.x() - event.x();
int delta_y = m_last_mouse.y() - event.y();

6 changes: 3 additions & 3 deletions Userland/Applications/FontEditor/GlyphEditorWidget.cpp
Original file line number Diff line number Diff line change
@@ -195,7 +195,7 @@ void GlyphEditorWidget::mousemove_event(GUI::MouseEvent& event)
{
if (!m_is_clicking_valid_cell)
return;
if (!(event.buttons() & (GUI::MouseButton::Left | GUI::MouseButton::Right)))
if (!(event.buttons() & (GUI::MouseButton::Primary | GUI::MouseButton::Secondary)))
return;
if (mode() == Paint)
draw_at_mouse(event);
@@ -213,8 +213,8 @@ void GlyphEditorWidget::enter_event(Core::Event&)

void GlyphEditorWidget::draw_at_mouse(const GUI::MouseEvent& event)
{
bool set = event.buttons() & GUI::MouseButton::Left;
bool unset = event.buttons() & GUI::MouseButton::Right;
bool set = event.buttons() & GUI::MouseButton::Primary;
bool unset = event.buttons() & GUI::MouseButton::Secondary;
if (!(set ^ unset))
return;
int x = (event.x() - 1) / m_scale;
6 changes: 3 additions & 3 deletions Userland/Applications/FontEditor/NewFontDialog.cpp
Original file line number Diff line number Diff line change
@@ -93,13 +93,13 @@ class GlyphPreviewWidget final : public Frame {
}
virtual void mousemove_event(MouseEvent& event) override
{
if (event.buttons() & (GUI::MouseButton::Left | GUI::MouseButton::Right))
if (event.buttons() & (GUI::MouseButton::Primary | GUI::MouseButton::Secondary))
draw_at_mouse(event);
}
void draw_at_mouse(const MouseEvent& event)
{
bool set = event.buttons() & MouseButton::Left;
bool unset = event.buttons() & MouseButton::Right;
bool set = event.buttons() & MouseButton::Primary;
bool unset = event.buttons() & MouseButton::Secondary;
if (!(set ^ unset))
return;
int x = (event.x() - 1) / m_scale;
4 changes: 2 additions & 2 deletions Userland/Applications/HexEditor/HexEditor.cpp
Original file line number Diff line number Diff line change
@@ -195,7 +195,7 @@ void HexEditor::set_content_length(int length)

void HexEditor::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left) {
if (event.button() != GUI::MouseButton::Primary) {
return;
}

@@ -308,7 +308,7 @@ void HexEditor::mousemove_event(GUI::MouseEvent& event)

void HexEditor::mouseup_event(GUI::MouseEvent& event)
{
if (event.button() == GUI::MouseButton::Left) {
if (event.button() == GUI::MouseButton::Primary) {
if (m_in_drag_select) {
if (m_selection_end < m_selection_start) {
// lets flip these around
4 changes: 2 additions & 2 deletions Userland/Applications/ImageViewer/ViewWidget.cpp
Original file line number Diff line number Diff line change
@@ -184,7 +184,7 @@ void ViewWidget::paint_event(GUI::PaintEvent& event)

void ViewWidget::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
m_click_position = event.position();
m_saved_pan_origin = m_pan_origin;
@@ -194,7 +194,7 @@ void ViewWidget::mouseup_event([[maybe_unused]] GUI::MouseEvent& event) { }

void ViewWidget::mousemove_event(GUI::MouseEvent& event)
{
if (!(event.buttons() & GUI::MouseButton::Left))
if (!(event.buttons() & GUI::MouseButton::Primary))
return;

auto delta = event.position() - m_click_position;
4 changes: 2 additions & 2 deletions Userland/Applications/Piano/KeysWidget.cpp
Original file line number Diff line number Diff line change
@@ -270,7 +270,7 @@ int KeysWidget::note_for_event_position(const Gfx::IntPoint& a_point) const

void KeysWidget::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;

m_mouse_down = true;
@@ -283,7 +283,7 @@ void KeysWidget::mousedown_event(GUI::MouseEvent& event)

void KeysWidget::mouseup_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;

m_mouse_down = false;
8 changes: 4 additions & 4 deletions Userland/Applications/PixelPaint/ImageEditor.cpp
Original file line number Diff line number Diff line change
@@ -501,18 +501,18 @@ void ImageEditor::layers_did_change()

Color ImageEditor::color_for(GUI::MouseButton button) const
{
if (button == GUI::MouseButton::Left)
if (button == GUI::MouseButton::Primary)
return m_primary_color;
if (button == GUI::MouseButton::Right)
if (button == GUI::MouseButton::Secondary)
return m_secondary_color;
VERIFY_NOT_REACHED();
}

Color ImageEditor::color_for(GUI::MouseEvent const& event) const
{
if (event.buttons() & GUI::MouseButton::Left)
if (event.buttons() & GUI::MouseButton::Primary)
return m_primary_color;
if (event.buttons() & GUI::MouseButton::Right)
if (event.buttons() & GUI::MouseButton::Secondary)
return m_secondary_color;
VERIFY_NOT_REACHED();
}
4 changes: 2 additions & 2 deletions Userland/Applications/PixelPaint/LayerListWidget.cpp
Original file line number Diff line number Diff line change
@@ -146,7 +146,7 @@ void LayerListWidget::mousedown_event(GUI::MouseEvent& event)
{
if (!m_image)
return;
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;

Gfx::IntPoint translated_event_point = { 0, vertical_scrollbar().value() + event.y() };
@@ -201,7 +201,7 @@ void LayerListWidget::mouseup_event(GUI::MouseEvent& event)
{
if (!m_image)
return;
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
if (!m_moving_gadget_index.has_value())
return;
6 changes: 3 additions & 3 deletions Userland/Applications/PixelPaint/PaletteWidget.cpp
Original file line number Diff line number Diff line change
@@ -50,9 +50,9 @@ class ColorWidget : public GUI::Frame {
}
}

if (event.button() == GUI::MouseButton::Left)
if (event.button() == GUI::MouseButton::Primary)
m_palette_widget.set_primary_color(m_color);
else if (event.button() == GUI::MouseButton::Right)
else if (event.button() == GUI::MouseButton::Secondary)
m_palette_widget.set_secondary_color(m_color);
}

@@ -69,7 +69,7 @@ class SelectedColorWidget : public GUI::Frame {

virtual void mousedown_event(GUI::MouseEvent& event) override
{
if (event.button() != GUI::MouseButton::Left || !on_color_change)
if (event.button() != GUI::MouseButton::Primary || !on_color_change)
return;

auto dialog = GUI::ColorPicker::construct(m_color, window());
4 changes: 2 additions & 2 deletions Userland/Applications/PixelPaint/Tools/BrushTool.cpp
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ void BrushTool::on_mousedown(Layer* layer, MouseEvent& event)
return;

auto& layer_event = event.layer_event();
if (layer_event.button() != GUI::MouseButton::Left && layer_event.button() != GUI::MouseButton::Right)
if (layer_event.button() != GUI::MouseButton::Primary && layer_event.button() != GUI::MouseButton::Secondary)
return;

// Shift+Click draws a line from the last position to current one.
@@ -60,7 +60,7 @@ void BrushTool::on_mousemove(Layer* layer, MouseEvent& event)
return;

auto& layer_event = event.layer_event();
if (!(layer_event.buttons() & GUI::MouseButton::Left || layer_event.buttons() & GUI::MouseButton::Right))
if (!(layer_event.buttons() & GUI::MouseButton::Primary || layer_event.buttons() & GUI::MouseButton::Secondary))
return;

draw_line(layer->bitmap(), color_for(layer_event), m_last_position, layer_event.position());
2 changes: 1 addition & 1 deletion Userland/Applications/PixelPaint/Tools/EllipseTool.cpp
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ void EllipseTool::on_mousedown(Layer* layer, MouseEvent& event)
return;

auto& layer_event = event.layer_event();
if (layer_event.button() != GUI::MouseButton::Left && layer_event.button() != GUI::MouseButton::Right)
if (layer_event.button() != GUI::MouseButton::Primary && layer_event.button() != GUI::MouseButton::Secondary)
return;

if (m_drawing_button != GUI::MouseButton::None)
2 changes: 1 addition & 1 deletion Userland/Applications/PixelPaint/Tools/GuideTool.cpp
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ void GuideTool::on_mousedown(Layer*, MouseEvent& event)

auto& image_event = event.image_event();

if (image_event.button() != GUI::MouseButton::Left)
if (image_event.button() != GUI::MouseButton::Primary)
return;

m_editor->set_guide_visibility(true);
2 changes: 1 addition & 1 deletion Userland/Applications/PixelPaint/Tools/LineTool.cpp
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ void LineTool::on_mousedown(Layer* layer, MouseEvent& event)
return;

auto& layer_event = event.layer_event();
if (layer_event.button() != GUI::MouseButton::Left && layer_event.button() != GUI::MouseButton::Right)
if (layer_event.button() != GUI::MouseButton::Primary && layer_event.button() != GUI::MouseButton::Secondary)
return;

if (m_drawing_button != GUI::MouseButton::None)
8 changes: 4 additions & 4 deletions Userland/Applications/PixelPaint/Tools/MoveTool.cpp
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ MoveTool::~MoveTool()

void MoveTool::on_mousedown(Layer* layer, MouseEvent& event)
{
if (event.image_event().button() == GUI::MouseButton::Right && !m_is_panning) {
if (event.image_event().button() == GUI::MouseButton::Secondary && !m_is_panning) {
m_is_panning = true;
m_event_origin = event.raw_event().position();
m_saved_pan_origin = m_editor->pan_origin();
@@ -37,7 +37,7 @@ void MoveTool::on_mousedown(Layer* layer, MouseEvent& event)

auto& layer_event = event.layer_event();
auto& image_event = event.image_event();
if (layer_event.button() != GUI::MouseButton::Left)
if (layer_event.button() != GUI::MouseButton::Primary)
return;
if (!layer->rect().contains(layer_event.position()))
return;
@@ -70,7 +70,7 @@ void MoveTool::on_mousemove(Layer* layer, MouseEvent& event)

void MoveTool::on_mouseup(Layer* layer, MouseEvent& event)
{
if (event.image_event().button() == GUI::MouseButton::Right && m_is_panning) {
if (event.image_event().button() == GUI::MouseButton::Secondary && m_is_panning) {
m_is_panning = false;
m_editor->set_override_cursor(cursor());
return;
@@ -80,7 +80,7 @@ void MoveTool::on_mouseup(Layer* layer, MouseEvent& event)
return;

auto& layer_event = event.layer_event();
if (layer_event.button() != GUI::MouseButton::Left)
if (layer_event.button() != GUI::MouseButton::Primary)
return;
m_layer_being_moved = nullptr;
m_editor->did_complete_action();
4 changes: 2 additions & 2 deletions Userland/Applications/PixelPaint/Tools/PickerTool.cpp
Original file line number Diff line number Diff line change
@@ -38,9 +38,9 @@ void PickerTool::on_mousedown(Layer* layer, MouseEvent& event)
if (!color.alpha())
return;

if (event.layer_event().button() == GUI::MouseButton::Left)
if (event.layer_event().button() == GUI::MouseButton::Primary)
m_editor->set_primary_color(color);
else if (event.layer_event().button() == GUI::MouseButton::Right)
else if (event.layer_event().button() == GUI::MouseButton::Secondary)
m_editor->set_secondary_color(color);
}

Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ RectangleSelectTool::~RectangleSelectTool()
void RectangleSelectTool::on_mousedown(Layer*, MouseEvent& event)
{
auto& image_event = event.image_event();
if (image_event.button() != GUI::MouseButton::Left)
if (image_event.button() != GUI::MouseButton::Primary)
return;

m_selecting = true;
@@ -61,7 +61,7 @@ void RectangleSelectTool::on_mousemove(Layer*, MouseEvent& event)
void RectangleSelectTool::on_mouseup(Layer*, MouseEvent& event)
{
auto& image_event = event.image_event();
if (!m_selecting || image_event.button() != GUI::MouseButton::Left)
if (!m_selecting || image_event.button() != GUI::MouseButton::Primary)
return;

m_selecting = false;
2 changes: 1 addition & 1 deletion Userland/Applications/PixelPaint/Tools/RectangleTool.cpp
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ void RectangleTool::on_mousedown(Layer* layer, MouseEvent& event)
return;

auto& layer_event = event.layer_event();
if (layer_event.button() != GUI::MouseButton::Left && layer_event.button() != GUI::MouseButton::Right)
if (layer_event.button() != GUI::MouseButton::Primary && layer_event.button() != GUI::MouseButton::Secondary)
return;

if (m_drawing_button != GUI::MouseButton::None)
4 changes: 2 additions & 2 deletions Userland/Applications/PixelPaint/Tools/ZoomTool.cpp
Original file line number Diff line number Diff line change
@@ -23,10 +23,10 @@ ZoomTool::~ZoomTool()
void ZoomTool::on_mousedown(Layer*, MouseEvent& event)
{
auto& raw_event = event.raw_event();
if (raw_event.button() != GUI::MouseButton::Left && raw_event.button() != GUI::MouseButton::Right)
if (raw_event.button() != GUI::MouseButton::Primary && raw_event.button() != GUI::MouseButton::Secondary)
return;

auto scale_factor = (raw_event.button() == GUI::MouseButton::Left) ? m_sensitivity : -m_sensitivity;
auto scale_factor = (raw_event.button() == GUI::MouseButton::Primary) ? m_sensitivity : -m_sensitivity;
m_editor->scale_centered_on_position(raw_event.position(), scale_factor);
}

2 changes: 1 addition & 1 deletion Userland/Applications/SoundPlayer/PlaylistWidget.cpp
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ String PlaylistModel::column_name(int column) const
void PlaylistTableView::doubleclick_event(GUI::MouseEvent& event)
{
AbstractView::doubleclick_event(event);
if (event.button() == GUI::Left) {
if (event.button() == GUI::Primary) {
if (on_doubleclick)
on_doubleclick(event.position());
}
2 changes: 1 addition & 1 deletion Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp
Original file line number Diff line number Diff line change
@@ -299,7 +299,7 @@ void TreeMapWidget::mousedown_event(GUI::MouseEvent& event)

void TreeMapWidget::doubleclick_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
const TreeMapNode* node = path_node(m_viewpoint);
if (node && !node_is_leaf(*node)) {
2 changes: 1 addition & 1 deletion Userland/Applications/Spreadsheet/SpreadsheetView.cpp
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ void InfinitelyScrollableTableView::mousemove_event(GUI::MouseEvent& event)
sheet.disable_updates();
ScopeGuard sheet_update_enabler { [&] { sheet.enable_updates(); } };

auto holding_left_button = !!(event.buttons() & GUI::MouseButton::Left);
auto holding_left_button = !!(event.buttons() & GUI::MouseButton::Primary);
if (m_is_dragging_for_copy) {
set_override_cursor(Gfx::StandardCursor::Crosshair);
m_should_intercept_drag = false;
2 changes: 1 addition & 1 deletion Userland/Demos/CatDog/CatDog.cpp
Original file line number Diff line number Diff line change
@@ -122,7 +122,7 @@ void CatDog::track_mouse_move(Gfx::IntPoint const& point)

void CatDog::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
if (on_click)
on_click();
2 changes: 1 addition & 1 deletion Userland/Demos/CatDog/SpeechBubble.cpp
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ void SpeechBubble::paint_event(GUI::PaintEvent&)

void SpeechBubble::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
if (on_dismiss)
on_dismiss();
4 changes: 2 additions & 2 deletions Userland/Demos/Fire/Fire.cpp
Original file line number Diff line number Diff line change
@@ -164,7 +164,7 @@ void Fire::timer_event(Core::TimerEvent&)

void Fire::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() == GUI::MouseButton::Left)
if (event.button() == GUI::MouseButton::Primary)
dragging = true;

return GUI::Widget::mousedown_event(event);
@@ -189,7 +189,7 @@ void Fire::mousemove_event(GUI::MouseEvent& event)

void Fire::mouseup_event(GUI::MouseEvent& event)
{
if (event.button() == GUI::MouseButton::Left)
if (event.button() == GUI::MouseButton::Primary)
dragging = false;

return GUI::Widget::mouseup_event(event);
Loading

0 comments on commit d6a0726

Please sign in to comment.