[resend] riched20-add-support-for-EM_PASTESPECIAL

Huw Davies huw at codeweavers.com
Wed Oct 12 03:44:04 CDT 2016


On Tue, Oct 11, 2016 at 10:54:44PM -0600, Kenneth Haley wrote:
> partial fix for https://bugs.winehq.org/show_bug.cgi?id=14530
> 
> Support CF_TEXT & CF_UNICODETEXT clipboard formats.
> 
> Tested on Arch Linux.
> 
> Signed-off-by: K. Haley <haleykd at users.sf.net>
> ---
>  dlls/riched20/editor.c | 42 +++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
> index 8b94ccf..7eeda2a 100644
> --- a/dlls/riched20/editor.c
> +++ b/dlls/riched20/editor.c
> @@ -2232,6 +2232,45 @@ static BOOL ME_Paste(ME_TextEditor *editor)
>    return TRUE;
>  }
>  
> +static BOOL ME_PasteSpecial(ME_TextEditor *editor, BOOL unicode, UINT cf, REPASTESPECIAL *rps)
> +{
> +  DWORD dwFormat = SF_TEXT;
> +  EDITSTREAM es;
> +  ME_GlobalDestStruct gds;
> +
> +  if (rps != NULL && rps->dwAspect != 0) {
> +      FIXME("REPASTESPECIAL structure handling not yet implemented\n");
> +  }
> +
> +  switch(cf)
> +  {
> +    // on XP CF_TEXT appears to paste unicode into W version of controll
> +    case CF_TEXT:
> +    case CF_UNICODETEXT:
> +      cf=CF_UNICODETEXT;
> +      if (!IsClipboardFormatAvailable(cf))
> +        return FALSE;
> +      es.pfnCallback = ME_ReadFromHGLOBALUnicode;
> +      dwFormat|=SF_UNICODE;
> +      if (!unicode)
> +        FIXME("convert unicode to ANSI\n");
> +      break;
> +    default:
> +      FIXME("Clipboard formats other than CF_TEXT and CF_UNICODETEXT not yet implemented!\n");
> +      return FALSE;
> +  }
> +
> +  if (!OpenClipboard(editor->hWnd))
> +    return FALSE;
> +  gds.hData = GetClipboardData(cf);
> +  gds.nLength = 0;
> +  es.dwCookie = (DWORD_PTR)&gds;
> +  ME_StreamIn(editor, dwFormat|SFF_SELECTION, &es, FALSE);
> +
> +  CloseClipboard();
> +  return TRUE;
> +}

Sorry, I let this patch slip last time.  Thanks for resubmitting.

Unfortunately, this needs to be merged with the regular pasting code,
which itself needs some work.  Probably with regular paste querying
for formats we want and calling an underlying 'getdata' function.
Paste special would also call this function with the format specified.
Additionally, all of this should use the Ole clipboard rather than the
user32 api.

Also note, we don't want C++ style comments in Wine.

Huw.



More information about the wine-devel mailing list