Fix exporting clipboard data to primary selection in wxGTK.
Honour the requested selection in our selection handler instead of always returning the default one resulting in wrong data being pasted when using primary selection (e.g. middle clicking). Closes #12947. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67229 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -496,7 +496,8 @@ GTK:
|
|||||||
|
|
||||||
- Improve print/page setup dialog (rafravago).
|
- Improve print/page setup dialog (rafravago).
|
||||||
- Switch to GtkTooltip from deprecated GtkTooltips (Emilien Kia).
|
- Switch to GtkTooltip from deprecated GtkTooltips (Emilien Kia).
|
||||||
- wxTLW generates wxEVT_MAXIMIZE
|
- wxTLW generates wxEVT_MAXIMIZE.
|
||||||
|
- Fix copying clipboard data to primary selection (David Hart).
|
||||||
|
|
||||||
MSW:
|
MSW:
|
||||||
|
|
||||||
|
@@ -65,8 +65,8 @@ public:
|
|||||||
// get our clipboard item (depending on m_usePrimary value)
|
// get our clipboard item (depending on m_usePrimary value)
|
||||||
GdkAtom GTKGetClipboardAtom() const;
|
GdkAtom GTKGetClipboardAtom() const;
|
||||||
|
|
||||||
// get the data object currently being used
|
// get the data object currently being requested
|
||||||
wxDataObject *GTKGetDataObject() { return Data(); }
|
wxDataObject *GTKGetDataObject( GdkAtom atom );
|
||||||
|
|
||||||
// clear the data for the given clipboard kind
|
// clear the data for the given clipboard kind
|
||||||
void GTKClearData(Kind kind);
|
void GTKClearData(Kind kind);
|
||||||
|
@@ -262,7 +262,7 @@ selection_handler( GtkWidget *WXUNUSED(widget),
|
|||||||
if ( !clipboard )
|
if ( !clipboard )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxDataObject * const data = clipboard->GTKGetDataObject();
|
wxDataObject * const data = clipboard->GTKGetDataObject(selection_data->selection);
|
||||||
if ( !data )
|
if ( !data )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -729,4 +729,27 @@ bool wxClipboard::GetData( wxDataObject& data )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxDataObject* wxClipboard::GTKGetDataObject( GdkAtom atom )
|
||||||
|
{
|
||||||
|
if ( atom == GDK_NONE )
|
||||||
|
return Data();
|
||||||
|
|
||||||
|
if ( atom == GDK_SELECTION_PRIMARY )
|
||||||
|
{
|
||||||
|
wxLogTrace(TRACE_CLIPBOARD, wxT("Primary selection requested" ));
|
||||||
|
|
||||||
|
return Data( wxClipboard::Primary );
|
||||||
|
}
|
||||||
|
else if ( atom == g_clipboardAtom )
|
||||||
|
{
|
||||||
|
wxLogTrace(TRACE_CLIPBOARD, wxT("Clipboard data requested" ));
|
||||||
|
|
||||||
|
return Data( wxClipboard::Clipboard );
|
||||||
|
}
|
||||||
|
else // some other selection, we're not concerned
|
||||||
|
{
|
||||||
|
return (wxDataObject*)NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_CLIPBOARD
|
#endif // wxUSE_CLIPBOARD
|
||||||
|
Reference in New Issue
Block a user