Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinned screenshot on linux can't be moved outside the screen #1786

Closed
elie-g opened this issue Jul 29, 2021 · 13 comments
Closed

Pinned screenshot on linux can't be moved outside the screen #1786

elie-g opened this issue Jul 29, 2021 · 13 comments

Comments

@elie-g
Copy link

elie-g commented Jul 29, 2021

Flameshot version
Version 0.10.1

Describe the bug
On Windows pinned screenshots can be moved outside the screen but on linux they cannot.

To Reproduce

  1. Take a screenshot
  2. Pin the screenshot
  3. Try moving the pinned screenshot outside the screen

Expected behavior

I expected the same behaviour on linux as on windows.

It would be nice to be able to move a screenshot outside the screen like on Windows so it doesn't obstruct anything while I don't need it but still want to keep it pinned for later use.

System Information
Ubuntu 20.10 Groovy

@mmahmoudian
Copy link
Member

mmahmoudian commented Jul 30, 2021

@borgmanJeremy I checked with Manjaro KDE and Flameshot v0.10.1 and it does not go out side of the screen. There has been a feature request (#984) for this and it has been reported that it works on Windows but back then I tried with Flameshot v0.9.0 and0 I could not reproduce the behavior on Windows either. At the moment I don't have access to Windows machine to test this, but I wonder if this is something that can be addressed (unified across all platforms we support). I am puzzled and not sure to consider this discrepancy as a bug or partial feature request 😅

@borgmanJeremy
Copy link
Contributor

I looked into this and it is not possible to move a widget off screen on X11 :( . https://forum.qt.io/topic/106141/move-qwidget-offscreen-on-linux I also independently tested this by hard coding negative coordinates.

We can probably do some sort of cropping operation to give the illusion of moving it off the screen, but not sure how complicated that will be yet.

@borgmanJeremy
Copy link
Contributor

Actually much easier than I thought.... Will get the PR put in tomorrow.
Peek 2021-09-13 21-23

@mmahmoudian
Copy link
Member

@borgmanJeremy is it intentional to get cropped at a fraction of the rate of mouse movement (the mouse position drastically changes with respect to the pinned image)?

@borgmanJeremy
Copy link
Contributor

Nope, thats the bug I need to fix before merging :-)

@borgmanJeremy
Copy link
Contributor

@mmahmoudian what do you think the behavior should be in a multimonitor setup?

We can either start truncating the pinned image when it moves past the edge of a screen (Easy)
We can move the pinned image to adjacent monitors and only clip when it hits the furthest edge (Harder)

@mmahmoudian
Copy link
Member

@borgmanJeremy at least on Plasma I can already move the pin from one monitor to another and I actually use that alot when I want to have side-by-side comparison. So I think I have missed what you are asking here.

@borgmanJeremy
Copy link
Contributor

It's okay, I think you answered my question

@mmahmoudian
Copy link
Member

@borgmanJeremy but isn't that managed by the window manager?

@borgmanJeremy
Copy link
Contributor

So the goal here is to create the illusion that the pinned image is moving off screen. We have to create this as an illusion because on the X11 window manager the widget cannot move outside the screen:
image

In order to accomplish this, I am cropping the pinned image as it moves "past" the edge of the screen:
image

This is simple for the case where we move below the origin because I just check if the projected coordinates are negative. But this gets pretty complicated for the positive range with multi monitor. The easy case is just to crop the pinned image to the monitor it was taken from. However what I heard from you is this is likely not desired.
image

So what I will do instead is detect if any part of the pinned image will move off screen, and only then crop it. Some examples of how I think it should work.
image

@mmahmoudian
Copy link
Member

mmahmoudian commented Sep 15, 2021

@borgmanJeremy I'm not aware of the limitations, so here is just my possibly flawed understanding: in X11 all monitors together create a large rectangular "canvas" and at the moment the pin window can move between monitors and also can practically go outside of the monitor region if and only if another monitor has expanded the "canvas". I think all we need to do is to detect the width and height of the "canvas" and create the illusion only when the pin window is pushed outside of this canvas.

In the figure below the monitors are two gray rectangles, the circumference of the "canvas" is marked by gray dashed line, the pinned image is in magenta, the cropped area of the pin is in camouflage pattern,

bitmap

If my understanding and the work-around is correct, then:

  1. we will not face issues when it comes to fractional scaling if the two monitors use different scaling factors
  2. we will not face issues when the two monitors have different resolutions
  3. we do less calculations and use less computational resources
  4. we do not get to the issue of your last illustration that the pinned image gets horizontally cropped if even one pixel of it does not fit in the second monitor

@borgmanJeremy
Copy link
Contributor

@mmahmoudian Can you confirm that that is how it works on X11? I dont have a mixed monitor setup.

@mmahmoudian
Copy link
Member

mmahmoudian commented Sep 15, 2021

@borgmanJeremy I did that before making the figures. The full pink rectangles are where I can already position the pin (Manjaro KDE Plasma)

Now I also tested it on AwesomeWM. It seems in AwesomeWM it can easily move outside of the monitor and also even the "canvas". I didn't know how to record all monitors at the same time, but I tried to create a tall pinned image and move it around to show the behavior.

2021-09-15.19-30-10.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants