wxGTK3 PopupMenu wrong position with dual screen

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

wxGTK3 PopupMenu wrong position with dual screen

Eran Ifrah
Hi,
The menu is positioned in wrong position when using dual screen with different sizes. I am not sure if this is GTK only related, but this is where I encounter this problem.

I am using wxGTK3 (about ~20 commits behind master)
My configuration is: 2 screens, the first one (on the left) is 1080x1920 and the one of the RIGHT is 3840x2160 and is set to PRIMARY display.

To reproduce the problem:
- Open the menu sample app
- Move it to the RIGHT screen (the 4K display), move it so it will be placed on the RIGHT side of the display (this part is important)
- Right click in the demo app, the popeup menu is placed on the far LEFT

I debugged it a bit and it seems that the problem is coming from this method:
wxPopupMenuPositionCallback in gtk/window.cpp

It seems that this function attempts to make sure that the menu is fully visible, it does that by getting the screen size and making sure that the menu's coordinates are inside the screen's area. However, wxGetDisplaySize() returns only the primary display size (3840x2160) and it does not take into account the secondary display size.

Thanks!





--
Eran Ifrah,
Author of CodeLite, a cross platform open source C/C++ IDE: http://www.codelite.org

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
 
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Reply | Threaded
Open this post in threaded view
|

Re: wxGTK3 PopupMenu wrong position with dual screen

Eran Ifrah
Attached is a patch I applied locally to my copy of wxWidgets which seems to fix the problem

Thanks

On Mon, Oct 15, 2018 at 2:41 PM Eran Ifrah <[hidden email]> wrote:
Hi,
The menu is positioned in wrong position when using dual screen with different sizes. I am not sure if this is GTK only related, but this is where I encounter this problem.

I am using wxGTK3 (about ~20 commits behind master)
My configuration is: 2 screens, the first one (on the left) is 1080x1920 and the one of the RIGHT is 3840x2160 and is set to PRIMARY display.

To reproduce the problem:
- Open the menu sample app
- Move it to the RIGHT screen (the 4K display), move it so it will be placed on the RIGHT side of the display (this part is important)
- Right click in the demo app, the popeup menu is placed on the far LEFT

I debugged it a bit and it seems that the problem is coming from this method:
wxPopupMenuPositionCallback in gtk/window.cpp

It seems that this function attempts to make sure that the menu is fully visible, it does that by getting the screen size and making sure that the menu's coordinates are inside the screen's area. However, wxGetDisplaySize() returns only the primary display size (3840x2160) and it does not take into account the secondary display size.

Thanks!





--
Eran Ifrah,
Author of CodeLite, a cross platform open source C/C++ IDE: http://www.codelite.org


--
Eran Ifrah,
Author of CodeLite, a cross platform open source C/C++ IDE: http://www.codelite.org

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
 
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users

disiplay.diff (1K) Download Attachment