From f167f9faca6e4b03cb8e427ebe46aa515ef3af88 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Fri, 17 Jun 2016 18:21:00 +0100 Subject: [PATCH] Fixed URLs of images being pasted into TextField When pasting an image (from the clipboard or directly) to a TextField, nothing should be pasted. Currently, without this patch, the image URL is pasted. Change-Id: I2111c27c1f9c9e111db3cd8e641dbb43c3253dd1 --- adaptors/x11/clipboard-impl-x.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/adaptors/x11/clipboard-impl-x.cpp b/adaptors/x11/clipboard-impl-x.cpp index 2f3e14e..1982b5e 100644 --- a/adaptors/x11/clipboard-impl-x.cpp +++ b/adaptors/x11/clipboard-impl-x.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -136,23 +136,24 @@ std::string Clipboard::GetItem( unsigned int index ) // change string to a Dali return ""; } - std::string emptyString( "" ); char sendBuf[20]; - snprintf( sendBuf, 20, "%s%d", CBHM_ITEM, index ); Ecore_X_Atom xAtomCbhmItem = ecore_x_atom_get( sendBuf ); Ecore_X_Atom xAtomItemType = 0; std::string clipboardString( ECore::WindowInterface::GetWindowProperty(xAtomCbhmItem, &xAtomItemType, index ) ); - if ( !clipboardString.empty() ) + + // Only return the text string if the Atom type is text (Do not return a text string/URL for images). + if( !clipboardString.empty() && + ( xAtomItemType == ECORE_X_ATOM_TEXT || xAtomItemType == ECORE_X_ATOM_COMPOUND_TEXT || xAtomItemType == ECORE_X_ATOM_STRING || xAtomItemType == ECORE_X_ATOM_UTF8_STRING ) ) { Ecore_X_Atom xAtomCbhmError = ecore_x_atom_get( CBHM_ERROR ); if ( xAtomItemType != xAtomCbhmError ) { return clipboardString; } - } - return emptyString; + } + return ""; } /* -- 2.7.4