[RFC : xdg_surface_present() - take 2

Jason Ekstrand jason at jlekstrand.net
Fri Mar 6 21:21:35 PST 2015


Manuel,
Thanks for keeping this going.  I don't have a whole lot of comments at the
moment as it's a pretty small protocol change.  I would like to hear some
commentary from Jasper and some of the other desktop devs though.

The one comment I will make about the protocol is that you may want to
change the documentation a bit.  Instead of specifying that it must be an
interactive gui notification that allows the user to bring up the window.
It might be better to simply specify that the window has new content and
would like the compositor to notify the user.

On Tue, Mar 3, 2015 at 1:15 PM, Bill Spitzak <spitzak at gmail.com> wrote:

>
>  - Pekka Paalanen pointed out the request name was unclear and suggested
>> to use "xdg_surface_needs/wants_attention()" instead. Jasper St. Pierre
>> pointed out that "_NET_WM_STATE_DEMANDS_ATTENTION" already existed in
>> X11 and does not do the same thing. We discussed that again yesterday
>> and thought that present() fitted nicely ;
>>
>
> What about "raise"?
>
>  - Implementing focus stealing prevention between different clients may
>> be easy : just count the delay between the client has been started and
>> its shell surface actually gets mapped, and if it has been too long and
>> the focus is elsewhere, show the surface without focusing it (but with a
>> notification). The notion of "the client has been started" is vague, but
>> at worst, we can use the time when the client did its initial connection
>> to the compositor ;
>>
>
> I suspect that initial connection is going to be far too late. It will be
> after all the dynamic linking and static object initialization and script
> interpretation (imagine if the wayland api is written in the interpreted
> language, it will not open the display until quite a lot of interpretation
> is done), all of which are the real reason modern apps take forever to
> start up.
>

Yes, launching another client is quite possibly going to take a long time.
Some clients are written in C and will start in less than a second.  Other,
heavier clients may take substantially longer.  External processes will
most likely time out.

I would put the serial somewhere that the app can get it, perhaps in an
> environment variable, so it can send it with it's first raise request.
>

I'm not entirely convinced that serials are the right way to do
cross-client focus stealing prevention.  However, I'm open to the idea.


>  - Within a same client application, however, it is harder.
>>
>
> Actually it is impossible without a serial. The serial is the correct
> solution which makes within the same client easier that between clients.
>
>  This raises the question : how do we say "We have no serial to pass",
>> for the standard case ? We repeatedly suggested 0 ("xdg_surface_present
>> (surface, 0)") because serials are incrementing globals, so "0" to be
>> issued would be very-very unlikely. Should we formalize that somewhere
>> in the protocol ?
>>
>
> '0' is useful but should force the "the serial is too old" behavior.
> Anybody who wants a real raise will have to get an actual serial.


By that, do you mean that a serial of 0 should mean "Don't raise just
flash/bounce/whatever"?  If that's the case, then I think I would agree.

It seems that there are three distinct use-cases here:

 1) The client wants to gently alert the user (serial of 0).
 2) The client wants to raise a window (real serial).
 3) The client doesn't have a serial.

I don't know what I think about special-casing 0.  I don't see any problem
with doing so at the moment.  If we were particularly concerned about it,
it would be easy enough to ensure that the serial 0 is never handed out.
What I'm more concerned about is that there are two different cases in
which we don't have a valid serial.  If we're intending to have this be
something that the client calls when it wants attention after it's first
been opened, then this third case may be something we have to consider.
For example, if you run a client on the command-line and give it a file to
open.


>
>  We also want to secure the request from garbage random serials ; the
>> implementation behavior is that there is only one serial valid for a few
>> seconds, if the surface has not been focused for some time, it will not
>> be able to raise itself even if it random()ly finds the formerly "good"
>> serial.
>>
>
> It seems to me the compositor will have to remember very few serials.
> Rather than per-surface I think it would be per-seat. And there would be no
> timeout, instead it would remember the last N button or key presses (N
> quite possibley is 1).
>

Yes, per-seat is most likely what we want.  How many serials do we want to
hold on to?  I think that's kind of depends on how badly we want to pass
serials across clients.  Within a client, one is probably sufficient.  If
we're going to pass it between clients, we probably want to hold on to more
and have a timeout.  We probably also want to do something such as clearing
all serials when the user raises a window.  However, that falls under the
category of heuristics, not protocol.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150306/79d2acad/attachment-0001.html>


More information about the wayland-devel mailing list