Commit f065d74a authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

wayland: Fix mispositioned decoration tooltips

QPlatformScreen::virtualSiblings() must return a list of screens on the
virtual desktop, otherwise QToolTip will use
QGuiApplication::primaryScreen() instead of looking up the screen where
the decoration tooltip must be shown using QDesktopWidget::screenNumber().

BUG: 432860


(cherry picked from commit 712dbc41)
parent 8f2ba3ef
Pipeline #136094 passed with stage
in 12 minutes and 2 seconds
......@@ -53,6 +53,11 @@ Integration::~Integration()
}
}
QHash<AbstractOutput *, Screen *> Integration::screens() const
{
return m_screens;
}
bool Integration::hasCapability(Capability cap) const
{
switch (cap) {
......@@ -159,7 +164,7 @@ void Integration::handlePlatformCreated()
void Integration::handleOutputEnabled(AbstractOutput *output)
{
Screen *platformScreen = new Screen(output);
Screen *platformScreen = new Screen(output, this);
QWindowSystemInterface::handleScreenAdded(platformScreen);
m_screens.insert(output, platformScreen);
......
......@@ -41,9 +41,10 @@ public:
QStringList themeNames() const override;
QPlatformTheme *createPlatformTheme(const QString &name) const override;
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
void initialize() override;
QHash<AbstractOutput *, Screen *> screens() const;
private Q_SLOTS:
void handleOutputEnabled(AbstractOutput *output);
void handleOutputDisabled(AbstractOutput *output);
......
......@@ -8,6 +8,7 @@
*/
#include "screen.h"
#include "abstract_output.h"
#include "integration.h"
#include "logging.h"
#include "platformcursor.h"
......@@ -23,15 +24,30 @@ static int forcedDpi()
return qEnvironmentVariableIsSet("QT_WAYLAND_FORCE_DPI") ? qEnvironmentVariableIntValue("QT_WAYLAND_FORCE_DPI") : -1;
}
Screen::Screen(AbstractOutput *output)
Screen::Screen(AbstractOutput *output, Integration *integration)
: m_output(output)
, m_cursor(new PlatformCursor)
, m_integration(integration)
{
connect(output, &AbstractOutput::geometryChanged, this, &Screen::handleGeometryChanged);
}
Screen::~Screen() = default;
QList<QPlatformScreen *> Screen::virtualSiblings() const
{
const auto screens = m_integration->screens();
QList<QPlatformScreen *> siblings;
siblings.reserve(siblings.size());
for (Screen *screen : screens) {
siblings << screen;
}
return siblings;
}
int Screen::depth() const
{
return 32;
......
......@@ -20,6 +20,7 @@ class AbstractOutput;
namespace QPA
{
class Integration;
class PlatformCursor;
class Screen : public QObject, public QPlatformScreen
......@@ -27,7 +28,7 @@ class Screen : public QObject, public QPlatformScreen
Q_OBJECT
public:
explicit Screen(AbstractOutput *output);
Screen(AbstractOutput *output, Integration *integration);
~Screen() override;
QString name() const override;
......@@ -38,6 +39,7 @@ public:
QPlatformCursor *cursor() const override;
QDpi logicalDpi() const override;
qreal devicePixelRatio() const override;
QList<QPlatformScreen *> virtualSiblings() const override;
private Q_SLOTS:
void handleGeometryChanged();
......@@ -45,6 +47,7 @@ private Q_SLOTS:
private:
QPointer<AbstractOutput> m_output;
QScopedPointer<PlatformCursor> m_cursor;
Integration *m_integration;
};
class PlaceholderScreen : public QPlatformPlaceholderScreen
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment