From 56f99cb6f47e487a7f735cae176a36113cc1673d Mon Sep 17 00:00:00 2001 From: David Redondo Date: Mon, 15 Jul 2024 15:16:47 +0200 Subject: [PATCH] Fix debug console indices These were off by one because the surface tab was removed. Insetad of numbers look up the indices of the widgets so its less prone to break in the future. --- src/debug_console.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/debug_console.cpp b/src/debug_console.cpp index fdd686a78d..1cab7aa299 100644 --- a/src/debug_console.cpp +++ b/src/debug_console.cpp @@ -609,7 +609,6 @@ DebugConsole::DebugConsole() m_ui->inputDevicesView->setItemDelegate(new DebugConsoleDelegate(this)); m_ui->quitButton->setIcon(QIcon::fromTheme(QStringLiteral("application-exit"))); m_ui->tabWidget->setTabIcon(0, QIcon::fromTheme(QStringLiteral("view-list-tree"))); - m_ui->tabWidget->setTabIcon(1, QIcon::fromTheme(QStringLiteral("view-list-tree"))); if (kwinApp()->operationMode() == Application::OperationMode::OperationModeX11) { m_ui->tabWidget->setTabEnabled(1, false); // Input Events @@ -624,15 +623,15 @@ DebugConsole::DebugConsole() connect(m_ui->quitButton, &QAbstractButton::clicked, this, &DebugConsole::deleteLater); connect(m_ui->tabWidget, &QTabWidget::currentChanged, this, [this](int index) { // delay creation of input event filter until the tab is selected - if (index == 2 && !m_inputFilter) { + if (index == m_ui->tabWidget->indexOf(m_ui->input) && !m_inputFilter) { m_inputFilter = std::make_unique(m_ui->inputTextEdit); input()->installInputEventSpy(m_inputFilter.get()); } - if (index == 5) { + if (index == m_ui->tabWidget->indexOf(m_ui->keyboard)) { updateKeyboardTab(); connect(input(), &InputRedirection::keyStateChanged, this, &DebugConsole::updateKeyboardTab); } - if (index == 6) { + if (index == m_ui->tabWidget->indexOf(m_ui->clipboard)) { static_cast(m_ui->clipboardContent->model())->setSource(waylandServer()->seat()->selection()); m_ui->clipboardSource->setText(sourceString(waylandServer()->seat()->selection())); connect(waylandServer()->seat(), &SeatInterface::selectionChanged, this, [this](AbstractDataSource *source) {