Clients reading their surface position on screen
Christopher James Halse Rogers
chris at cooperteam.net
Tue Jul 22 04:49:30 UTC 2014
On Tue, Jul 22, 2014 at 10:04 AM, Thomi Richards
<thomi.richards at canonical.com> wrote:
> I commented on the bug, but I may as well comment here:
> On Tue, Jul 22, 2014 at 11:42 AM, Gerry Boland
> <gerry.boland at canonical.com> wrote:
>> 3. Mir let the clients find their surface's screen position
> I'm pushing for this solution, for a variety of reasons. The main one
> is that the QWidget::mapToGlobal call is what we use to determine
> global screen coordinates for each widget. The documentation
> (http://qt-project.org/doc/qt-5/qwidget.html#mapToGlobal) says:
>> Translates the widget coordinate pos to global screen coordinates.
>> For example, mapToGlobal(QPoint(0,0)) would give the global
>> coordinates of the top-left pixel of the widget.
> There's nothing in there that says "this may not be supported by the
> current platform". To my mind, there's a contract here between the
> application and Qt, which, if we want to support Qt on mir, has to
> remain valid. Autopilot uses this call on X11 platforms, it should be
> able to use exactly the same call on mir. Autopilot-qt makes no
> X11-specific calls, we *just* use the Qt API
So, Qt actually has a whole bunch of holes where an API just plain
isn't supported on all platforms but makes no mention of it. This is
one of them.
That call also fails on Wayland compositors, for example.
This should be fixed in Qt by documenting that this doesn't succeed on
all platforms, and allowing you to check whether you're on a platform
where it will.
More information about the Mir-devel