From 345c350d9da562e49dd2093f798b80d2d1bf2aac Mon Sep 17 00:00:00 2001 From: Christophe Date: Mon, 11 May 2026 22:58:27 +0200 Subject: [PATCH 1/4] vkconfig: Fix tray icon flicker --- vkconfig_gui/mainwindow.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vkconfig_gui/mainwindow.cpp b/vkconfig_gui/mainwindow.cpp index 2daa389fb1..826d080a8e 100644 --- a/vkconfig_gui/mainwindow.cpp +++ b/vkconfig_gui/mainwindow.cpp @@ -48,7 +48,7 @@ #include MainWindow::MainWindow(QApplication &app, QWidget *parent) - : QMainWindow(parent), _tray_icon(nullptr), app(app), ui(new Ui::MainWindow) { + : QMainWindow(parent), _tray_icon(new QSystemTrayIcon(this)), app(app), ui(new Ui::MainWindow) { ui->setupUi(this); this->tabs[TAB_DIAGNOSTIC].reset(new TabDiagnostics(*this, ui)); @@ -194,13 +194,14 @@ void MainWindow::UpdateUI_Status() { this->connect(tray_quit_action, &QAction::triggered, qApp, &QCoreApplication::quit); menu->addAction(tray_quit_action); - if (this->_tray_icon != nullptr) { - delete this->_tray_icon; + if (VKC_ENV != VKC_ENV_WIN32) { + if (this->_tray_icon != nullptr) { + delete this->_tray_icon; + } + this->_tray_icon = new QSystemTrayIcon(this); } - this->_tray_icon = new QSystemTrayIcon(this); this->_tray_icon->setContextMenu(menu); - this->_tray_icon->show(); this->connect(this->_tray_icon, &QSystemTrayIcon::activated, this, &MainWindow::OnIconActivated); if (configurator.layers_override_enabled || configurator.driver_override_enabled || configurator.loader_log_enabled) { @@ -208,6 +209,8 @@ void MainWindow::UpdateUI_Status() { } else { this->_tray_icon->setIcon(QIcon(":/resourcefiles/vkconfig-off.png")); } + + this->_tray_icon->show(); } } From 472b0b9790fb7adc4062c2748f4670efe9dff4af Mon Sep 17 00:00:00 2001 From: Christophe Date: Mon, 11 May 2026 23:43:56 +0200 Subject: [PATCH 2/4] vkconfig: Fix tray icon being updated three times for each action Change-Id: Ia9e691d2508aa036cb7fffa7cb6814e6f2648356 --- vkconfig_gui/mainwindow.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/vkconfig_gui/mainwindow.cpp b/vkconfig_gui/mainwindow.cpp index 826d080a8e..d51e0a9f8a 100644 --- a/vkconfig_gui/mainwindow.cpp +++ b/vkconfig_gui/mainwindow.cpp @@ -387,7 +387,6 @@ void MainWindow::OnTrayActionOverrideLayers(bool toggled) { configurator.Override(OVERRIDE_AREA_ALL); this->tabs[TAB_CONFIGURATIONS]->UpdateUI(UPDATE_REBUILD_UI); - this->UpdateUI(UPDATE_REBUILD_UI); } void MainWindow::OnLayersChanged(int index) { @@ -396,7 +395,6 @@ void MainWindow::OnLayersChanged(int index) { configurator.Override(OVERRIDE_AREA_ALL); this->tabs[TAB_CONFIGURATIONS]->UpdateUI(UPDATE_REBUILD_UI); - this->UpdateUI(UPDATE_REBUILD_UI); } void MainWindow::OnTrayActionOverrideDevice(bool toggled) { @@ -406,7 +404,6 @@ void MainWindow::OnTrayActionOverrideDevice(bool toggled) { configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT); this->tabs[TAB_DRIVERS]->UpdateUI(UPDATE_REBUILD_UI); - this->UpdateUI(UPDATE_REBUILD_UI); } void MainWindow::OnDeviceChanged(int index) { @@ -415,7 +412,6 @@ void MainWindow::OnDeviceChanged(int index) { configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT); this->tabs[TAB_DRIVERS]->UpdateUI(UPDATE_REBUILD_UI); - this->UpdateUI(UPDATE_REBUILD_UI); } void MainWindow::OnTrayActionOverrideLog(bool toggled) { @@ -424,7 +420,6 @@ void MainWindow::OnTrayActionOverrideLog(bool toggled) { configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT); this->tabs[TAB_DIAGNOSTIC]->UpdateUI(UPDATE_REBUILD_UI); - this->UpdateUI(UPDATE_REBUILD_UI); } /// The only thing we need to do here is clear the configuration if From 298eef7d437f41f6a2f809a31ed1cb49c5f682f8 Mon Sep 17 00:00:00 2001 From: Christophe Date: Mon, 11 May 2026 23:55:17 +0200 Subject: [PATCH 3/4] vkconfig: Fix Linux tray icon refresh Change-Id: Idc1b12d8cf8d9f7f01b4a19d317b23443fe10ec1 --- vkconfig_gui/mainwindow.cpp | 52 +++++++++++++++++++++---------------- vkconfig_gui/mainwindow.h | 1 + 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/vkconfig_gui/mainwindow.cpp b/vkconfig_gui/mainwindow.cpp index d51e0a9f8a..f9f476b54a 100644 --- a/vkconfig_gui/mainwindow.cpp +++ b/vkconfig_gui/mainwindow.cpp @@ -110,9 +110,13 @@ void MainWindow::UpdateUI_Status() { if (QSystemTrayIcon::isSystemTrayAvailable()) { // Device { - QMenu *menu = new QMenu(this); - QSignalMapper *mapper_device = new QSignalMapper(menu); - QSignalMapper *mapper_layers = new QSignalMapper(menu); + if (this->_tray_icon_menu != nullptr) { + delete this->_tray_icon_menu; + } + this->_tray_icon_menu = new QMenu(this); + + QSignalMapper *mapper_device = new QSignalMapper(this); + QSignalMapper *mapper_layers = new QSignalMapper(this); QAction *tray_restore_action = new QAction("&Show Vulkan Configurator UI", this); tray_restore_action->setIcon(QIcon(":/resourcefiles/vkconfig-on.png")); @@ -120,9 +124,9 @@ void MainWindow::UpdateUI_Status() { font.setBold(true); tray_restore_action->setFont(font); this->connect(tray_restore_action, &QAction::triggered, this, &MainWindow::OnTrayActionShow); - menu->addAction(tray_restore_action); + this->_tray_icon_menu->addAction(tray_restore_action); - menu->addSeparator(); + this->_tray_icon_menu->addSeparator(); const bool enabled_device = configurator.driver_override_enabled; QAction *tray_override = new QAction("Override System Vulkan &Device with:", this); @@ -131,7 +135,7 @@ void MainWindow::UpdateUI_Status() { tray_override->setChecked(enabled_device); this->connect(tray_override, &QAction::toggled, this, &MainWindow::OnTrayActionOverrideDevice); - menu->addAction(tray_override); + this->_tray_icon_menu->addAction(tray_override); for (std::size_t i = 0, n = configurator.vulkan_system_info.physicalDevices.size(); i < n; ++i) { const VulkanPhysicalDeviceInfo &info = configurator.vulkan_system_info.physicalDevices[i]; @@ -142,7 +146,7 @@ void MainWindow::UpdateUI_Status() { action->setChecked(device_info == configurator.driver_override_info); action->setEnabled(enabled_device); - menu->addAction(action); + this->_tray_icon_menu->addAction(action); this->connect(action, SIGNAL(triggered()), mapper_device, SLOT(map())); mapper_device->setMapping(action, i); @@ -150,7 +154,7 @@ void MainWindow::UpdateUI_Status() { this->connect(mapper_device, &QSignalMapper::mappedInt, this, &MainWindow::OnDeviceChanged); - menu->addSeparator(); + this->_tray_icon_menu->addSeparator(); const bool enabled_layers = configurator.layers_override_enabled && configurator.GetExecutableScope() != EXECUTABLE_PER; QAction *tray_override_layers = new QAction("Override System Vulkan &Layers Configuration with:", this); @@ -159,7 +163,7 @@ void MainWindow::UpdateUI_Status() { tray_override_layers->setChecked(enabled_layers); this->connect(tray_override_layers, &QAction::toggled, this, &MainWindow::OnTrayActionOverrideLayers); - menu->addAction(tray_override_layers); + this->_tray_icon_menu->addAction(tray_override_layers); for (std::size_t i = 0, n = configurator.configurations.available_configurations.size(); i < n; ++i) { const Configuration &configuration = configurator.configurations.available_configurations[i]; @@ -169,7 +173,7 @@ void MainWindow::UpdateUI_Status() { action->setChecked(configuration.key == configurator.GetSelectedGlobalConfiguration()); action->setEnabled(enabled_layers); - menu->addAction(action); + this->_tray_icon_menu->addAction(action); this->connect(action, SIGNAL(triggered()), mapper_layers, SLOT(map())); mapper_layers->setMapping(action, i); @@ -177,31 +181,33 @@ void MainWindow::UpdateUI_Status() { this->connect(mapper_layers, &QSignalMapper::mappedInt, this, &MainWindow::OnLayersChanged); - menu->addSeparator(); + this->_tray_icon_menu->addSeparator(); QAction *tray_override_loader = new QAction("Override System Vulkan Loader Log", this); tray_override_loader->setFont(font); tray_override_loader->setCheckable(true); tray_override_loader->setChecked(configurator.loader_log_enabled); this->connect(tray_override_loader, &QAction::toggled, this, &MainWindow::OnTrayActionOverrideLog); - menu->addAction(tray_override_loader); + this->_tray_icon_menu->addAction(tray_override_loader); - menu->addSeparator(); + this->_tray_icon_menu->addSeparator(); QAction *tray_quit_action = new QAction("&Quit Vulkan Configurator", this); tray_quit_action->setIcon(::Get(configurator.current_theme_mode, ::ICON_EXIT)); tray_quit_action->setFont(font); this->connect(tray_quit_action, &QAction::triggered, qApp, &QCoreApplication::quit); - menu->addAction(tray_quit_action); - - if (VKC_ENV != VKC_ENV_WIN32) { - if (this->_tray_icon != nullptr) { - delete this->_tray_icon; - } - this->_tray_icon = new QSystemTrayIcon(this); - } - - this->_tray_icon->setContextMenu(menu); + this->_tray_icon_menu->addAction(tray_quit_action); + + /* + if (VKC_ENV != VKC_ENV_WIN32) { + if (this->_tray_icon != nullptr) { + delete this->_tray_icon; + } + this->_tray_icon = new QSystemTrayIcon(this); + } + */ + + this->_tray_icon->setContextMenu(this->_tray_icon_menu); this->connect(this->_tray_icon, &QSystemTrayIcon::activated, this, &MainWindow::OnIconActivated); if (configurator.layers_override_enabled || configurator.driver_override_enabled || configurator.loader_log_enabled) { diff --git a/vkconfig_gui/mainwindow.h b/vkconfig_gui/mainwindow.h index 2c08ede66c..b39b3d609e 100644 --- a/vkconfig_gui/mainwindow.h +++ b/vkconfig_gui/mainwindow.h @@ -57,6 +57,7 @@ class MainWindow : public QMainWindow { void changeEvent(QEvent *event) override; QSystemTrayIcon *_tray_icon = nullptr; + QMenu *_tray_icon_menu = nullptr; public Q_SLOTS: void commitDataRequest(QSessionManager &manager); From 70d78a35801ccad5960fa96c6d3069c464772ab2 Mon Sep 17 00:00:00 2001 From: Christophe Date: Tue, 12 May 2026 00:10:51 +0200 Subject: [PATCH 4/4] vkconfig: Linux system tray require realloc Change-Id: I93e209fbc4fbcee1e391b9266da9f851cc5ce559 --- vkconfig_gui/mainwindow.cpp | 51 +++++++++++++++++-------------------- vkconfig_gui/mainwindow.h | 1 - 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/vkconfig_gui/mainwindow.cpp b/vkconfig_gui/mainwindow.cpp index f9f476b54a..9fc9e3f43e 100644 --- a/vkconfig_gui/mainwindow.cpp +++ b/vkconfig_gui/mainwindow.cpp @@ -110,13 +110,10 @@ void MainWindow::UpdateUI_Status() { if (QSystemTrayIcon::isSystemTrayAvailable()) { // Device { - if (this->_tray_icon_menu != nullptr) { - delete this->_tray_icon_menu; - } - this->_tray_icon_menu = new QMenu(this); + QMenu *menu = new QMenu(this); - QSignalMapper *mapper_device = new QSignalMapper(this); - QSignalMapper *mapper_layers = new QSignalMapper(this); + QSignalMapper *mapper_device = new QSignalMapper(menu); + QSignalMapper *mapper_layers = new QSignalMapper(menu); QAction *tray_restore_action = new QAction("&Show Vulkan Configurator UI", this); tray_restore_action->setIcon(QIcon(":/resourcefiles/vkconfig-on.png")); @@ -124,9 +121,9 @@ void MainWindow::UpdateUI_Status() { font.setBold(true); tray_restore_action->setFont(font); this->connect(tray_restore_action, &QAction::triggered, this, &MainWindow::OnTrayActionShow); - this->_tray_icon_menu->addAction(tray_restore_action); + menu->addAction(tray_restore_action); - this->_tray_icon_menu->addSeparator(); + menu->addSeparator(); const bool enabled_device = configurator.driver_override_enabled; QAction *tray_override = new QAction("Override System Vulkan &Device with:", this); @@ -135,7 +132,7 @@ void MainWindow::UpdateUI_Status() { tray_override->setChecked(enabled_device); this->connect(tray_override, &QAction::toggled, this, &MainWindow::OnTrayActionOverrideDevice); - this->_tray_icon_menu->addAction(tray_override); + menu->addAction(tray_override); for (std::size_t i = 0, n = configurator.vulkan_system_info.physicalDevices.size(); i < n; ++i) { const VulkanPhysicalDeviceInfo &info = configurator.vulkan_system_info.physicalDevices[i]; @@ -146,7 +143,7 @@ void MainWindow::UpdateUI_Status() { action->setChecked(device_info == configurator.driver_override_info); action->setEnabled(enabled_device); - this->_tray_icon_menu->addAction(action); + menu->addAction(action); this->connect(action, SIGNAL(triggered()), mapper_device, SLOT(map())); mapper_device->setMapping(action, i); @@ -154,7 +151,7 @@ void MainWindow::UpdateUI_Status() { this->connect(mapper_device, &QSignalMapper::mappedInt, this, &MainWindow::OnDeviceChanged); - this->_tray_icon_menu->addSeparator(); + menu->addSeparator(); const bool enabled_layers = configurator.layers_override_enabled && configurator.GetExecutableScope() != EXECUTABLE_PER; QAction *tray_override_layers = new QAction("Override System Vulkan &Layers Configuration with:", this); @@ -163,7 +160,7 @@ void MainWindow::UpdateUI_Status() { tray_override_layers->setChecked(enabled_layers); this->connect(tray_override_layers, &QAction::toggled, this, &MainWindow::OnTrayActionOverrideLayers); - this->_tray_icon_menu->addAction(tray_override_layers); + menu->addAction(tray_override_layers); for (std::size_t i = 0, n = configurator.configurations.available_configurations.size(); i < n; ++i) { const Configuration &configuration = configurator.configurations.available_configurations[i]; @@ -173,7 +170,7 @@ void MainWindow::UpdateUI_Status() { action->setChecked(configuration.key == configurator.GetSelectedGlobalConfiguration()); action->setEnabled(enabled_layers); - this->_tray_icon_menu->addAction(action); + menu->addAction(action); this->connect(action, SIGNAL(triggered()), mapper_layers, SLOT(map())); mapper_layers->setMapping(action, i); @@ -181,33 +178,31 @@ void MainWindow::UpdateUI_Status() { this->connect(mapper_layers, &QSignalMapper::mappedInt, this, &MainWindow::OnLayersChanged); - this->_tray_icon_menu->addSeparator(); + menu->addSeparator(); QAction *tray_override_loader = new QAction("Override System Vulkan Loader Log", this); tray_override_loader->setFont(font); tray_override_loader->setCheckable(true); tray_override_loader->setChecked(configurator.loader_log_enabled); this->connect(tray_override_loader, &QAction::toggled, this, &MainWindow::OnTrayActionOverrideLog); - this->_tray_icon_menu->addAction(tray_override_loader); + menu->addAction(tray_override_loader); - this->_tray_icon_menu->addSeparator(); + menu->addSeparator(); QAction *tray_quit_action = new QAction("&Quit Vulkan Configurator", this); tray_quit_action->setIcon(::Get(configurator.current_theme_mode, ::ICON_EXIT)); tray_quit_action->setFont(font); this->connect(tray_quit_action, &QAction::triggered, qApp, &QCoreApplication::quit); - this->_tray_icon_menu->addAction(tray_quit_action); - - /* - if (VKC_ENV != VKC_ENV_WIN32) { - if (this->_tray_icon != nullptr) { - delete this->_tray_icon; - } - this->_tray_icon = new QSystemTrayIcon(this); - } - */ - - this->_tray_icon->setContextMenu(this->_tray_icon_menu); + menu->addAction(tray_quit_action); + + if (VKC_PLATFORM == PLATFORM_LINUX) { + if (this->_tray_icon != nullptr) { + delete this->_tray_icon; + } + this->_tray_icon = new QSystemTrayIcon(this); + } + + this->_tray_icon->setContextMenu(menu); this->connect(this->_tray_icon, &QSystemTrayIcon::activated, this, &MainWindow::OnIconActivated); if (configurator.layers_override_enabled || configurator.driver_override_enabled || configurator.loader_log_enabled) { diff --git a/vkconfig_gui/mainwindow.h b/vkconfig_gui/mainwindow.h index b39b3d609e..2c08ede66c 100644 --- a/vkconfig_gui/mainwindow.h +++ b/vkconfig_gui/mainwindow.h @@ -57,7 +57,6 @@ class MainWindow : public QMainWindow { void changeEvent(QEvent *event) override; QSystemTrayIcon *_tray_icon = nullptr; - QMenu *_tray_icon_menu = nullptr; public Q_SLOTS: void commitDataRequest(QSessionManager &manager);