After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786455 - [PATCH] gdk/wayland: allow focusing without a specific timestamp
[PATCH] gdk/wayland: allow focusing without a specific timestamp
Status: RESOLVED DUPLICATE of bug 766284
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-08-18 09:34 UTC by Xiang Fan
Modified: 2017-08-23 15:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-gdk-wayland-allow-focusing-without-a-specific-timest.patch (1.05 KB, patch)
2017-08-18 09:34 UTC, Xiang Fan
none Details | Review

Description Xiang Fan 2017-08-18 09:34:03 UTC
Created attachment 357872 [details] [review]
0001-gdk-wayland-allow-focusing-without-a-specific-timest.patch

gtk_get_current_event_time() could return timestamp == GDK_CURRENT_TIME,
which should be handled instead of being simply discarded.
Comment 1 Matthias Clasen 2017-08-22 11:54:14 UTC
this patch doesn't really 'handle' it in any way though, and just passes it through, ignoring the comment that it removes
Comment 2 Xiang Fan 2017-08-22 15:46:42 UTC
(In reply to Matthias Clasen from comment #1)
> this patch doesn't really 'handle' it in any way though, and just passes it
> through, ignoring the comment that it removes

It's handled in mutter:
https://git.gnome.org/browse/mutter/tree/src/core/window.c#n3395

Also please look at this commit:
[window: Treat CurrentTime as legal timestamp in activation]
https://git.gnome.org/browse/mutter/commit/?id=5defe574d74eace55bfe9e7e79ffaaa40f50372f

So IMHO it's safe to consider GDK_CURRENT_TIME valid and just pass it through.
Comment 3 Matthias Clasen 2017-08-23 11:43:33 UTC
that does not do any of the things outlined in the gdk comment, afaics
Comment 4 Carlos Garnacho 2017-08-23 11:48:11 UTC
(In reply to Xiang Fan from comment #2)
> (In reply to Matthias Clasen from comment #1)
> > this patch doesn't really 'handle' it in any way though, and just passes it
> > through, ignoring the comment that it removes
> 
> It's handled in mutter:
> https://git.gnome.org/browse/mutter/tree/src/core/window.c#n3395
> 
> Also please look at this commit:
> [window: Treat CurrentTime as legal timestamp in activation]
> https://git.gnome.org/browse/mutter/commit/
> ?id=5defe574d74eace55bfe9e7e79ffaaa40f50372f
> 
> So IMHO it's safe to consider GDK_CURRENT_TIME valid and just pass it
> through.

I'd like to point out that mutter figuring out a decent timestamp for the request does not mean that passing GDK_CURRENT_TIME is correct, nor desirable according to the semantics of a "present" request.

What would happen here is that the request gets the timestamp at the time Mutter is processing the request, not the time of the input event that triggered the window to be shown. The latter is useful to Mutter to determine whether there was further activity after the present request, the former is a randomly recent timestamp that will beat anything else, and pretty much defeats the purpose of a timestamp in the "present" request.
Comment 5 Timm Bäder 2017-08-23 11:58:25 UTC
So, as far as I can see inside gtkwindow.c we ask the X11 backend for a "user timestamp", which iirc is just the timestamp of the last event received, regardless of the type of event. Is that something the wayland backend should fall back to for GDK_CURRENT_TIME as well? Should it be backend agnostic?
Comment 6 Xiang Fan 2017-08-23 12:07:21 UTC
(In reply to Carlos Garnacho from comment #4)
> I'd like to point out that mutter figuring out a decent timestamp for the
> request does not mean that passing GDK_CURRENT_TIME is correct, nor
> desirable according to the semantics of a "present" request.
> 
> What would happen here is that the request gets the timestamp at the time
> Mutter is processing the request, not the time of the input event that
> triggered the window to be shown. The latter is useful to Mutter to
> determine whether there was further activity after the present request, the
> former is a randomly recent timestamp that will beat anything else, and
> pretty much defeats the purpose of a timestamp in the "present" request.

If the event comes from an external source not known to Wayland (e.g. type gedit in terminal when a gedit window is already open) the client can't figure out the timestamp anyway. How do we handle this?
Comment 7 Michael Catanzaro 2017-08-23 15:03:29 UTC
Pretty sure this bug is a duplicate of bug #766284, right?

*** This bug has been marked as a duplicate of bug 766284 ***