lxqt / qterminal

A lightweight Qt-based terminal emulator
https://lxqt.github.io
GNU General Public License v2.0
611 stars 153 forks source link

Dropdown terminal on wayland always on the same monitor #1142

Open stefonarch opened 5 months ago

stefonarch commented 5 months ago

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
tsujan commented 1 week ago

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 commented 1 week ago

A more accurate explanation:

The enum ScreenFromCompositor opens the window on the screen with the cursor. So far, so good. However, the window is opened with the pixel ratio it had before.

For example, suppose there are two screens with the same resolution, but the second one has a scale factor of 2. You put the mouse cursor into the first screen and open the dropdown window. Then you close it, put the cursor inside the second screen, and reopen it. Although the pixel ratio of the second screen is 2.0, that of the window is still 1.0. The result is a huge window.

It may be asked, "who scales only one of two monitors that have the same resolution?!" That was only one example; a similar (but a little more complex) situation happens with different resolutions, when only one screen is scaled, or when scale factors are different: we'll end up with a wrong window size — either too big, or too small.

tsujan commented 6 days ago

For reference: https://bugs.kde.org/show_bug.cgi?id=482733, https://bugs.kde.org/show_bug.cgi?id=485069, https://bugs.kde.org/show_bug.cgi?id=488780, and probably more.