Clients reading their surface position on screen
Christopher James Halse Rogers
chris at cooperteam.net
Tue Aug 12 03:17:30 UTC 2014
On Tue, Aug 12, 2014 at 1:13 PM, Daniel van Vugt
<daniel.van.vugt at canonical.com> wrote:
> I think it's mathematically pedantic to say the function does not
> exist.
The *best kind* of pedantry!
> Acknowledging that such a function would theoretically return a set;
> one, multiple or none coordinates (offscreen or occluded), we can
> dumb it down to the simple case that's important -- give one or zero
> results:
>
> // Returns one screen location where the specified surface coordinate
> // is visible. Returns false if the coordinate is not visible on
> // screen at all.
>
> MirBool mir_surface_coord_to_screen(MirSurface* surf,
> int localx, int localy,
> int* screenx, int* screeny);
>
> Admittedly that only works for your own surfaces created in your own
> process.
And I'm perfectly happy for this API to exist in libmirclient-debug,
and return FALSE when not run with --debug.
What I'm not happy with is hooking this up with any higher-level API
like Qt's, which does not have the “oh, but it might not work”
caveat. I'm also much happier if this API doesn't work by default, but
only in exceptional cases, so client code won't accidentally depend on
it.
More information about the Mir-devel
mailing list