mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 04:42:44 +00:00 
			
		
		
		
	Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
This commit is contained in:
		
							parent
							
								
									a6ccf6659a
								
							
						
					
					
						commit
						d6a0726302
					
				
					 79 changed files with 183 additions and 183 deletions
				
			
		|  | @ -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(); | ||||
|         } | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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 }; | ||||
|  |  | |||
|  | @ -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(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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
 | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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(); | ||||
| } | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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()); | ||||
|  |  | |||
|  | @ -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()); | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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(); | ||||
|  |  | |||
|  | @ -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); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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()); | ||||
|     } | ||||
|  |  | |||
|  | @ -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)) { | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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(); | ||||
|  |  | |||
|  | @ -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(); | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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(); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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; | ||||
|     } | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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()) | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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(); | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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) { | ||||
|  |  | |||
|  | @ -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); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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()); | ||||
|  |  | |||
|  | @ -311,8 +311,8 @@ public: | |||
| 
 | ||||
| enum MouseButton : u8 { | ||||
|     None = 0, | ||||
|     Left = 1, | ||||
|     Right = 2, | ||||
|     Primary = 1, | ||||
|     Secondary = 2, | ||||
|     Middle = 4, | ||||
|     Back = 8, | ||||
|     Forward = 16, | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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(); | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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; | ||||
|     } | ||||
|  |  | |||
|  | @ -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); | ||||
| } | ||||
|  |  | |||
|  | @ -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(); | ||||
|  |  | |||
|  | @ -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; | ||||
|     } | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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) { | ||||
|  |  | |||
|  | @ -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()) { | ||||
|  |  | |||
|  | @ -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; | ||||
|         } | ||||
|  |  | |||
|  | @ -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) { | ||||
|  |  | |||
|  | @ -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)) | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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); | ||||
|     } | ||||
|  |  | |||
|  | @ -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: | ||||
|  |  | |||
|  | @ -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()) { | ||||
|  |  | |||
|  | @ -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.
 | ||||
|  |  | |||
|  | @ -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.
 | ||||
|  |  | |||
|  | @ -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.
 | ||||
|  |  | |||
|  | @ -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.
 | ||||
|  |  | |||
|  | @ -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)); | ||||
|         } | ||||
|  |  | |||
|  | @ -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()) | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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; } | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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, | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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; | ||||
| 
 | ||||
|  |  | |||
|  | @ -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; | ||||
|         } | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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(); | ||||
|     }; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Filiph Sandström
						Filiph Sandström