client: Workaround Gnome's incorrect xdg-geometry sizes
Mutter, depending on the scaling mode, will sometimes send the xdg geometry size in device pixels rather than logical pixels. It is reported as https://gitlab.gnome.org/GNOME/mutter/-/issues/2631 but it is closed upstream so we cannot rely on them fixing it. This patch introduces the same workaround that GTK ships to work around this behavior. If the scale is set, and the xdg geometry matches the output geometry, then we can assume we don't have logical pixels for the xdg geometry and should calculate it manually. Fixes: QTBUG-122197 Change-Id: I7f640bac619be6eb07c84bb6913334a6356524a2 Pick-to: 6.8 6.7 6.5 Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
This commit is contained in:
parent
4bd62f740f
commit
8754c9fe83
@ -112,12 +112,19 @@ QString QWaylandScreen::model() const
|
||||
QRect QWaylandScreen::geometry() const
|
||||
{
|
||||
if (zxdg_output_v1::isInitialized()) {
|
||||
return mXdgGeometry;
|
||||
} else {
|
||||
// Scale geometry for QScreen. This makes window and screen
|
||||
// geometry be in the same coordinate system.
|
||||
return QRect(mGeometry.topLeft(), mGeometry.size() / mScale);
|
||||
|
||||
// Workaround for Gnome bug
|
||||
// https://gitlab.gnome.org/GNOME/mutter/-/issues/2631
|
||||
// which sends an incorrect xdg geometry
|
||||
const bool xdgGeometryIsBogus = mScale > 1 && mXdgGeometry.size() == mGeometry.size();
|
||||
|
||||
if (!xdgGeometryIsBogus) {
|
||||
return mXdgGeometry;
|
||||
}
|
||||
}
|
||||
// Scale geometry for QScreen. This makes window and screen
|
||||
// geometry be in the same coordinate system.
|
||||
return QRect(mGeometry.topLeft(), mGeometry.size() / mScale);
|
||||
}
|
||||
|
||||
int QWaylandScreen::depth() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user