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 <mdeneen@gmail.com> * Move tooltip filter addition from the Main Window to the Application. Signed-off-by: Mark Deneen <mdeneen@gmail.com> * Add license information to new files Signed-off-by: Mark Deneen <mdeneen@gmail.com> * Remove other authors, they should not have been added in the first place Signed-off-by: Mark Deneen <mdeneen@gmail.com> * Correct the years as well Signed-off-by: Mark Deneen <mdeneen@gmail.com> * Update launcher/ui/ToolTipFilter.cpp Co-authored-by: Alexandru Ionut Tripon <alexandru.tripon97@gmail.com> Signed-off-by: Mark Deneen <mdeneen@gmail.com> * Update launcher/ui/ToolTipFilter.h Co-authored-by: Alexandru Ionut Tripon <alexandru.tripon97@gmail.com> Signed-off-by: Mark Deneen <mdeneen@gmail.com> --------- Signed-off-by: Mark Deneen <mdeneen@gmail.com> Co-authored-by: Alexandru Ionut Tripon <alexandru.tripon97@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
28
launcher/ui/ToolTipFilter.cpp
Normal file
28
launcher/ui/ToolTipFilter.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (C) 2026 Mark Deneen <mdeneen@gmail.com>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ToolTipFilter.h"
|
||||
|
||||
bool ToolTipFilter::eventFilter(QObject* obj, QEvent* ev) {
|
||||
if (ev->type() == QEvent::ToolTip) {
|
||||
return true;
|
||||
} else {
|
||||
return QObject::eventFilter(obj, ev);
|
||||
}
|
||||
}
|
||||
29
launcher/ui/ToolTipFilter.h
Normal file
29
launcher/ui/ToolTipFilter.h
Normal file
@@ -0,0 +1,29 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (C) 2026 Mark Deneen <mdeneen@gmail.com>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qevent.h>
|
||||
|
||||
class ToolTipFilter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
};
|
||||
Reference in New Issue
Block a user