3

I found this the hard way. I dove into source code of wx.lib.agw.aui.framemanager and tried to figure out why docking hints don't work properly. I have checked every step until in the very end of calculating a place to draw a hint there was a method ClientToScreen(self,x,y) which should return x,y with an offset of self: wx.Window, but returns x,y with the same offset every time. Then I tried specifying the starting position in the constructor of my main frame, which didn't have any effect on the position of the frame. Then I checked an output from GetScreenPosition while handling EVT_MOVE and it turns out that EVT_MOVE is not even emitted on Wayland, except when you use Move or maximize/minimize the frame (maybe in some other cases, but I have only found mentioned cases).

Inside EVT_MOVE handler GetScreenPosition returns:

  • (0,0) when you maximize the window,
  • the coordinates that you specify in Move when triggered by it (but the Move itself doesn't work)
  • (26, 23) in other cases (including calling it in other places)

Is this a known bug? Maybe I am the only one experiencing it. If not, I will add an issue in wxWidgets/Phoenix.

edit: python 3.6.9, wxPython 4.0.7, Ubuntu 18.04.1, Gnome 3.28.4

yar
  • 71
  • 5
  • I don't think there would be any Python-specific problem for these issues, check if there is already a ticket for it at https://trac.wxwidgets.org/ – RobinDunn Jan 10 '20 at 23:28
  • @RobinDunn I have made this post before making a ticket because it seems like a very obvious thing to notice. I can't even specify the starting position of a window, yet I haven't seen a single thread/post/ticket/question even mentioning it. And I haven't found a ticket for it with wayland tag (with x it works as intended), so I thought it is a well-known issue or it has something to do with my system (maybe upgrading gnome or installing a specific package would fix it). – yar Jan 11 '20 at 18:46
  • @RobinDunn Given the explanation and link in the answer below, it would be useful to add some information about this non-functionality in the wxPython docs. I have been trying very hard to make wx.Frame.CentreOnScreen() work for a few weeks now. If the docs would have said that this does not work on Wayland, I wouldn't be so sleep deprived as I am right now. – mbrennwa Sep 29 '20 at 14:34

1 Answers1

3

https://lists.freedesktop.org/archives/wayland-devel/2015-September/024410.html

It is a design decision in Wayland/desktop to not expose absolute window positions to clients at all. This means that you simply cannot know where a top-level window is precisely, you can only know which outputs it overlaps with.

You can set an environment variable GDK_BACKEND=x11 to force Xwayland and the problem is solved. It doesn't seem to be a long term solution, but it works.

yar
  • 71
  • 5