summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2022-09-01 18:34:03 +0200
committerChristian Persch <chpe@src.gnome.org>2022-09-04 10:47:05 +0200
commit7bc143b3e540aa1a6a07dbad45d6caf8c0755a7e (patch)
treecacbb36b6fe26430e1f95c4575346d4112fdf75c
parente4d500a302db008063f11fd95a984ed28b9d61f3 (diff)
downloadvte-7bc143b3e540aa1a6a07dbad45d6caf8c0755a7e.tar.gz
widget: Clipboard fixes for gtk4
Fixes: https://gitlab.gnome.org/GNOME/vte/-/issues/2557
-rw-r--r--src/clipboard-gtk.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/clipboard-gtk.cc b/src/clipboard-gtk.cc
index 2d5a22b4..fdb19af5 100644
--- a/src/clipboard-gtk.cc
+++ b/src/clipboard-gtk.cc
@@ -402,6 +402,13 @@ public:
return false;
}
+ void
+ offer() noexcept
+ {
+ gdk_clipboard_set_content(m_offer->clipboard().platform(), m_native);
+ }
+
+
private:
VteContentProvider* m_native{nullptr}; /* unowned */
@@ -480,7 +487,7 @@ using VteContentProviderClass = GdkContentProviderClass;
static GType vte_content_provider_get_type(void);
-G_DEFINE_TYPE_WITH_CODE(VteContentProvider, vte_content_provider, G_TYPE_OBJECT,
+G_DEFINE_TYPE_WITH_CODE(VteContentProvider, vte_content_provider, GDK_TYPE_CONTENT_PROVIDER,
{
VteContentProvider_private_offset =
g_type_add_instance_private(g_define_type_id, sizeof(ContentProvider));
@@ -695,7 +702,7 @@ Clipboard::Offer::run(std::unique_ptr<Offer> offer,
auto const impl = IMPL(provider.get());
impl->take_offer(std::move(offer));
impl->set_format(format);
- gdk_clipboard_set_content(offer->clipboard().platform(), provider.get());
+ impl->offer();
#endif /* VTE_GTK */
}
@@ -799,9 +806,7 @@ Clipboard::offer_data(ClipboardFormat format,
OfferGetCallback get_callback,
OfferClearCallback clear_callback) /* throws */
{
-#if VTE_GTK == 3
Offer::run(std::make_unique<Offer>(*this, get_callback, clear_callback), format);
-#endif
}
void