Bug 1604048 Comment 13 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to robert.mader from comment #12)
> (In reply to Martin Stránský [:stransky] from comment #10)
> > Yes, the all code here is because Firefox has sync clipboard, see:
> > https://searchfox.org/mozilla-central/rev/8f7b017a31326515cb467e69eef1f6c965b4f00e/widget/gtk/nsClipboardWayland.cpp#97
> > 
> > so we need to use Wayland clipboard directly.  AFAIK It also means we need to implement D&D as it shares clipboard code on Wayland side.
> 
> As it turns out, GTK3 does have synchronous API for that. If I understand things correctly, there are quite a few places in whole GTK widget folder that date back to GTK2 or early GTK3 days, working around bugs or copying code that was not available in still supported GTK version at that time. If the patch above works out well, I'll have a look to clean up the code base a bit, as we now have GTK 3.4 as minimum (and we might be able to raise it further, no? Maybe something that is not older than five years?).

Robber, I'm sorry I was not accurate here. GTK provides synchronous clipboard API but that's only a wrapper around the basic async one and it's implemented internally by gtk_main_loop iterations at Gtk. Unfortunately we can't process gtk event queue in our clipboard code as the events from Gtk can do anything, for instance delete/free the affected window and so.
(In reply to robert.mader from comment #12)
> (In reply to Martin Stránský [:stransky] from comment #10)
> > Yes, the all code here is because Firefox has sync clipboard, see:
> > https://searchfox.org/mozilla-central/rev/8f7b017a31326515cb467e69eef1f6c965b4f00e/widget/gtk/nsClipboardWayland.cpp#97
> > 
> > so we need to use Wayland clipboard directly.  AFAIK It also means we need to implement D&D as it shares clipboard code on Wayland side.
> 
> As it turns out, GTK3 does have synchronous API for that. If I understand things correctly, there are quite a few places in whole GTK widget folder that date back to GTK2 or early GTK3 days, working around bugs or copying code that was not available in still supported GTK version at that time. If the patch above works out well, I'll have a look to clean up the code base a bit, as we now have GTK 3.4 as minimum (and we might be able to raise it further, no? Maybe something that is not older than five years?).

Robert, I'm sorry I was not accurate here. GTK provides synchronous clipboard API but that's only a wrapper around the basic async one and it's implemented internally by gtk_main_loop iterations at Gtk. Unfortunately we can't process gtk event queue in our clipboard code as the events from Gtk can do anything, for instance delete/free the affected window and so.

Back to Bug 1604048 Comment 13