GNOME Bugzilla – Bug 782325
wayland: Add possibility to get the exported handle multiple times
Last modified: 2018-05-02 18:27:17 UTC
Extends the API in a backward compatible way where the caller can call export multiple times, getting the same exported handle. For gtk4 we should consider changing the API some how. For example adding a handle to the unexport means we can export the same surface multiple times with unique handles. If we add a intermediate object, we can add the abilitiy to unexport before having received the handle (though this would of course make the API more complicated).
Created attachment 351349 [details] [review] GdkWaylandWindow: Allow calling export() multiple time Allow getting the same export handle multiple times by calling gdk_wayland_window_export_handle() multiple times. For each time export() is called, a unexport() must be called to unexport. When the window is already exported, the exported callback is called via a idle handler. If there are multiple export() calls, they are invoked in order either when the handle is received by the display server, or when the idle callback is invoked. Calling unexport() will not affect future invokations of the exported callback, unless all export() calls have their unexport() call count matched.
Created attachment 351350 [details] [review] tests: Add testforeign Add a test for exporting a handle. There are no GTK+ API for this, but only per backend GDK API, and so far only Wayland is supported. There is a private GdkWindow API but it's not exposed externally.
Review of attachment 351349 [details] [review]: ::: gdk/wayland/gdkwindow-wayland.c @@ +4184,2 @@ + if (impl->exported.handle && !impl->exported.idle_source_id) + impl->exported.idle_source_id = g_idle_add (exported_idle, window); Do we need to do something about a possibly still pending idle when the window is finalized ? I see we call gdk_wayland_window_unexport in finalize, but that doesn't seem to touch the idle
Review of attachment 351350 [details] [review]: looks good to me
(In reply to Matthias Clasen from comment #3) > Review of attachment 351349 [details] [review] [review]: > > ::: gdk/wayland/gdkwindow-wayland.c > @@ +4184,2 @@ > + if (impl->exported.handle && !impl->exported.idle_source_id) > + impl->exported.idle_source_id = g_idle_add (exported_idle, window); > > Do we need to do something about a possibly still pending idle when the > window is finalized ? > > I see we call gdk_wayland_window_unexport in finalize, but that doesn't seem > to touch the idle Yepp. Need to remove it. I'll update the patch.
Created attachment 351433 [details] [review] GdkWaylandWindow: Allow calling export() multiple time Allow getting the same export handle multiple times by calling gdk_wayland_window_export_handle() multiple times. For each time export() is called, a unexport() must be called to unexport. When the window is already exported, the exported callback is called via a idle handler. If there are multiple export() calls, they are invoked in order either when the handle is received by the display server, or when the idle callback is invoked. Calling unexport() will not affect future invokations of the exported callback, unless all export() calls have their unexport() call count matched.
Review of attachment 351433 [details] [review]: ::: gdk/wayland/gdkwindow-wayland.c @@ +4120,3 @@ + * gdk_wayland_window_unexport_handle() must be called the same number of times + * as gdk_wayland_window_export_handle() was called. Any 'exported' callback + * may still be invoked until the window is unexported or destoryed. typo: destroyed
Created attachment 352120 [details] [review] GdkWaylandWindow: Allow calling export() multiple time Allow getting the same export handle multiple times by calling gdk_wayland_window_export_handle() multiple times. For each time export() is called, a unexport() must be called to unexport. When the window is already exported, the exported callback is called via a idle handler. If there are multiple export() calls, they are invoked in order either when the handle is received by the display server, or when the idle callback is invoked. Calling unexport() will not affect future invokations of the exported callback, unless all export() calls have their unexport() call count matched.
Not marking fixed as it's not on master yet. Attachment 351350 [details] pushed as e5ed52b - tests: Add testforeign Attachment 352120 [details] pushed as dba57db - GdkWaylandWindow: Allow calling export() multiple time
Why is the documentation blurb talking about "Up until 3.22.12" and "Starting with 3.22.13" when this made it into 3.22.16, not .13?
Created attachment 354212 [details] [review] GdkWaylandWindow: Fix version numbers in export_handle() docs This change appeared first in 3.22.16 release, not 3.22.13.
Review of attachment 354212 [details] [review]: Good catch.
Comment on attachment 354212 [details] [review] GdkWaylandWindow: Fix version numbers in export_handle() docs Attachment 354212 [details] pushed as bb13421 - GdkWaylandWindow: Fix version numbers in export_handle() docs
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/814.