13 Commits

Author SHA1 Message Date
Artem Lytkin 9a06db4a92 Fix pin size on Windows for scaled screen (#4907)
Pinning a capture on a display with 150% scaling produces a pin window
half again as large as the region that was selected. #4614 fixed the
position of that window for v14.0.0; this is the size.

A capture started from the tray icon is fine, because the tray lives in
the daemon and createPin() hands the pixmap straight to attachPin().
Any invocation that runs in its own process instead -- `flameshot gui`
from a shell, a desktop or AutoHotkey shortcut, D-Bus -- finds
FlameshotDaemon::instance() null and serializes the capture to the
daemon. QDataStream writes a QPixmap as a plain image, which carries no
device pixel ratio, so the daemon reconstructs a pixmap that claims a
ratio of 1. PinWidget then lays out device pixels as if they were
logical ones and the window comes out too large by the scale factor.
The built-in PrintScreen hook is not affected; it runs inside the daemon
and takes the in-process path.

Send the ratio next to the pixmap so the serialized path ends up with
the same pixmap the in-process path already gets. Both transports share
the reading half, since the D-Bus adapter and the KDSingleApplication
handler each deserialize the message themselves. A message from an older
flameshot has no ratio appended; the read runs past the end, the stream
reports it, and the pixmap keeps the ratio it already had.

Checked on Windows 11, 1024x768 screen, QT_SCALE_FACTOR=1.5, pinning a
400x300 region. The pin window measured 621x471 before and 422x321
after. The capture is 400x300 device pixels either way, so the pin
should be that plus the 7pt margin on each side, and the patched size
matches the 414x314 measured on an unscaled screen to within the scaled
margin. Unscaled displays measured 414x314 both before and after.
2026-08-27 19:46:02 -05:00
borgmanJeremy 8cf641d0da Added dbus capture (#4605) 2026-03-31 09:52:16 -05:00
Haris Gušić 233c765b1f Reduce dependence on D-Bus (#2003)
* Handle captures without sigslots

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Set {app,organization}Name and version consistently

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make 'full' dbus-free

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move CaptureRequest::exportCapture to Controller

We need to wait until the upload widget (or similar widgets) have
finished before exiting. This must be done using a signal. The problem
is that CaptureRequest can't be guaranteed to survive until the widget
has finished what it's doing.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Use QApplication with the 'full' subcommand

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Do unto 'screen' as we did to 'full'

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add FlameshotDaemon singleton class

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Support clipboard hosting for both pixmaps and text

* Fix upload handling

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Do not show tray icon if not daemon

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Clean up handling of pin task

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove annoying Qt warning messages

The messages were caused by the color wheel.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix small bug in Controller::exportCapture

* Fix --raw output

* Make 'gui' dbus-independent

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix accept on select bug

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix compile error on Windows

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make it work on Windows

* Remove obsolete function in main.cpp

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make 'launcher' work without dbus

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* clang-format, sigh

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Enable CLI parsing on MacOS

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make 'config' work without dbus

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Small refactor of capture request handling

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove obsolete DBusUtils

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove unused D-Bus sigslots

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove D-Bus methods openConfig, autostartEnabled and trayIconEnabled

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove D-Bus method requestCapture

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove CaptureRequest id mechanism

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix 'launcher' crash

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Handle clipboard notifications properly

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add 'autoCloseIdleDaemon' option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Document FlameshotDaemon class

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make 'flameshot gui' run in single-application mode

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add `allowmultipleGuiInstances` config option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix endless loop with multiple GUI instances

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move upload confirmation dialog where it belongs

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add the new config options to the GUI as well

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix failing build on Windows

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Handle persistence on MacOS

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* fixed notifications on macos

* Fixed display on macos

* Reformat tests/action_options.sh

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix infinite recursion in tests/action_options.sh

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

Co-authored-by: Dearsh Oberoi <59907159+deo002@users.noreply.github.com>
Co-authored-by: Jeremy Borgman <borgman.jeremy@pm.me>
2021-12-08 22:18:39 +01:00
Haris Gušić 73e6762e3d Remove redundant DBus methods
NOTE: This breaks KDE shortcuts
2021-10-08 19:11:22 +02:00
Haris Gušić 5ee85ed5c0 Add requestCapture DBus call
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:22 +02:00
a1346054 b95e096136 Simple maintenance improvements (#1918)
* Use license file from gnu.org

Downloaded from:
https://www.gnu.org/licenses/gpl-3.0.txt

* Add missing final newline

* Fix link

* Fix shellcheck warnings

* Move donation header one level up

* Fix typos

* Stop mixing tabs and spaces

* Trim trailing whitespace
2021-09-27 20:33:45 -05:00
Haris Gušić 584bcd7f6c Add --clipboard to gui subcommand (#1829)
* Add --clipboard to gui subcommand

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Prevent duplicate notification

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-08-20 13:09:06 -05:00
brimston3 e2bd91a1de Add captureSaved to dbus interface description 2021-01-15 12:49:33 -06:00
Jeremy Fleischman 05c2bc6ae7 Added a gui --selection option to print out the geometry of the selection.
Fixes #425.
2020-10-26 11:46:39 -05:00
Daniel Schaefer dea3c7bb87 dbus/org.dharkael.Flameshot.xml: Mark id as uint
In src/core/flameshotdbusadapter.h the id is marked as uint.
All other types in the xml are correct.
2020-09-07 19:33:10 -05:00
Boyuan Yang a8fb73b668 Use ${CMAKE_INSTALL_PREFIX} to provide APP_PREFIX
Currently the value of $prefix is hardcoded in the source code.
This is not a good choice given we have switched to CMake and
that CMake provides the builtin variable ${CMAKE_INSTALL_PREFIX}
to provide this information.

This patch uses the value of ${CMAKE_INSTALL_PREFIX} to populate
flameshot's internal variable APP_PREFIX as well as using it
in generating the org.flameshot.Flameshot.service file with
a proper $prefix value (via CMAKE_INSTALL_FULL_BINDIR as provided
by GNUInstallDirs).
2020-09-04 20:43:35 -05:00
borgmanJeremy c0e2e48db4 Fix CMake Package and DBUS Names (#819)
* Fix CMake Packaging to properly package assets.
2020-09-04 19:29:37 -05:00
Jeremy Borgman f5013df306 First pass at converting from qmake to cmake. 2020-07-10 20:10:14 -05:00