From 133842d6a83dc7c3c37b329e300b617af977e4fa Mon Sep 17 00:00:00 2001 From: Mark Deneen Date: Fri, 9 Jan 2026 15:13:45 -0500 Subject: [PATCH] Disable tooltips if using gamescope / Steam Deck. (#4096) * Disable tooltips if using gamescope / Steam Deck. On a Steam Deck, Prism Launcher's window is scaled to fit the screen. Whenever a tool tip is shown, it is often display outside of the window, causing the compositor to scale the view to fit the new bounding box. This effect is quite jarring, and I don't like it. This patch adds a small global event filter which swallows up the tool tip events. It is currently not configurable, although I suppose that could be an option. Signed-off-by: Mark Deneen * Move tooltip filter addition from the Main Window to the Application. Signed-off-by: Mark Deneen * Add license information to new files Signed-off-by: Mark Deneen * Remove other authors, they should not have been added in the first place Signed-off-by: Mark Deneen * Correct the years as well Signed-off-by: Mark Deneen * Update launcher/ui/ToolTipFilter.cpp Co-authored-by: Alexandru Ionut Tripon Signed-off-by: Mark Deneen * Update launcher/ui/ToolTipFilter.h Co-authored-by: Alexandru Ionut Tripon Signed-off-by: Mark Deneen --------- Signed-off-by: Mark Deneen Co-authored-by: Alexandru Ionut Tripon --- launcher/Application.cpp | 5 +++++ launcher/CMakeLists.txt | 2 ++ launcher/ui/ToolTipFilter.cpp | 28 ++++++++++++++++++++++++++++ launcher/ui/ToolTipFilter.h | 29 +++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 launcher/ui/ToolTipFilter.cpp create mode 100644 launcher/ui/ToolTipFilter.h diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 67ddb53e8..71a04502f 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -51,6 +51,7 @@ #include "ui/InstanceWindow.h" #include "ui/MainWindow.h" #include "ui/ViewLogWindow.h" +#include "ui/ToolTipFilter.h" #include "ui/dialogs/ProgressDialog.h" #include "ui/instanceview/AccessibleInstanceView.h" @@ -1199,6 +1200,10 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) } } + if (qgetenv("XDG_CURRENT_DESKTOP") == "gamescope") { + installEventFilter(new ToolTipFilter); + } + if (createSetupWizard()) { return; } diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index e5d69986c..d1878e3b0 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -843,6 +843,8 @@ SET(LAUNCHER_SOURCES ui/InstanceWindow.cpp ui/ViewLogWindow.h ui/ViewLogWindow.cpp + ui/ToolTipFilter.h + ui/ToolTipFilter.cpp # FIXME: maybe find a better home for this. FileIgnoreProxy.cpp diff --git a/launcher/ui/ToolTipFilter.cpp b/launcher/ui/ToolTipFilter.cpp new file mode 100644 index 000000000..0a95356c1 --- /dev/null +++ b/launcher/ui/ToolTipFilter.cpp @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-3.0-only +/* + * Prism Launcher - Minecraft Launcher + * Copyright (C) 2026 Mark Deneen + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "ToolTipFilter.h" + +bool ToolTipFilter::eventFilter(QObject* obj, QEvent* ev) { + if (ev->type() == QEvent::ToolTip) { + return true; + } else { + return QObject::eventFilter(obj, ev); + } +} diff --git a/launcher/ui/ToolTipFilter.h b/launcher/ui/ToolTipFilter.h new file mode 100644 index 000000000..3cbb1f1d6 --- /dev/null +++ b/launcher/ui/ToolTipFilter.h @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-3.0-only +/* + * Prism Launcher - Minecraft Launcher + * Copyright (C) 2026 Mark Deneen + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include + +class ToolTipFilter : public QObject +{ + Q_OBJECT +protected: + bool eventFilter(QObject *obj, QEvent *event); +};