Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/Linux-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- 'README.md'
- 'LICENSE'
- 'docs/**'
- 'data/translations/*.ts'

workflow_dispatch:

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/MacOS-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- 'README.md'
- 'LICENSE'
- 'docs/**'
- 'data/translations/*.ts'

workflow_dispatch:

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/Windows-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- 'README.md'
- 'LICENSE'
- 'docs/**'
- 'data/translations/*.ts'

workflow_dispatch:

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- 'README.md'
- 'LICENSE'
- 'docs/**'
- 'data/translations/*.ts'

workflow_dispatch:

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ on:
- 'README.md'
- 'LICENSE'
- 'docs/**'
- 'data/translations/*.ts'
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'docs/**'
- 'data/translations/*.ts'

workflow_dispatch:

Expand Down
26 changes: 8 additions & 18 deletions src/tools/pin/pinwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QGraphicsDropShadowEffect>
#include <QGraphicsOpacityEffect>
#include <QPinchGesture>
#include <QWindow>

#include "pinwidget.h"
#include "qguiappcurrentscreen.h"
Expand Down Expand Up @@ -34,12 +35,11 @@ PinWidget::PinWidget(const QPixmap& pixmap,
, m_shadowEffect(new QGraphicsDropShadowEffect(this))
{
setWindowIcon(QIcon(GlobalValues::iconPath()));
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint |
Qt::Dialog);
setFocusPolicy(Qt::StrongFocus);
// set the bottom widget background transparent
setAttribute(Qt::WA_TranslucentBackground);
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle("flameshot-pin");
ConfigHandler conf;
m_baseColor = conf.uiColor();
m_hoverColor = conf.contrastUiColor();
Expand Down Expand Up @@ -69,10 +69,6 @@ PinWidget::PinWidget(const QPixmap& pixmap,
static_cast<int>(static_cast<double>(MARGIN) * devicePixelRatio);
QRect adjusted_pos = geometry + QMargins(margin, margin, margin, margin);
setGeometry(adjusted_pos);
#if defined(Q_OS_LINUX)
setWindowFlags(Qt::X11BypassWindowManagerHint);
#endif

#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX)
if (currentScreen != nullptr) {
QPoint topLeft = currentScreen->geometry().topLeft();
Expand Down Expand Up @@ -152,19 +148,13 @@ void PinWidget::mouseDoubleClickEvent(QMouseEvent*)

void PinWidget::mousePressEvent(QMouseEvent* e)
{
m_dragStart = e->globalPosition();
m_offsetX = e->position().x() / width();
m_offsetY = e->position().y() / height();
if (QWindow* window = windowHandle(); window != nullptr) {
window->startSystemMove();
return;
}
}

void PinWidget::mouseMoveEvent(QMouseEvent* e)
{
const QPointF delta = e->globalPosition() - m_dragStart;
const int offsetW = width() * m_offsetX;
const int offsetH = height() * m_offsetY;
move(m_dragStart.x() + delta.x() - offsetW,
m_dragStart.y() + delta.y() - offsetH);
}
void PinWidget::mouseMoveEvent(QMouseEvent* e) {}

void PinWidget::keyPressEvent(QKeyEvent* event)
{
Expand Down
2 changes: 0 additions & 2 deletions src/tools/pin/pinwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class PinWidget : public QWidget
QPixmap m_pixmap;
QVBoxLayout* m_layout;
QLabel* m_label;
QPointF m_dragStart;
qreal m_offsetX{}, m_offsetY{};
QGraphicsDropShadowEffect* m_shadowEffect;
QColor m_baseColor, m_hoverColor;

Expand Down
Loading