From 86ba393fb918101970bf57c766dd211c76580243 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 1 Feb 2018 11:34:48 +0100 Subject: [PATCH] Fixed clipboard copy->paste between Firefox windows (mozbz#1434572). --- firefox.spec | 8 +++- mozilla-1434572.patch | 93 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 mozilla-1434572.patch diff --git a/firefox.spec b/firefox.spec index cc4f2bf..cb2556a 100644 --- a/firefox.spec +++ b/firefox.spec @@ -98,7 +98,7 @@ ExclusiveArch: x86_64 i686 Summary: Mozilla Firefox Web browser Name: firefox Version: 59.0 -Release: 0.4%{?pre_tag}%{?dist} +Release: 0.5%{?pre_tag}%{?dist} URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ #Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz @@ -162,6 +162,7 @@ Patch451: mozilla-1432414.patch Patch452: mozilla-1434202.patch Patch453: mozilla-1433081.patch Patch454: remote-profile.patch +Patch455: mozilla-1434572.patch # Debian patches Patch500: mozilla-440908.patch @@ -331,6 +332,7 @@ This package contains results of tests executed during build. %patch452 -p1 -b .1434202 %patch453 -p1 -b .1433081 %patch454 -p1 -b .remote-profile +%patch455 -p1 -b .1434572 # Patch for big endian platforms only %if 0%{?big_endian} @@ -864,6 +866,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Feb 1 2018 Martin Stransky - 59.0-0.5 +- Fixed clipboard copy->paste between Firefox windows + (mozbz#1434572). + * Wed Jan 31 2018 Martin Stransky - 59.0-0.4 - Fixed remote launch when no profile name is given. diff --git a/mozilla-1434572.patch b/mozilla-1434572.patch new file mode 100644 index 0000000..835c76f --- /dev/null +++ b/mozilla-1434572.patch @@ -0,0 +1,93 @@ +diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c +--- a/widget/gtk/mozgtk/mozgtk.c ++++ b/widget/gtk/mozgtk/mozgtk.c +@@ -66,16 +66,17 @@ STUB(gdk_screen_get_number) + STUB(gdk_screen_get_resolution) + STUB(gdk_screen_get_rgba_visual) + STUB(gdk_screen_get_root_window) + STUB(gdk_screen_get_system_visual) + STUB(gdk_screen_get_width) + STUB(gdk_screen_height) + STUB(gdk_screen_is_composited) + STUB(gdk_screen_width) ++STUB(gdk_selection_owner_get) + STUB(gdk_set_program_class) + STUB(gdk_unicode_to_keyval) + STUB(gdk_visual_get_depth) + STUB(gdk_visual_get_system) + STUB(gdk_window_add_filter) + STUB(gdk_window_begin_move_drag) + STUB(gdk_window_begin_resize_drag) + STUB(gdk_window_destroy) +diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp +--- a/widget/gtk/nsClipboardWayland.cpp ++++ b/widget/gtk/nsClipboardWayland.cpp +@@ -337,21 +346,68 @@ nsRetrievalContextWayland::GetTargets(in + for (int32_t j = 0; j < length; j++) { + targetList[j] = mTargetMIMETypes[j]; + } + + *aTargetNum = length; + return targetList; + } + ++struct fastTrackClipboardData ++{ ++ char* data; ++ int dataLength; ++}; ++ ++static void ++wayland_clipboard_contents_received(GtkClipboard *clipboard, ++ GtkSelectionData *selection_data, ++ gpointer data) ++{ ++ fastTrackClipboardData* clipboardData = ++ static_cast(data); ++ ++ int contentLength = gtk_selection_data_get_length(selection_data); ++ if (contentLength > 0) { ++ clipboardData->data = reinterpret_cast( ++ g_malloc(sizeof(char)*contentLength)); ++ memcpy(clipboardData->data, ++ gtk_selection_data_get_data(selection_data), ++ sizeof(char)*contentLength); ++ } ++ ++ clipboardData->dataLength = contentLength; ++} ++ + const char* + nsRetrievalContextWayland::GetClipboardData(const char* aMimeType, + int32_t aWhichClipboard, + uint32_t* aContentLength) + { ++ /* If actual clipboard data is owned by us we don't need to go ++ * through Wayland but we ask Gtk+ to directly call data ++ * getter callback nsClipboard::SelectionGetEvent(). ++ */ ++ GdkAtom selection = GetSelectionAtom(aWhichClipboard); ++ if (gdk_selection_owner_get(selection)) { ++ fastTrackClipboardData clipboardData = { nullptr, 0 }; ++ gtk_clipboard_request_contents(gtk_clipboard_get(selection), ++ gdk_atom_intern(aMimeType, FALSE), ++ wayland_clipboard_contents_received, ++ &clipboardData); ++ *aContentLength = clipboardData.dataLength; ++ return static_cast(clipboardData.data); ++ } ++ ++ /* TODO: We need to implement GDK_SELECTION_PRIMARY (X11 text selection) ++ * for Wayland backend. ++ */ ++ if (selection == GDK_SELECTION_PRIMARY) ++ return nullptr; ++ + NS_ASSERTION(mDataOffer, "Requested data without valid data offer!"); + + if (!mDataOffer) { + // TODO + // Something went wrong. We're requested to provide clipboard data + // but we haven't got any from wayland. Looks like rhbz#1455915. + return nullptr; + }