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

Dropdown terminal on wayland always on the same monitor #1142

Closed
stefonarch opened this issue Jun 19, 2024 · 4 comments · Fixed by #1196
Closed

Dropdown terminal on wayland always on the same monitor #1142

stefonarch opened this issue Jun 19, 2024 · 4 comments · Fixed by #1196
Labels
platform:Wayland Wayland-specific issues

Comments

@stefonarch
Copy link
Member

stefonarch commented Jun 19, 2024

We could use layershell->setScreenConfiguration(LayerShellQt::Window::ScreenConfiguration::ScreenFromCompositor); to open it where the cursor is, the downside is that it takes a screen resolution/size from one monitor and applies always that.

Possible Solution

A menu entry similar to lxqt-runner: On wayland open on monitor: active, 1, 2, ?

Steps to Reproduce (for bugs)
  1. Use dropdown terminal on wayland with a dual head setup with different resolutions.
  2. Move cursor between monitors and press shortcut
System Information
  • QTerminal version: git
@stefonarch stefonarch moved this to Todo/Issues in Wayland Support Jun 19, 2024
@tsujan
Copy link
Member

tsujan commented Nov 19, 2024

the downside is that it takes a screen resolution/size from one monitor and applies always that.

Actually, there's an effective workaround for that.

The deeper problem arises when the second (third,...) monitor is scaled. Then the window will keep its pixel ratio (= scale factor) inside it, and that will ruin everything. This can be seen in lxqt-runner (and other Qt apps) too, although it's tolerable there because lxqt-runner usually has a small window.

All in all, a correct size for the drop-down window isn't guaranteed with multi-screen setups in general.

@tsujan tsujan added the platform:Wayland Wayland-specific issues label Nov 19, 2024
@tsujan
Copy link
Member

tsujan commented Nov 19, 2024

A more accurate explanation:

The enum ScreenFromCompositor opens the window on the screen with the cursor. So far, so good. However, with the avialable Qt methods. we can know the focused screen (containing the cursor) only after the window is shown, and even then, the reported screen will be wrong if the top left corner of the window is on another screen. Therefore, there's no reliable way of showing the dropdown window with a correct size on the focused screen.

I experimented with several workarounds (e.g., a tiny, transparent, dummy widget), but all of them had bad side effects, to say nothing of their complexity.

@tsujan
Copy link
Member

tsujan commented Nov 20, 2024

tsujan added a commit that referenced this issue Nov 28, 2024
All complex problems in implementing this feature were caused by resizing the window programmatically on Wayland, as was done on X11. This patch sets 4 anchors instead, and then sets the left, right and bottom margins properly on showing the window.

Fixes #1142
@tsujan
Copy link
Member

tsujan commented Nov 28, 2024

A simple idea is implemented in #1196: If this is impossible by resizing the window, then set the anchors and margins instead, and let the Wayland compositor do the resizing job according to them.

@tsujan tsujan closed this as completed in 9ebf250 Nov 28, 2024
@github-project-automation github-project-automation bot moved this from Todo/Issues to Done in Wayland Support Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:Wayland Wayland-specific issues
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants