diff options
79 files changed, 183 insertions, 183 deletions
diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp index 3b5fdb0091..9df2c85ea2 100644 --- a/Userland/Applets/Audio/main.cpp +++ b/Userland/Applets/Audio/main.cpp @@ -120,14 +120,14 @@ public: 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(); } diff --git a/Userland/Applets/Network/main.cpp b/Userland/Applets/Network/main.cpp index de676fc016..dbb44cd856 100644 --- a/Userland/Applets/Network/main.cpp +++ b/Userland/Applets/Network/main.cpp @@ -36,7 +36,7 @@ private: 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; diff --git a/Userland/Applets/ResourceGraph/main.cpp b/Userland/Applets/ResourceGraph/main.cpp index c84c32826f..60287ad0a4 100644 --- a/Userland/Applets/ResourceGraph/main.cpp +++ b/Userland/Applets/ResourceGraph/main.cpp @@ -106,7 +106,7 @@ private: 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 }; diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index 8cef1f408a..2731d16ee3 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -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(); diff --git a/Userland/Applications/FontEditor/GlyphEditorWidget.cpp b/Userland/Applications/FontEditor/GlyphEditorWidget.cpp index 0471d6582c..a36b3586bb 100644 --- a/Userland/Applications/FontEditor/GlyphEditorWidget.cpp +++ b/Userland/Applications/FontEditor/GlyphEditorWidget.cpp @@ -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; diff --git a/Userland/Applications/FontEditor/NewFontDialog.cpp b/Userland/Applications/FontEditor/NewFontDialog.cpp index bc3a393610..28be069c04 100644 --- a/Userland/Applications/FontEditor/NewFontDialog.cpp +++ b/Userland/Applications/FontEditor/NewFontDialog.cpp @@ -93,13 +93,13 @@ private: } 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; diff --git a/Userland/Applications/HexEditor/HexEditor.cpp b/Userland/Applications/HexEditor/HexEditor.cpp index aad684a2b1..c4b7d1767f 100644 --- a/Userland/Applications/HexEditor/HexEditor.cpp +++ b/Userland/Applications/HexEditor/HexEditor.cpp @@ -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 diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp index 3623a01eff..67d82fc646 100644 --- a/Userland/Applications/ImageViewer/ViewWidget.cpp +++ b/Userland/Applications/ImageViewer/ViewWidget.cpp @@ -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; diff --git a/Userland/Applications/Piano/KeysWidget.cpp b/Userland/Applications/Piano/KeysWidget.cpp index dfa72e1b1d..08203a58d2 100644 --- a/Userland/Applications/Piano/KeysWidget.cpp +++ b/Userland/Applications/Piano/KeysWidget.cpp @@ -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; diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index cdda065cfa..0760ec80b9 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -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(); } diff --git a/Userland/Applications/PixelPaint/LayerListWidget.cpp b/Userland/Applications/PixelPaint/LayerListWidget.cpp index 21eed86603..3414c57c7a 100644 --- a/Userland/Applications/PixelPaint/LayerListWidget.cpp +++ b/Userland/Applications/PixelPaint/LayerListWidget.cpp @@ -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; diff --git a/Userland/Applications/PixelPaint/PaletteWidget.cpp b/Userland/Applications/PixelPaint/PaletteWidget.cpp index bd9622e7d5..b6affd8ed8 100644 --- a/Userland/Applications/PixelPaint/PaletteWidget.cpp +++ b/Userland/Applications/PixelPaint/PaletteWidget.cpp @@ -50,9 +50,9 @@ public: } } - 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 @@ public: 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()); diff --git a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp index 42d702d898..472c41a984 100644 --- a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp @@ -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()); diff --git a/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp b/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp index d8feefb90e..18b7a6b0a3 100644 --- a/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp @@ -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) diff --git a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp index 67562651b1..3f8a9fbed7 100644 --- a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp @@ -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); diff --git a/Userland/Applications/PixelPaint/Tools/LineTool.cpp b/Userland/Applications/PixelPaint/Tools/LineTool.cpp index 3ba9aeed9c..9b3db8ecc5 100644 --- a/Userland/Applications/PixelPaint/Tools/LineTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/LineTool.cpp @@ -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) diff --git a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp index c09172e929..6106b2b774 100644 --- a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp @@ -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(); diff --git a/Userland/Applications/PixelPaint/Tools/PickerTool.cpp b/Userland/Applications/PixelPaint/Tools/PickerTool.cpp index 955beb545b..1c209687d2 100644 --- a/Userland/Applications/PixelPaint/Tools/PickerTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/PickerTool.cpp @@ -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); } diff --git a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp index ace0316239..7f7d536506 100644 --- a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp @@ -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; diff --git a/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp b/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp index b5b638aeaf..fccddc0ce7 100644 --- a/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp @@ -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) diff --git a/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp b/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp index 5bc7769cab..d7792db0e4 100644 --- a/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp @@ -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); } diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp index 95780659ab..189ab67d32 100644 --- a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp +++ b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp @@ -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()); } diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp index d45c63008f..a90ae7841b 100644 --- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp +++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp @@ -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)) { diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp index ef2c6ec1ab..30dfe96746 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp @@ -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; diff --git a/Userland/Demos/CatDog/CatDog.cpp b/Userland/Demos/CatDog/CatDog.cpp index 9ee9a0fadf..d17bcf9424 100644 --- a/Userland/Demos/CatDog/CatDog.cpp +++ b/Userland/Demos/CatDog/CatDog.cpp @@ -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(); diff --git a/Userland/Demos/CatDog/SpeechBubble.cpp b/Userland/Demos/CatDog/SpeechBubble.cpp index dbe87372b6..eff8b9dca9 100644 --- a/Userland/Demos/CatDog/SpeechBubble.cpp +++ b/Userland/Demos/CatDog/SpeechBubble.cpp @@ -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(); diff --git a/Userland/Demos/Fire/Fire.cpp b/Userland/Demos/Fire/Fire.cpp index 2d2694a68b..14dff9a3dd 100644 --- a/Userland/Demos/Fire/Fire.cpp +++ b/Userland/Demos/Fire/Fire.cpp @@ -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); diff --git a/Userland/Demos/Mandelbrot/Mandelbrot.cpp b/Userland/Demos/Mandelbrot/Mandelbrot.cpp index ff98e615ab..882282972d 100644 --- a/Userland/Demos/Mandelbrot/Mandelbrot.cpp +++ b/Userland/Demos/Mandelbrot/Mandelbrot.cpp @@ -283,7 +283,7 @@ void Mandelbrot::paint_event(GUI::PaintEvent& event) void Mandelbrot::mousedown_event(GUI::MouseEvent& event) { - if (event.button() == GUI::MouseButton::Left) { + if (event.button() == GUI::MouseButton::Primary) { if (!m_dragging) { m_selection_start = event.position(); m_selection_end = event.position(); @@ -328,7 +328,7 @@ void Mandelbrot::mousemove_event(GUI::MouseEvent& event) void Mandelbrot::mouseup_event(GUI::MouseEvent& event) { - if (event.button() == GUI::MouseButton::Left) { + if (event.button() == GUI::MouseButton::Primary) { auto selection = Gfx::IntRect::from_two_points(m_selection_start, m_selection_end); if (selection.width() > 0 && selection.height() > 0) m_set.zoom(selection); @@ -337,7 +337,7 @@ void Mandelbrot::mouseup_event(GUI::MouseEvent& event) } else if (event.button() == GUI::MouseButton::Middle) { m_panning = false; update(); - } else if (event.button() == GUI::MouseButton::Right) { + } else if (event.button() == GUI::MouseButton::Secondary) { reset(); } diff --git a/Userland/Demos/Mouse/main.cpp b/Userland/Demos/Mouse/main.cpp index b679482698..3cf21c8004 100644 --- a/Userland/Demos/Mouse/main.cpp +++ b/Userland/Demos/Mouse/main.cpp @@ -73,8 +73,8 @@ public: painter.stroke_path(path, Color::Black, 1); auto primary_secondary_switched = GUI::WindowServerConnection::the().get_buttons_switched(); - auto primary_pressed = m_buttons & GUI::MouseButton::Left; - auto secondary_pressed = m_buttons & GUI::MouseButton::Right; + auto primary_pressed = m_buttons & GUI::MouseButton::Primary; + auto secondary_pressed = m_buttons & GUI::MouseButton::Secondary; if (primary_secondary_switched ? secondary_pressed : primary_pressed) { painter.fill_rect({ 31, 21, 34, 44 }, Color::Blue); diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp index 46ba8c8a35..79d9297090 100644 --- a/Userland/DevTools/HackStudio/Editor.cpp +++ b/Userland/DevTools/HackStudio/Editor.cpp @@ -311,7 +311,7 @@ void Editor::mousedown_event(GUI::MouseEvent& event) auto text_position = text_position_at(event.position()); auto ruler_line_rect = ruler_content_rect(text_position.line()); - if (event.button() == GUI::MouseButton::Left && event.position().x() < ruler_line_rect.width()) { + if (event.button() == GUI::MouseButton::Primary && event.position().x() < ruler_line_rect.width()) { if (!breakpoint_lines().contains_slow(text_position.line())) { breakpoint_lines().append(text_position.line()); Debugger::the().on_breakpoint_change(wrapper().filename_label().text(), text_position.line(), BreakpointChange::Added); diff --git a/Userland/DevTools/HackStudio/Git/GitFilesView.cpp b/Userland/DevTools/HackStudio/Git/GitFilesView.cpp index a399a1de06..b5b69f0adc 100644 --- a/Userland/DevTools/HackStudio/Git/GitFilesView.cpp +++ b/Userland/DevTools/HackStudio/Git/GitFilesView.cpp @@ -37,7 +37,7 @@ GitFilesView::GitFilesView(GitFileActionCallback callback, NonnullRefPtr<Gfx::Bi void GitFilesView::mousedown_event(GUI::MouseEvent& event) { - if (event.button() != GUI::MouseButton::Left) { + if (event.button() != GUI::MouseButton::Primary) { ListView::mousedown_event(event); return; } diff --git a/Userland/DevTools/Profiler/FlameGraphView.cpp b/Userland/DevTools/Profiler/FlameGraphView.cpp index 6c57d7f0ff..76fcffeb9c 100644 --- a/Userland/DevTools/Profiler/FlameGraphView.cpp +++ b/Userland/DevTools/Profiler/FlameGraphView.cpp @@ -88,7 +88,7 @@ void FlameGraphView::mousemove_event(GUI::MouseEvent& event) void FlameGraphView::mousedown_event(GUI::MouseEvent& event) { - if (event.button() != GUI::MouseButton::Left) + if (event.button() != GUI::MouseButton::Primary) return; if (!m_hovered_bar) diff --git a/Userland/DevTools/Profiler/TimelineHeader.cpp b/Userland/DevTools/Profiler/TimelineHeader.cpp index 0db6de6e16..28e4e87900 100644 --- a/Userland/DevTools/Profiler/TimelineHeader.cpp +++ b/Userland/DevTools/Profiler/TimelineHeader.cpp @@ -66,7 +66,7 @@ void TimelineHeader::update_selection() void TimelineHeader::mousedown_event(GUI::MouseEvent& event) { - if (event.button() != GUI::MouseButton::Left) + if (event.button() != GUI::MouseButton::Primary) return; m_selected = !m_selected; on_selection_change(m_selected); diff --git a/Userland/DevTools/Profiler/TimelineView.cpp b/Userland/DevTools/Profiler/TimelineView.cpp index 60cf4648a7..e8cc208aac 100644 --- a/Userland/DevTools/Profiler/TimelineView.cpp +++ b/Userland/DevTools/Profiler/TimelineView.cpp @@ -31,7 +31,7 @@ u64 TimelineView::timestamp_at_x(int x) const void TimelineView::mousedown_event(GUI::MouseEvent& event) { - if (event.button() != GUI::MouseButton::Left) + if (event.button() != GUI::MouseButton::Primary) return; set_selecting(true); @@ -55,7 +55,7 @@ void TimelineView::mousemove_event(GUI::MouseEvent& event) void TimelineView::mouseup_event(GUI::MouseEvent& event) { - if (event.button() != GUI::MouseButton::Left) + if (event.button() != GUI::MouseButton::Primary) return; set_selecting(false); diff --git a/Userland/Games/Chess/ChessWidget.cpp b/Userland/Games/Chess/ChessWidget.cpp index 34c13b56b8..ebcded440f 100644 --- a/Userland/Games/Chess/ChessWidget.cpp +++ b/Userland/Games/Chess/ChessWidget.cpp @@ -176,7 +176,7 @@ void ChessWidget::mousedown_event(GUI::MouseEvent& event) if (!frame_inner_rect().contains(event.position())) return; - if (event.button() == GUI::MouseButton::Right) { + if (event.button() == GUI::MouseButton::Secondary) { if (m_dragging_piece) { m_dragging_piece = false; set_override_cursor(Gfx::StandardCursor::None); @@ -212,7 +212,7 @@ void ChessWidget::mouseup_event(GUI::MouseEvent& event) if (!frame_inner_rect().contains(event.position())) return; - if (event.button() == GUI::MouseButton::Right) { + if (event.button() == GUI::MouseButton::Secondary) { m_current_marking.secondary_color = event.shift(); m_current_marking.alternate_color = event.ctrl(); m_current_marking.to = mouse_to_square(event); diff --git a/Userland/Games/GameOfLife/BoardWidget.cpp b/Userland/Games/GameOfLife/BoardWidget.cpp index 06da25be5b..09000b4aa1 100644 --- a/Userland/Games/GameOfLife/BoardWidget.cpp +++ b/Userland/Games/GameOfLife/BoardWidget.cpp @@ -168,7 +168,7 @@ void BoardWidget::paint_event(GUI::PaintEvent& event) void BoardWidget::mousedown_event(GUI::MouseEvent& event) { - if (event.button() == GUI::MouseButton::Left) { + if (event.button() == GUI::MouseButton::Primary) { set_toggling_cells(true); auto row_and_column = get_row_and_column_for_point(event.x(), event.y()); if (!row_and_column.has_value()) diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp index 2cc472715f..b73b1c53fc 100644 --- a/Userland/Games/Hearts/Game.cpp +++ b/Userland/Games/Hearts/Game.cpp @@ -728,7 +728,7 @@ void Game::mouseup_event(GUI::MouseEvent& event) { GUI::Frame::mouseup_event(event); - if (event.button() != GUI::MouseButton::Left) + if (event.button() != GUI::MouseButton::Primary) return; if (!m_human_can_play) diff --git a/Userland/Games/Minesweeper/Field.cpp b/Userland/Games/Minesweeper/Field.cpp index 875f39cce9..75cd05f5c9 100644 --- a/Userland/Games/Minesweeper/Field.cpp +++ b/Userland/Games/Minesweeper/Field.cpp @@ -19,14 +19,14 @@ class SquareButton final : public GUI::Button { C_OBJECT(SquareButton); public: - Function<void()> on_right_click; + Function<void()> on_secondary_click; Function<void()> on_middle_click; virtual void mousedown_event(GUI::MouseEvent& event) override { - if (event.button() == GUI::MouseButton::Right) { - if (on_right_click) - on_right_click(); + if (event.button() == GUI::MouseButton::Secondary) { + if (on_secondary_click) + on_secondary_click(); } if (event.button() == GUI::MouseButton::Middle) { if (on_middle_click) @@ -50,8 +50,8 @@ public: virtual void mousedown_event(GUI::MouseEvent& event) override { - if (event.button() == GUI::MouseButton::Right || event.button() == GUI::MouseButton::Left) { - if (event.buttons() == (GUI::MouseButton::Right | GUI::MouseButton::Left) || m_square.field->is_single_chording()) { + if (event.button() == GUI::MouseButton::Secondary || event.button() == GUI::MouseButton::Primary) { + if (event.buttons() == (GUI::MouseButton::Secondary | GUI::MouseButton::Primary) || m_square.field->is_single_chording()) { m_chord = true; m_square.field->set_chord_preview(m_square, true); } @@ -82,7 +82,7 @@ public: virtual void mouseup_event(GUI::MouseEvent& event) override { if (m_chord) { - if (event.button() == GUI::MouseButton::Left || event.button() == GUI::MouseButton::Right) { + if (event.button() == GUI::MouseButton::Primary || event.button() == GUI::MouseButton::Secondary) { if (rect().contains(event.position())) { if (on_chord_click) on_chord_click(); @@ -248,8 +248,8 @@ void Field::reset() square.button->on_click = [this, &square](auto) { on_square_clicked(square); }; - square.button->on_right_click = [this, &square] { - on_square_right_clicked(square); + square.button->on_secondary_click = [this, &square] { + on_square_secondary_clicked(square); }; square.button->on_middle_click = [this, &square] { on_square_middle_clicked(square); @@ -385,7 +385,7 @@ void Field::on_square_chorded(Square& square) }); } -void Field::on_square_right_clicked(Square& square) +void Field::on_square_secondary_clicked(Square& square) { if (square.is_swept) return; diff --git a/Userland/Games/Minesweeper/Field.h b/Userland/Games/Minesweeper/Field.h index 5738db439d..015c6ec468 100644 --- a/Userland/Games/Minesweeper/Field.h +++ b/Userland/Games/Minesweeper/Field.h @@ -61,7 +61,7 @@ private: virtual void paint_event(GUI::PaintEvent&) override; void on_square_clicked(Square&); - void on_square_right_clicked(Square&); + void on_square_secondary_clicked(Square&); void on_square_middle_clicked(Square&); void on_square_chorded(Square&); void game_over(); 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)); } diff --git a/Userland/Services/Taskbar/ClockWidget.cpp b/Userland/Services/Taskbar/ClockWidget.cpp index ca1cb7dbe1..b4d9eeb9db 100644 --- a/Userland/Services/Taskbar/ClockWidget.cpp +++ b/Userland/Services/Taskbar/ClockWidget.cpp @@ -186,7 +186,7 @@ void ClockWidget::paint_event(GUI::PaintEvent& event) void ClockWidget::mousedown_event(GUI::MouseEvent& event) { - if (event.button() != GUI::MouseButton::Left) { + if (event.button() != GUI::MouseButton::Primary) { return; } else { if (!m_calendar_window->is_visible()) diff --git a/Userland/Services/WindowServer/Button.cpp b/Userland/Services/WindowServer/Button.cpp index c6db1d3437..a7feb11d4c 100644 --- a/Userland/Services/WindowServer/Button.cpp +++ b/Userland/Services/WindowServer/Button.cpp @@ -45,14 +45,14 @@ void Button::on_mouse_event(const MouseEvent& event) auto interesting_button = false; switch (event.button()) { - case MouseButton::Left: + case MouseButton::Primary: interesting_button = !!on_click; break; case MouseButton::Middle: interesting_button = !!on_middle_click; break; - case MouseButton::Right: - interesting_button = !!on_right_click; + case MouseButton::Secondary: + interesting_button = !!on_secondary_click; break; default: break; @@ -63,14 +63,14 @@ void Button::on_mouse_event(const MouseEvent& event) auto& wm = WindowManager::the(); - if (event.type() == Event::MouseDown && (event.button() == MouseButton::Left || event.button() == MouseButton::Right || event.button() == MouseButton::Middle)) { + if (event.type() == Event::MouseDown && (event.button() == MouseButton::Primary || event.button() == MouseButton::Secondary || event.button() == MouseButton::Middle)) { m_pressed = true; wm.set_cursor_tracking_button(this); m_frame.invalidate(m_relative_rect); return; } - if (event.type() == Event::MouseUp && (event.button() == MouseButton::Left || event.button() == MouseButton::Right || event.button() == MouseButton::Middle)) { + if (event.type() == Event::MouseUp && (event.button() == MouseButton::Primary || event.button() == MouseButton::Secondary || event.button() == MouseButton::Middle)) { if (wm.cursor_tracking_button() != this) return; wm.set_cursor_tracking_button(nullptr); @@ -78,14 +78,14 @@ void Button::on_mouse_event(const MouseEvent& event) m_pressed = false; if (rect().contains(event.position())) { switch (event.button()) { - case MouseButton::Left: + case MouseButton::Primary: if (on_click) on_click(*this); break; - case MouseButton::Right: - if (on_right_click) - on_right_click(*this); + case MouseButton::Secondary: + if (on_secondary_click) + on_secondary_click(*this); break; default: @@ -113,7 +113,7 @@ void Button::on_mouse_event(const MouseEvent& event) m_frame.invalidate(m_relative_rect); } - if (event.type() == Event::MouseMove && event.buttons() & (unsigned)MouseButton::Left) { + if (event.type() == Event::MouseMove && event.buttons() & (unsigned)MouseButton::Primary) { if (wm.cursor_tracking_button() != this) return; bool old_pressed = m_pressed; diff --git a/Userland/Services/WindowServer/Button.h b/Userland/Services/WindowServer/Button.h index 843d7c61d2..0b54211e6d 100644 --- a/Userland/Services/WindowServer/Button.h +++ b/Userland/Services/WindowServer/Button.h @@ -35,7 +35,7 @@ public: void on_mouse_event(const MouseEvent&); Function<void(Button&)> on_click; - Function<void(Button&)> on_right_click; + Function<void(Button&)> on_secondary_click; Function<void(Button&)> on_middle_click; bool is_visible() const { return m_visible; } diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ClientConnection.cpp index 5591c3c1cf..ecc3c892a5 100644 --- a/Userland/Services/WindowServer/ClientConnection.cpp +++ b/Userland/Services/WindowServer/ClientConnection.cpp @@ -727,7 +727,7 @@ void ClientConnection::start_window_resize(i32 window_id) } // FIXME: We are cheating a bit here by using the current cursor location and hard-coding the left button. // Maybe the client should be allowed to specify what initiated this request? - WindowManager::the().start_window_resize(window, ScreenInput::the().cursor_location(), MouseButton::Left); + WindowManager::the().start_window_resize(window, ScreenInput::the().cursor_location(), MouseButton::Primary); } Messages::WindowServer::StartDragResponse ClientConnection::start_drag(String const& text, HashMap<String, ByteBuffer> const& mime_data, Gfx::ShareableBitmap const& drag_bitmap) diff --git a/Userland/Services/WindowServer/Event.h b/Userland/Services/WindowServer/Event.h index 20b3568d4d..91347f8998 100644 --- a/Userland/Services/WindowServer/Event.h +++ b/Userland/Services/WindowServer/Event.h @@ -50,8 +50,8 @@ public: enum class MouseButton : u8 { None = 0, - Left = 1, - Right = 2, + Primary = 1, + Secondary = 2, Middle = 4, Back = 8, Forward = 16, diff --git a/Userland/Services/WindowServer/Screen.cpp b/Userland/Services/WindowServer/Screen.cpp index b28fc42f40..d065d38155 100644 --- a/Userland/Services/WindowServer/Screen.cpp +++ b/Userland/Services/WindowServer/Screen.cpp @@ -449,8 +449,8 @@ void ScreenInput::on_receive_mouse_data(const MousePacket& packet) auto message = make<MouseEvent>(buttons & (unsigned)button ? Event::MouseDown : Event::MouseUp, m_cursor_location, buttons, button, m_modifiers); Core::EventLoop::current().post_event(WindowManager::the(), move(message)); }; - post_mousedown_or_mouseup_if_needed(MouseButton::Left); - post_mousedown_or_mouseup_if_needed(MouseButton::Right); + post_mousedown_or_mouseup_if_needed(MouseButton::Primary); + post_mousedown_or_mouseup_if_needed(MouseButton::Secondary); post_mousedown_or_mouseup_if_needed(MouseButton::Middle); post_mousedown_or_mouseup_if_needed(MouseButton::Back); post_mousedown_or_mouseup_if_needed(MouseButton::Forward); diff --git a/Userland/Services/WindowServer/WMClientConnection.cpp b/Userland/Services/WindowServer/WMClientConnection.cpp index 6feb532f5f..41866be218 100644 --- a/Userland/Services/WindowServer/WMClientConnection.cpp +++ b/Userland/Services/WindowServer/WMClientConnection.cpp @@ -100,7 +100,7 @@ void WMClientConnection::start_window_resize(i32 client_id, i32 window_id) auto& window = *(*it).value; // FIXME: We are cheating a bit here by using the current cursor location and hard-coding the left button. // Maybe the client should be allowed to specify what initiated this request? - WindowManager::the().start_window_resize(window, ScreenInput::the().cursor_location(), MouseButton::Left); + WindowManager::the().start_window_resize(window, ScreenInput::the().cursor_location(), MouseButton::Primary); } void WMClientConnection::set_window_minimized(i32 client_id, i32 window_id, bool minimized) diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index c9382bb1c6..65e8f58d08 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -700,7 +700,7 @@ bool WindowFrame::handle_titlebar_icon_mouse_event(MouseEvent const& event) { auto& wm = WindowManager::the(); - if (event.type() == Event::MouseDown && (event.button() == MouseButton::Left || event.button() == MouseButton::Right)) { + if (event.type() == Event::MouseDown && (event.button() == MouseButton::Primary || event.button() == MouseButton::Secondary)) { // Manually start a potential double click. Since we're opening // a menu, we will only receive the MouseDown event, so we // need to record that fact. If the user subsequently clicks @@ -714,7 +714,7 @@ bool WindowFrame::handle_titlebar_icon_mouse_event(MouseEvent const& event) m_window.popup_window_menu(titlebar_rect().bottom_left().translated(rect().location()), WindowMenuDefaultAction::Close); return true; - } else if (event.type() == Event::MouseUp && event.button() == MouseButton::Left) { + } else if (event.type() == Event::MouseUp && event.button() == MouseButton::Primary) { // Since the MouseDown event opened a menu, another MouseUp // from the second click outside the menu wouldn't be considered // a double click, so let's manually check if it would otherwise @@ -743,12 +743,12 @@ void WindowFrame::handle_titlebar_mouse_event(MouseEvent const& event) } if (event.type() == Event::MouseDown) { - if ((m_window.type() == WindowType::Normal || m_window.type() == WindowType::ToolWindow) && event.button() == MouseButton::Right) { + if ((m_window.type() == WindowType::Normal || m_window.type() == WindowType::ToolWindow) && event.button() == MouseButton::Secondary) { auto default_action = m_window.is_maximized() ? WindowMenuDefaultAction::Restore : WindowMenuDefaultAction::Maximize; m_window.popup_window_menu(event.position().translated(rect().location()), default_action); return; } - if (m_window.is_movable() && event.button() == MouseButton::Left) + if (m_window.is_movable() && event.button() == MouseButton::Primary) wm.start_window_move(m_window, event.translated(rect().location())); } } @@ -812,7 +812,7 @@ void WindowFrame::handle_border_mouse_event(const MouseEvent& event) return; } - if (event.type() == Event::MouseDown && event.button() == MouseButton::Left) + if (event.type() == Event::MouseDown && event.button() == MouseButton::Primary) wm.start_window_resize(m_window, event.translated(rect().location())); } @@ -851,7 +851,7 @@ void WindowFrame::handle_menu_mouse_event(Menu& menu, const MouseEvent& event) { auto menubar_rect = this->menubar_rect(); bool is_hover_with_any_menu_open = event.type() == MouseEvent::MouseMove && &m_window == WindowManager::the().window_with_active_menu(); - bool is_mousedown_with_left_button = event.type() == MouseEvent::MouseDown && event.button() == MouseButton::Left; + bool is_mousedown_with_left_button = event.type() == MouseEvent::MouseDown && event.button() == MouseButton::Primary; bool should_open_menu = &menu != MenuManager::the().current_menu() && (is_hover_with_any_menu_open || is_mousedown_with_left_button); bool should_close_menu = &menu == MenuManager::the().current_menu() && is_mousedown_with_left_button; diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 4073b4a8b7..f704681e33 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -724,7 +724,7 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event) { if (!m_move_window) return false; - if (event.type() == Event::MouseUp && event.button() == MouseButton::Left) { + if (event.type() == Event::MouseUp && event.button() == MouseButton::Primary) { dbgln_if(MOVE_DEBUG, "[WM] Finish moving Window({})", m_move_window); @@ -964,7 +964,7 @@ bool WindowManager::process_ongoing_drag(MouseEvent& event) }); } - if (!(event.type() == Event::MouseUp && event.button() == MouseButton::Left)) + if (!(event.type() == Event::MouseUp && event.button() == MouseButton::Primary)) return true; if (auto* window = current_window_stack().window_at(event.position())) { @@ -989,10 +989,10 @@ void WindowManager::set_cursor_tracking_button(Button* button) auto WindowManager::DoubleClickInfo::metadata_for_button(MouseButton button) const -> ClickMetadata const& { switch (button) { - case MouseButton::Left: - return m_left; - case MouseButton::Right: - return m_right; + case MouseButton::Primary: + return m_primary; + case MouseButton::Secondary: + return m_secondary; case MouseButton::Middle: return m_middle; case MouseButton::Back: @@ -1007,10 +1007,10 @@ auto WindowManager::DoubleClickInfo::metadata_for_button(MouseButton button) con auto WindowManager::DoubleClickInfo::metadata_for_button(MouseButton button) -> ClickMetadata& { switch (button) { - case MouseButton::Left: - return m_left; - case MouseButton::Right: - return m_right; + case MouseButton::Primary: + return m_primary; + case MouseButton::Secondary: + return m_secondary; case MouseButton::Middle: return m_middle; case MouseButton::Back: @@ -1163,11 +1163,11 @@ void WindowManager::process_mouse_event_for_window(HitTestResult& result, MouseE // First check if we should initiate a move or resize (Super+LMB or Super+RMB). // In those cases, the event is swallowed by the window manager. if (!blocking_modal_window && window.is_movable()) { - if (!window.is_fullscreen() && m_keyboard_modifiers == Mod_Super && event.type() == Event::MouseDown && event.button() == MouseButton::Left) { + if (!window.is_fullscreen() && m_keyboard_modifiers == Mod_Super && event.type() == Event::MouseDown && event.button() == MouseButton::Primary) { start_window_move(window, event); return; } - if (window.is_resizable() && m_keyboard_modifiers == Mod_Super && event.type() == Event::MouseDown && event.button() == MouseButton::Right && !window.blocking_modal_window()) { + if (window.is_resizable() && m_keyboard_modifiers == Mod_Super && event.type() == Event::MouseDown && event.button() == MouseButton::Secondary && !window.blocking_modal_window()) { start_window_resize(window, event); return; } diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h index e2ec2aa050..d79db15f33 100644 --- a/Userland/Services/WindowServer/WindowManager.h +++ b/Userland/Services/WindowServer/WindowManager.h @@ -388,8 +388,8 @@ private: void reset() { - m_left = {}; - m_right = {}; + m_primary = {}; + m_secondary = {}; m_middle = {}; m_back = {}; m_forward = {}; @@ -398,8 +398,8 @@ private: WeakPtr<Window> m_clicked_window; private: - ClickMetadata m_left; - ClickMetadata m_right; + ClickMetadata m_primary; + ClickMetadata m_secondary; ClickMetadata m_middle; ClickMetadata m_back; ClickMetadata m_forward; diff --git a/Userland/Utilities/shot.cpp b/Userland/Utilities/shot.cpp index 2f6087d144..13a8b193bd 100644 --- a/Userland/Utilities/shot.cpp +++ b/Userland/Utilities/shot.cpp @@ -41,7 +41,7 @@ public: private: virtual void mousedown_event(GUI::MouseEvent& event) override { - if (event.button() == GUI::MouseButton::Left) + if (event.button() == GUI::MouseButton::Primary) m_anchor_point = event.position(); }; @@ -55,7 +55,7 @@ private: virtual void mouseup_event(GUI::MouseEvent& event) override { - if (event.button() == GUI::MouseButton::Left) + if (event.button() == GUI::MouseButton::Primary) m_window->close(); }; |