Skip to content

Commit

Permalink
xxx: add debugging to pin widget
Browse files Browse the repository at this point in the history
  • Loading branch information
toofar committed Dec 28, 2023
1 parent 5b1b0d9 commit 6cc5472
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/tools/pin/pinwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ PinWidget::PinWidget(const QPixmap& pixmap,
const int margin =
static_cast<int>(static_cast<double>(MARGIN) * devicePixelRatio);
QRect adjusted_pos = geometry + QMargins(margin, margin, margin, margin);
debugText << QStringLiteral("orig geom: %1x%2+%3+%4")
.arg(geometry.x())
.arg(geometry.y())
.arg(geometry.width())
.arg(geometry.height())
;
debugText << QStringLiteral("margin: %1")
.arg(margin)
;
setGeometry(adjusted_pos);
#if defined(Q_OS_LINUX)
setWindowFlags(Qt::X11BypassWindowManagerHint);
Expand All @@ -85,6 +94,12 @@ PinWidget::PinWidget(const QPixmap& pixmap,
adjusted_pos.setHeight(adjusted_pos.size().height() / devicePixelRatio);
resize(0, 0);
move(adjusted_pos.x(), adjusted_pos.y());
debugText << QStringLiteral("adjusted geom: %1x%2+%3+%4")
.arg(adjusted_pos.x())
.arg(adjusted_pos.y())
.arg(adjusted_pos.width())
.arg(adjusted_pos.height())
;
}
//#endif
grabGesture(Qt::PinchGesture);
Expand Down Expand Up @@ -338,6 +353,11 @@ void PinWidget::showContextMenu(const QPoint& pos)
contextMenu.addSeparator();
contextMenu.addAction(&closePinAction);

contextMenu.addSeparator();
for (auto str : debugText) {
contextMenu.addAction(new QAction(str, this));
}

contextMenu.exec(mapToGlobal(pos));
}

Expand Down
1 change: 1 addition & 0 deletions src/tools/pin/pinwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class PinWidget : public QWidget
unsigned int m_rotateFactor{ 0 };
qreal m_currentStepScaleFactor{ 1 };
bool m_sizeChanged{ false };
QList<QString> debugText;

private slots:
void showContextMenu(const QPoint& pos);
Expand Down
1 change: 1 addition & 0 deletions src/utils/screengrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool& ok)
#endif
}

// TODO: is this method bugged on not wayland and not windows?
QRect ScreenGrabber::screenGeometry(QScreen* screen)
{
QPixmap p;
Expand Down

0 comments on commit 6cc5472

Please sign in to comment.