flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
23.95k stars 1.52k forks source link

Fix for side panel widget out of screen #3522 #3550

Open petrugrd opened 3 months ago

petrugrd commented 3 months ago

This fixes the issue #3522

The problem was that the panel was moved relative to (0, 0) coordinates, which is not an issue in case of single display, or multiple displays in the same row. Since capture widget is placed on all screens, the point (0, 0) will be the top left corner of virtual screen instead of top left corner of the current screen concluding from QDesktopWidget documentation (*). This caused the panel to be shifted up if the height of the primary screen was smaller than the virtual one.

flameshot-issue-3522

petrugrd commented 3 months ago

Hello @flameshot-org.

I updated also .github/workflows/Windows-pack.yml in order for Windows build to pass successfully. Feel free to take this change in another commit for builds to pass.

BR, Petru.

mmahmoudian commented 3 months ago

@petrugrd Thanks. Looking forward for your PR to get out of draft and merge ready. Also thanks for using the Windows CI.

petrugrd commented 3 months ago

Hi @mmahmoudian, Would be nice if someone tested this first on a Mac with the same screen configuration as pointed in the screenshot. I have doubts that more changes have to be done, which may or may not break other stuff, especially removing the next #if (defined(Q_OS_MACOS)) blocks:

diff --git a/src/widgets/panel/utilitypanel.cpp b/src/widgets/panel/utilitypanel.cpp
index 5fc1889e2f..4fd9310fbd 100644
--- a/src/widgets/panel/utilitypanel.cpp
+++ b/src/widgets/panel/utilitypanel.cpp
@@ -42,7 +42,7 @@ UtilityPanel::UtilityPanel(CaptureWidget* captureWidget)
             m_internalPanel,
             &QWidget::hide);

-#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS))
+#if (defined(Q_OS_MACOS))
     move(0, 0);
 #endif
     hide();
@@ -87,7 +87,7 @@ void UtilityPanel::show()
     m_showAnimation->setEndValue(QRect(0, 0, width(), height()));
     m_internalPanel->show();
     m_showAnimation->start();
-#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS))
+#if (defined(Q_OS_MACOS))
     move(0, 0);
 #endif
     QWidget::show();
mmahmoudian commented 3 months ago

@petrugrd I have no access to MacOS. Maybe @panpuchkov has some access to a mylti-monitor Mac setup.