mirror of
https://github.com/KDE/krfb
synced 2026-07-01 07:41:17 -07:00
Compensate for global scale factor when using xcb fb plugin
The screen geometry is reported in device independent pixels, so it has to be multiplied by the devicePixelRatio to get the size of the underlying framebuffer. Otherwise, only the top left of the screen will be captured. This matches the behavior of QScreen::grabWindow(...), which also returns a QPixmap of the given size scaled by devicePixelRatio. BUG: 419814
This commit is contained in:
@@ -163,11 +163,14 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
|
||||
QScreen *primaryScreen = QGuiApplication::primaryScreen();
|
||||
if (primaryScreen) {
|
||||
qreal scaleFactor = primaryScreen->devicePixelRatio();
|
||||
d->area = { primaryScreen->geometry().topLeft() * scaleFactor,
|
||||
primaryScreen->geometry().bottomRight() * scaleFactor };
|
||||
qDebug() << "xcb framebuffer: Primary screen: " << primaryScreen->name()
|
||||
<< ", geometry: " << primaryScreen->geometry()
|
||||
<< ", device scaling: " << scaleFactor
|
||||
<< ", native size: " << d->area
|
||||
<< ", depth: " << primaryScreen->depth();
|
||||
//
|
||||
d->area = primaryScreen->geometry();
|
||||
} else {
|
||||
qWarning() << "xcb framebuffer: ERROR: Failed to get application's primary screen info!";
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user