enaml icon indicating copy to clipboard operation
enaml copied to clipboard

PopupView positions incorrectly with multiple displays

Open frmdstryr opened this issue 1 year ago • 3 comments

The ensure_on_screen function in https://github.com/nucleic/enaml/blob/main/enaml/qt/q_popup_view.py#L866 seems to mess up the popup location when multiple screens are present (at least on linux with Qt6, didn't test anything else).

I have 3 screens and it places the popup on the first leftmost screen when the window is on the rightmost screen. If that function is commented out then it works as I would expect.

frmdstryr avatar Jul 20 '22 16:07 frmdstryr

I think the root issue comes from _get_screen on line 829 which somehow does not get the parent screen. However I do not have access to a multi screen setup ATM to investigate.

MatthieuDartiailh avatar Jul 20 '22 17:07 MatthieuDartiailh

I tested this feature extensively on Windows with a three screen setup when I wrote it.

It may be something wonky with your Linux setup.

On Wed, Jul 20, 2022 at 12:56 Matthieu Dartiailh @.***> wrote:

I think the root issue comes from _get_screen on line 829 which somehow does not get the parent screen. However I do not have access to a multi screen setup ATM to investigate.

— Reply to this email directly, view it on GitHub https://github.com/nucleic/enaml/issues/499#issuecomment-1190583491, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABBQSP4HC4K2WQ3TOZ3P4LVVA4UBANCNFSM54ELL3RQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sccolbert avatar Jul 20 '22 17:07 sccolbert

Perhaps it can be disabled on linux? I added a few print statements

target_pos=PyQt6.QtCore.QPoint(4800, 750)
anchor_pos=PyQt6.QtCore.QPoint(100, 0)
trial_geo=PyQt6.QtCore.QRect(4700, 720, 200, 69) # This is the correct position on my screen
desk_geo=PyQt6.QtCore.QRect(0, 0, 1920, 1080)
geo=PyQt6.QtCore.QRect(1720, 720, 200, 69)

~~I'm curious if desk_geo returns all monitors as one big screen on windows?~~ Edit: Looks like X11 does this. At least on my setup it appears to be clamping it to within a single screen size (my setup is 3 FHD screens in a horizontal line).

There is a note in QScreen https://doc.qt.io/qt-5/qscreen.html#availableGeometry-prop

Note, on X11 this will return the true available geometry only on systems with one monitor and if window manager has set _NET_WORKAREA atom. In all other cases this is equal to geometry(). This is a limitation in X11 window manager specification.

Edit: It appears to be X11 only, on wayland it works fine.

frmdstryr avatar Jul 20 '22 18:07 frmdstryr

Closed by #500

MatthieuDartiailh avatar Aug 12 '22 12:08 MatthieuDartiailh