Fix multi-monitor configurations with primary not right/bottom
This commit is contained in:
parent
af15301bf1
commit
fdfa43c093
@ -22,10 +22,12 @@ static bool notLocked(const std::shared_ptr<CaptureArea> &area)
|
|||||||
CaptureAreaSelector::CaptureAreaSelector(Capturer &capturer,
|
CaptureAreaSelector::CaptureAreaSelector(Capturer &capturer,
|
||||||
const Settings &settings,
|
const Settings &settings,
|
||||||
const CommonModels &models,
|
const CommonModels &models,
|
||||||
const QPixmap &pixmap)
|
const QPixmap &pixmap,
|
||||||
|
const QPoint &pixmapOffset)
|
||||||
: capturer_(capturer)
|
: capturer_(capturer)
|
||||||
, settings_(settings)
|
, settings_(settings)
|
||||||
, pixmap_(pixmap)
|
, pixmap_(pixmap)
|
||||||
|
, pixmapOffset_(pixmapOffset)
|
||||||
, editor_(std::make_unique<CaptureAreaEditor>(models, this))
|
, editor_(std::make_unique<CaptureAreaEditor>(models, this))
|
||||||
, contextMenu_(new QMenu(this))
|
, contextMenu_(new QMenu(this))
|
||||||
{
|
{
|
||||||
@ -56,7 +58,7 @@ CaptureAreaSelector::~CaptureAreaSelector() = default;
|
|||||||
|
|
||||||
void CaptureAreaSelector::activate()
|
void CaptureAreaSelector::activate()
|
||||||
{
|
{
|
||||||
setGeometry(pixmap_.rect());
|
setGeometry(QRect(pixmapOffset_, pixmap_.size()));
|
||||||
show();
|
show();
|
||||||
activateWindow();
|
activateWindow();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,8 @@ class CaptureAreaSelector : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CaptureAreaSelector(Capturer &capturer, const Settings &settings,
|
CaptureAreaSelector(Capturer &capturer, const Settings &settings,
|
||||||
const CommonModels &models, const QPixmap &pixmap);
|
const CommonModels &models, const QPixmap &pixmap,
|
||||||
|
const QPoint &pixmapOffset);
|
||||||
~CaptureAreaSelector();
|
~CaptureAreaSelector();
|
||||||
|
|
||||||
void activate();
|
void activate();
|
||||||
@ -50,6 +51,7 @@ private:
|
|||||||
Capturer &capturer_;
|
Capturer &capturer_;
|
||||||
const Settings &settings_;
|
const Settings &settings_;
|
||||||
const QPixmap &pixmap_;
|
const QPixmap &pixmap_;
|
||||||
|
const QPoint &pixmapOffset_;
|
||||||
Generation generation_{};
|
Generation generation_{};
|
||||||
QPoint startSelectPos_;
|
QPoint startSelectPos_;
|
||||||
QPoint currentSelectPos_;
|
QPoint currentSelectPos_;
|
||||||
|
@ -15,7 +15,7 @@ Capturer::Capturer(Manager &manager, const Settings &settings,
|
|||||||
: manager_(manager)
|
: manager_(manager)
|
||||||
, settings_(settings)
|
, settings_(settings)
|
||||||
, selector_(std::make_unique<CaptureAreaSelector>(*this, settings_, models,
|
, selector_(std::make_unique<CaptureAreaSelector>(*this, settings_, models,
|
||||||
pixmap_))
|
pixmap_, pixmapOffset_))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +56,7 @@ void Capturer::updatePixmap()
|
|||||||
|
|
||||||
QPixmap combined(rect.size());
|
QPixmap combined(rect.size());
|
||||||
QPainter p(&combined);
|
QPainter p(&combined);
|
||||||
|
p.translate(-rect.topLeft());
|
||||||
|
|
||||||
for (const auto screen : screens) {
|
for (const auto screen : screens) {
|
||||||
const auto geometry = screen->geometry();
|
const auto geometry = screen->geometry();
|
||||||
@ -66,6 +67,9 @@ void Capturer::updatePixmap()
|
|||||||
|
|
||||||
SOFT_ASSERT(selector_, return );
|
SOFT_ASSERT(selector_, return );
|
||||||
pixmap_ = combined;
|
pixmap_ = combined;
|
||||||
|
pixmapOffset_ = rect.topLeft();
|
||||||
|
|
||||||
|
for (auto &r : screenRects) r.translate(-rect.topLeft());
|
||||||
selector_->setScreenRects(screenRects);
|
selector_->setScreenRects(screenRects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,5 +26,6 @@ private:
|
|||||||
Manager &manager_;
|
Manager &manager_;
|
||||||
const Settings &settings_;
|
const Settings &settings_;
|
||||||
QPixmap pixmap_;
|
QPixmap pixmap_;
|
||||||
|
QPoint pixmapOffset_;
|
||||||
std::unique_ptr<CaptureAreaSelector> selector_;
|
std::unique_ptr<CaptureAreaSelector> selector_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user