From 9378ca720d08a17ba7d73dfeb106410e4b50afd7 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 31 Mar 2014 16:18:56 +0200 Subject: Update clipboard selection when selection changes Update the selection when selection changes similar to what is done by Gtk and Aura RenderWidgetHostView's. Change-Id: I92ddd2925c6401693b001baf9ff9f5858c9c504b Reviewed-by: Jocelyn Turcotte --- src/core/render_widget_host_view_qt.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/core/render_widget_host_view_qt.cpp') diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index a2ed37b36..f1c141fee 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -60,6 +60,7 @@ #include "third_party/WebKit/public/platform/WebColor.h" #include "third_party/WebKit/public/platform/WebCursorInfo.h" #include "third_party/WebKit/public/web/WebCompositionUnderline.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/events/event.h" #include "ui/gfx/size_conversions.h" #include "webkit/common/cursors/webcursor.h" @@ -644,6 +645,14 @@ void RenderWidgetHostViewQt::SelectionChanged(const string16 &text, size_t offse { content::RenderWidgetHostViewBase::SelectionChanged(text, offset, range); m_adapterClient->selectionChanged(); + +#if defined(USE_X11) && !defined(OS_CHROMEOS) + // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. + ui::ScopedClipboardWriter clipboard_writer( + ui::Clipboard::GetForCurrentThread(), + ui::CLIPBOARD_TYPE_SELECTION); + clipboard_writer.WriteText(text); +#endif } bool RenderWidgetHostViewQt::CanDispatchToConsumer(ui::GestureConsumer *consumer) -- cgit v1.2.3