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 782325 - wayland: Add possibility to get the exported handle multiple times
wayland: Add possibility to get the exported handle multiple times
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-05-08 12:59 UTC by Jonas Ådahl
Modified: 2018-05-02 18:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GdkWaylandWindow: Allow calling export() multiple time (9.02 KB, patch)
2017-05-08 13:00 UTC, Jonas Ådahl
none Details | Review
tests: Add testforeign (4.26 KB, patch)
2017-05-08 13:00 UTC, Jonas Ådahl
committed Details | Review
GdkWaylandWindow: Allow calling export() multiple time (8.46 KB, patch)
2017-05-09 13:20 UTC, Jonas Ådahl
none Details | Review
GdkWaylandWindow: Allow calling export() multiple time (8.46 KB, patch)
2017-05-19 03:05 UTC, Jonas Ådahl
committed Details | Review
GdkWaylandWindow: Fix version numbers in export_handle() docs (1.43 KB, patch)
2017-06-22 02:39 UTC, Mart Raudsepp
committed Details | Review

Description Jonas Ådahl 2017-05-08 12:59:55 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).
Comment 1 Jonas Ådahl 2017-05-08 13:00:02 UTC
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.
Comment 2 Jonas Ådahl 2017-05-08 13:00:09 UTC
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.
Comment 3 Matthias Clasen 2017-05-08 17:20:43 UTC
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
Comment 4 Matthias Clasen 2017-05-08 17:23:00 UTC
Review of attachment 351350 [details] [review]:

looks good to me
Comment 5 Jonas Ådahl 2017-05-08 23:56:00 UTC
(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.
Comment 6 Jonas Ådahl 2017-05-09 13:20:39 UTC
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.
Comment 7 Matthias Clasen 2017-05-13 19:47:09 UTC
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
Comment 8 Jonas Ådahl 2017-05-19 03:05:37 UTC
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.
Comment 9 Jonas Ådahl 2017-05-23 02:13:26 UTC
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
Comment 10 Mart Raudsepp 2017-06-22 02:23:42 UTC
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?
Comment 11 Mart Raudsepp 2017-06-22 02:39:30 UTC
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.
Comment 12 Jonas Ådahl 2017-06-22 03:04:47 UTC
Review of attachment 354212 [details] [review]:

Good catch.
Comment 13 Mart Raudsepp 2017-06-22 03:19:33 UTC
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
Comment 14 GNOME Infrastructure Team 2018-05-02 18:27:17 UTC
-- 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.