Add --region option (#2013)
* Fix empty help message bug Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add --region option Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix: initial selection even without --region * Enable 'full --region' Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Enable 'screen --region' Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Allow negative width/height Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix screen intersection bug Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Change output format of --print-geometry Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
This commit is contained in:
@@ -130,14 +130,7 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool& ok)
|
||||
}
|
||||
#endif
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) || defined(Q_OS_WIN)
|
||||
QRect geometry;
|
||||
for (QScreen* const screen : QGuiApplication::screens()) {
|
||||
QRect scrRect = screen->geometry();
|
||||
scrRect.moveTo(scrRect.x() / screen->devicePixelRatio(),
|
||||
scrRect.y() / screen->devicePixelRatio());
|
||||
geometry = geometry.united(scrRect);
|
||||
}
|
||||
|
||||
QRect geometry = desktopGeometry();
|
||||
QPixmap p(QApplication::primaryScreen()->grabWindow(
|
||||
QApplication::desktop()->winId(),
|
||||
geometry.x(),
|
||||
@@ -197,3 +190,16 @@ QPixmap ScreenGrabber::grabScreen(int screenNumber, bool& ok)
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
QRect ScreenGrabber::desktopGeometry()
|
||||
{
|
||||
QRect geometry;
|
||||
|
||||
for (QScreen* const screen : QGuiApplication::screens()) {
|
||||
QRect scrRect = screen->geometry();
|
||||
scrRect.moveTo(scrRect.x() / screen->devicePixelRatio(),
|
||||
scrRect.y() / screen->devicePixelRatio());
|
||||
geometry = geometry.united(scrRect);
|
||||
}
|
||||
return geometry;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user