From b76fe6357a2803121c2c98bae6bf3113623915e1 Mon Sep 17 00:00:00 2001 From: Marcus Nilsson Date: Sun, 15 Aug 2021 18:22:12 +0200 Subject: [PATCH] PixelPaint: Don't select the same layer twice in LayerListWidget Without this check we would do an unnecessary partial second round trip because of the call chain: LayerListWidget::set_selected_layer() -> LayerListWidget::on_layer_select() -> ImageEditor::set_active_layer() -> ImageEditor::on_active_layer_change() -> LayerListWidget::set_selected_layer() --- Userland/Applications/PixelPaint/LayerListWidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Applications/PixelPaint/LayerListWidget.cpp b/Userland/Applications/PixelPaint/LayerListWidget.cpp index 44ecb95da3..8c76b4c9e1 100644 --- a/Userland/Applications/PixelPaint/LayerListWidget.cpp +++ b/Userland/Applications/PixelPaint/LayerListWidget.cpp @@ -342,6 +342,10 @@ void LayerListWidget::set_selected_layer(Layer* layer) { if (!m_image) return; + + if (layer->is_selected()) + return; + for (size_t i = 0; i < m_image->layer_count(); ++i) { if (layer == &m_image->layer(i)) { m_image->layer(i).set_selected(true);