Avoid QHighDpi::toNativePixels where possible

This commit is contained in:
Ilya Fedin 2022-05-19 11:49:33 +04:00 committed by John Preston
parent a32f3a94b9
commit 941a10c8b0
2 changed files with 3 additions and 6 deletions

View file

@ -15,7 +15,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtGui/QWindow>
#include <qpa/qplatformnativeinterface.h>
#include <private/qguiapplication_p.h>
#include <private/qhighdpiscaling_p.h>
// private QtWaylandClient headers are using keywords :(
#ifdef QT_NO_KEYWORDS
@ -153,9 +152,8 @@ bool WaylandIntegration::showWindowMenu(QWindow *window) {
return false;
}
const auto pos = QHighDpi::toNativePixels(
window->mapFromGlobal(QCursor::pos()),
window);
const auto pos = window->mapFromGlobal(QCursor::pos())
* window->devicePixelRatio();
xdg_toplevel_show_window_menu(toplevel, seat, *serial, pos.x(), pos.y());
return true;

View file

@ -23,7 +23,6 @@
#include <QtCore/QPoint>
#include <QtGui/QWindow>
#include <QtWidgets/QApplication>
#include <private/qhighdpiscaling_p.h>
namespace Ui {
namespace Platform {
@ -505,7 +504,7 @@ bool WindowExtentsSupported() {
}
void SetWindowExtents(QWindow *window, const QMargins &extents) {
const auto nativeExtents = QHighDpi::toNativePixels(extents, window);
const auto nativeExtents = extents * window->devicePixelRatio();
if (const auto integration = WaylandIntegration::Instance()) {
integration->setWindowExtents(window, nativeExtents);
} else if (::Platform::IsX11()) {