winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
February 2013
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
459 discussions
Start a n
N
ew thread
Hans Leidekker : windowscodecs: Implement IWICComponentFactory:: CreateDecoderFromFileHandle.
by Alexandre Julliard
06 Feb '13
06 Feb '13
Module: wine Branch: master Commit: ba02cb25d363cbe19d435dd95d96f0f40a7612be URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ba02cb25d363cbe19d435dd95…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Feb 6 13:53:21 2013 +0100 windowscodecs: Implement IWICComponentFactory::CreateDecoderFromFileHandle. --- dlls/windowscodecs/imgfactory.c | 19 +++- dlls/windowscodecs/stream.c | 239 ++++++++++++++++++++++++++++++++ dlls/windowscodecs/wincodecs_private.h | 2 + 3 files changed, 258 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index 223b041..9a6c818 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -238,9 +238,24 @@ static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle( IWICComponentFactory *iface, ULONG_PTR hFile, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder) { - FIXME("(%p,%lx,%s,%u,%p): stub\n", iface, hFile, debugstr_guid(pguidVendor), + IWICStream *stream; + HRESULT hr; + + TRACE("(%p,%lx,%s,%u,%p)\n", iface, hFile, debugstr_guid(pguidVendor), metadataOptions, ppIDecoder); - return E_NOTIMPL; + + hr = StreamImpl_Create(&stream); + if (SUCCEEDED(hr)) + { + hr = stream_initialize_from_filehandle(stream, (HANDLE)hFile); + if (SUCCEEDED(hr)) + { + hr = IWICComponentFactory_CreateDecoderFromStream(iface, (IStream*)stream, + pguidVendor, metadataOptions, ppIDecoder); + } + IWICStream_Release(stream); + } + return hr; } static HRESULT WINAPI ComponentFactory_CreateComponentInfo(IWICComponentFactory *iface, diff --git a/dlls/windowscodecs/stream.c b/dlls/windowscodecs/stream.c index a123b9d..f6bfedf 100644 --- a/dlls/windowscodecs/stream.c +++ b/dlls/windowscodecs/stream.c @@ -264,6 +264,175 @@ static const IStreamVtbl StreamOnMemory_Vtbl = }; /****************************************** + * StreamOnFileHandle implementation (internal) + * + */ +typedef struct StreamOnFileHandle { + IStream IStream_iface; + LONG ref; + + HANDLE map; + void *mem; + IWICStream *stream; +} StreamOnFileHandle; + +static inline StreamOnFileHandle *StreamOnFileHandle_from_IStream(IStream *iface) +{ + return CONTAINING_RECORD(iface, StreamOnFileHandle, IStream_iface); +} + +static HRESULT WINAPI StreamOnFileHandle_QueryInterface(IStream *iface, + REFIID iid, void **ppv) +{ + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || IsEqualIID(&IID_IStream, iid) || + IsEqualIID(&IID_ISequentialStream, iid)) + { + *ppv = iface; + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; + } + else + { + *ppv = NULL; + return E_NOINTERFACE; + } +} + +static ULONG WINAPI StreamOnFileHandle_AddRef(IStream *iface) +{ + StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI StreamOnFileHandle_Release(IStream *iface) +{ + StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) { + IWICStream_Release(This->stream); + UnmapViewOfFile(This->mem); + CloseHandle(This->map); + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +static HRESULT WINAPI StreamOnFileHandle_Read(IStream *iface, + void *pv, ULONG cb, ULONG *pcbRead) +{ + StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface); + TRACE("(%p)\n", This); + + return IWICStream_Read(This->stream, pv, cb, pcbRead); +} + +static HRESULT WINAPI StreamOnFileHandle_Write(IStream *iface, + void const *pv, ULONG cb, ULONG *pcbWritten) +{ + ERR("(%p)\n", iface); + return HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED); +} + +static HRESULT WINAPI StreamOnFileHandle_Seek(IStream *iface, + LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) +{ + StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface); + TRACE("(%p)\n", This); + + return IWICStream_Seek(This->stream, dlibMove, dwOrigin, plibNewPosition); +} + +static HRESULT WINAPI StreamOnFileHandle_SetSize(IStream *iface, + ULARGE_INTEGER libNewSize) +{ + TRACE("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI StreamOnFileHandle_CopyTo(IStream *iface, + IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) +{ + TRACE("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI StreamOnFileHandle_Commit(IStream *iface, + DWORD grfCommitFlags) +{ + TRACE("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI StreamOnFileHandle_Revert(IStream *iface) +{ + TRACE("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI StreamOnFileHandle_LockRegion(IStream *iface, + ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) +{ + TRACE("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI StreamOnFileHandle_UnlockRegion(IStream *iface, + ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) +{ + TRACE("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI StreamOnFileHandle_Stat(IStream *iface, + STATSTG *pstatstg, DWORD grfStatFlag) +{ + StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface); + TRACE("(%p)\n", This); + + return IWICStream_Stat(This->stream, pstatstg, grfStatFlag); +} + +static HRESULT WINAPI StreamOnFileHandle_Clone(IStream *iface, + IStream **ppstm) +{ + TRACE("(%p)\n", iface); + return E_NOTIMPL; +} + + +static const IStreamVtbl StreamOnFileHandle_Vtbl = +{ + /*** IUnknown methods ***/ + StreamOnFileHandle_QueryInterface, + StreamOnFileHandle_AddRef, + StreamOnFileHandle_Release, + /*** ISequentialStream methods ***/ + StreamOnFileHandle_Read, + StreamOnFileHandle_Write, + /*** IStream methods ***/ + StreamOnFileHandle_Seek, + StreamOnFileHandle_SetSize, + StreamOnFileHandle_CopyTo, + StreamOnFileHandle_Commit, + StreamOnFileHandle_Revert, + StreamOnFileHandle_LockRegion, + StreamOnFileHandle_UnlockRegion, + StreamOnFileHandle_Stat, + StreamOnFileHandle_Clone, +}; + +/****************************************** * StreamOnStreamRange implementation * * Used by IWICStream_InitializeFromIStreamRegion @@ -825,6 +994,76 @@ static HRESULT WINAPI IWICStreamImpl_InitializeFromMemory(IWICStream *iface, return S_OK; } +static HRESULT map_file(HANDLE file, HANDLE *map, void **mem, LARGE_INTEGER *size) +{ + *map = NULL; + if (!GetFileSizeEx(file, size)) return HRESULT_FROM_WIN32(GetLastError()); + if (size->u.HighPart) + { + WARN("file too large\n"); + return E_FAIL; + } + if (!(*map = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, size->u.LowPart, NULL))) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + if (!(*mem = MapViewOfFile(*map, FILE_MAP_READ, 0, 0, size->u.LowPart))) + { + CloseHandle(*map); + return HRESULT_FROM_WIN32(GetLastError()); + } + return S_OK; +} + +HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE file) +{ + IWICStreamImpl *This = impl_from_IWICStream(iface); + StreamOnFileHandle *pObject; + IWICStream *stream = NULL; + HANDLE map; + void *mem; + LARGE_INTEGER size; + HRESULT hr; + TRACE("(%p,%p)\n", iface, file); + + if (This->pStream) return WINCODEC_ERR_WRONGSTATE; + + hr = map_file(file, &map, &mem, &size); + if (FAILED(hr)) return hr; + + hr = StreamImpl_Create(&stream); + if (FAILED(hr)) goto error; + + hr = IWICStreamImpl_InitializeFromMemory(stream, mem, size.u.LowPart); + if (FAILED(hr)) goto error; + + pObject = HeapAlloc(GetProcessHeap(), 0, sizeof(StreamOnFileHandle)); + if (!pObject) + { + hr = E_OUTOFMEMORY; + goto error; + } + pObject->IStream_iface.lpVtbl = &StreamOnFileHandle_Vtbl; + pObject->ref = 1; + pObject->map = map; + pObject->mem = mem; + pObject->stream = stream; + + if (InterlockedCompareExchangePointer((void**)&This->pStream, pObject, NULL)) + { + /* Some other thread set the stream first. */ + IStream_Release(&pObject->IStream_iface); + return WINCODEC_ERR_WRONGSTATE; + } + return S_OK; + +error: + if (stream) IWICStream_Release(stream); + UnmapViewOfFile(mem); + CloseHandle(map); + return hr; +} + static HRESULT WINAPI IWICStreamImpl_InitializeFromIStreamRegion(IWICStream *iface, IStream *pIStream, ULARGE_INTEGER ulOffset, ULARGE_INTEGER ulMaxSize) { diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h index 8eae4a7..dddb327 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -105,4 +105,6 @@ extern HRESULT GCEReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void ** extern HRESULT APEReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; extern HRESULT GifCommentReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile) DECLSPEC_HIDDEN; + #endif /* WINCODECS_PRIVATE_H */
1
0
0
0
Hans Leidekker : windowscodecs: Convert the source bitmap to the requested pixel format in IWICColorTransform ::Initialize.
by Alexandre Julliard
06 Feb '13
06 Feb '13
Module: wine Branch: master Commit: d855ed4153d4485035b40f7a7a0d0f47a663e09b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d855ed4153d4485035b40f7a7…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Feb 6 13:52:48 2013 +0100 windowscodecs: Convert the source bitmap to the requested pixel format in IWICColorTransform::Initialize. --- dlls/windowscodecs/colortransform.c | 49 ++++++++++++++++++++++++++-------- 1 files changed, 37 insertions(+), 12 deletions(-) diff --git a/dlls/windowscodecs/colortransform.c b/dlls/windowscodecs/colortransform.c index dae4f38..7791731 100644 --- a/dlls/windowscodecs/colortransform.c +++ b/dlls/windowscodecs/colortransform.c @@ -36,6 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); typedef struct ColorTransform { IWICColorTransform IWICColorTransform_iface; LONG ref; + IWICBitmapSource *dst; } ColorTransform; static inline ColorTransform *impl_from_IWICColorTransform(IWICColorTransform *iface) @@ -86,6 +87,7 @@ static ULONG WINAPI ColorTransform_Release(IWICColorTransform *iface) if (ref == 0) { + if (This->dst) IWICBitmapSource_Release(This->dst); HeapFree(GetProcessHeap(), 0, This); } @@ -95,45 +97,67 @@ static ULONG WINAPI ColorTransform_Release(IWICColorTransform *iface) static HRESULT WINAPI ColorTransform_GetSize(IWICColorTransform *iface, UINT *puiWidth, UINT *puiHeight) { - FIXME("(%p,%p,%p)\n", iface, puiWidth, puiHeight); - return E_NOTIMPL; + ColorTransform *This = impl_from_IWICColorTransform(iface); + TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight); + + return IWICBitmapSource_GetSize(This->dst, puiWidth, puiHeight); } static HRESULT WINAPI ColorTransform_GetPixelFormat(IWICColorTransform *iface, WICPixelFormatGUID *pPixelFormat) { - FIXME("(%p,%p)\n", iface, pPixelFormat); - return E_NOTIMPL; + ColorTransform *This = impl_from_IWICColorTransform(iface); + TRACE("(%p,%p)\n", iface, pPixelFormat); + + return IWICBitmapSource_GetPixelFormat(This->dst, pPixelFormat); } static HRESULT WINAPI ColorTransform_GetResolution(IWICColorTransform *iface, double *pDpiX, double *pDpiY) { - FIXME("(%p,%p,%p)\n", iface, pDpiX, pDpiY); - return E_NOTIMPL; + ColorTransform *This = impl_from_IWICColorTransform(iface); + TRACE("(%p,%p,%p)\n", iface, pDpiX, pDpiY); + + return IWICBitmapSource_GetResolution(This->dst, pDpiX, pDpiY); } static HRESULT WINAPI ColorTransform_CopyPalette(IWICColorTransform *iface, IWICPalette *pIPalette) { - FIXME("(%p,%p)\n", iface, pIPalette); - return E_NOTIMPL; + ColorTransform *This = impl_from_IWICColorTransform(iface); + TRACE("(%p,%p)\n", iface, pIPalette); + + return IWICBitmapSource_CopyPalette(This->dst, pIPalette); } static HRESULT WINAPI ColorTransform_CopyPixels(IWICColorTransform *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer) { - FIXME("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer); - return E_NOTIMPL; + ColorTransform *This = impl_from_IWICColorTransform(iface); + TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer); + + return IWICBitmapSource_CopyPixels(This->dst, prc, cbStride, cbBufferSize, pbBuffer); } static HRESULT WINAPI ColorTransform_Initialize(IWICColorTransform *iface, IWICBitmapSource *pIBitmapSource, IWICColorContext *pIContextSource, IWICColorContext *pIContextDest, REFWICPixelFormatGUID pixelFmtDest) { - FIXME("(%p,%p,%p,%p,%s)\n", iface, pIBitmapSource, pIContextSource, + ColorTransform *This = impl_from_IWICColorTransform(iface); + IWICBitmapSource *dst; + HRESULT hr; + + TRACE("(%p,%p,%p,%p,%s)\n", iface, pIBitmapSource, pIContextSource, pIContextDest, debugstr_guid(pixelFmtDest)); - return E_NOTIMPL; + + FIXME("ignoring color contexts\n"); + + hr = WICConvertBitmapSource(pixelFmtDest, pIBitmapSource, &dst); + if (FAILED(hr)) return hr; + + if (This->dst) IWICBitmapSource_Release(This->dst); + This->dst = dst; + return S_OK; } static const IWICColorTransformVtbl ColorTransform_Vtbl = { @@ -159,6 +183,7 @@ HRESULT ColorTransform_Create(IWICColorTransform **colortransform) This->IWICColorTransform_iface.lpVtbl = &ColorTransform_Vtbl; This->ref = 1; + This->dst = NULL; *colortransform = &This->IWICColorTransform_iface;
1
0
0
0
Hans Leidekker : windowscodecs: Add a stub IWICColorTransform implementation.
by Alexandre Julliard
06 Feb '13
06 Feb '13
Module: wine Branch: master Commit: d9bfbd61d811b9e26e368a784575bbcf643b6bed URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d9bfbd61d811b9e26e368a784…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Feb 6 13:52:09 2013 +0100 windowscodecs: Add a stub IWICColorTransform implementation. --- dlls/windowscodecs/Makefile.in | 1 + dlls/windowscodecs/colortransform.c | 166 ++++++++++++++++++++++++++++++++ dlls/windowscodecs/imgfactory.c | 4 +- dlls/windowscodecs/wincodecs_private.h | 1 + 4 files changed, 170 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in index ffe0925..4035279 100644 --- a/dlls/windowscodecs/Makefile.in +++ b/dlls/windowscodecs/Makefile.in @@ -11,6 +11,7 @@ C_SRCS = \ bmpencode.c \ clsfactory.c \ colorcontext.c \ + colortransform.c \ converter.c \ fliprotate.c \ gifformat.c \ diff --git a/dlls/windowscodecs/colortransform.c b/dlls/windowscodecs/colortransform.c new file mode 100644 index 0000000..dae4f38 --- /dev/null +++ b/dlls/windowscodecs/colortransform.c @@ -0,0 +1,166 @@ +/* + * Copyright 2013 Hans Leidekker for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include <stdarg.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "wincodec.h" + +#include "wincodecs_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); + +typedef struct ColorTransform { + IWICColorTransform IWICColorTransform_iface; + LONG ref; +} ColorTransform; + +static inline ColorTransform *impl_from_IWICColorTransform(IWICColorTransform *iface) +{ + return CONTAINING_RECORD(iface, ColorTransform, IWICColorTransform_iface); +} + +static HRESULT WINAPI ColorTransform_QueryInterface(IWICColorTransform *iface, REFIID iid, + void **ppv) +{ + ColorTransform *This = impl_from_IWICColorTransform(iface); + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IWICBitmapSource, iid) || + IsEqualIID(&IID_IWICColorTransform, iid)) + { + *ppv = &This->IWICColorTransform_iface; + } + else + { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI ColorTransform_AddRef(IWICColorTransform *iface) +{ + ColorTransform *This = impl_from_IWICColorTransform(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI ColorTransform_Release(IWICColorTransform *iface) +{ + ColorTransform *This = impl_from_IWICColorTransform(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI ColorTransform_GetSize(IWICColorTransform *iface, + UINT *puiWidth, UINT *puiHeight) +{ + FIXME("(%p,%p,%p)\n", iface, puiWidth, puiHeight); + return E_NOTIMPL; +} + +static HRESULT WINAPI ColorTransform_GetPixelFormat(IWICColorTransform *iface, + WICPixelFormatGUID *pPixelFormat) +{ + FIXME("(%p,%p)\n", iface, pPixelFormat); + return E_NOTIMPL; +} + +static HRESULT WINAPI ColorTransform_GetResolution(IWICColorTransform *iface, + double *pDpiX, double *pDpiY) +{ + FIXME("(%p,%p,%p)\n", iface, pDpiX, pDpiY); + return E_NOTIMPL; +} + +static HRESULT WINAPI ColorTransform_CopyPalette(IWICColorTransform *iface, + IWICPalette *pIPalette) +{ + FIXME("(%p,%p)\n", iface, pIPalette); + return E_NOTIMPL; +} + +static HRESULT WINAPI ColorTransform_CopyPixels(IWICColorTransform *iface, + const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer) +{ + FIXME("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer); + return E_NOTIMPL; +} + +static HRESULT WINAPI ColorTransform_Initialize(IWICColorTransform *iface, + IWICBitmapSource *pIBitmapSource, IWICColorContext *pIContextSource, + IWICColorContext *pIContextDest, REFWICPixelFormatGUID pixelFmtDest) +{ + FIXME("(%p,%p,%p,%p,%s)\n", iface, pIBitmapSource, pIContextSource, + pIContextDest, debugstr_guid(pixelFmtDest)); + return E_NOTIMPL; +} + +static const IWICColorTransformVtbl ColorTransform_Vtbl = { + ColorTransform_QueryInterface, + ColorTransform_AddRef, + ColorTransform_Release, + ColorTransform_GetSize, + ColorTransform_GetPixelFormat, + ColorTransform_GetResolution, + ColorTransform_CopyPalette, + ColorTransform_CopyPixels, + ColorTransform_Initialize +}; + +HRESULT ColorTransform_Create(IWICColorTransform **colortransform) +{ + ColorTransform *This; + + if (!colortransform) return E_INVALIDARG; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(ColorTransform)); + if (!This) return E_OUTOFMEMORY; + + This->IWICColorTransform_iface.lpVtbl = &ColorTransform_Vtbl; + This->ref = 1; + + *colortransform = &This->IWICColorTransform_iface; + + return S_OK; +} diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index 7965c55..223b041 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -450,8 +450,8 @@ static HRESULT WINAPI ComponentFactory_CreateColorContext(IWICComponentFactory * static HRESULT WINAPI ComponentFactory_CreateColorTransformer(IWICComponentFactory *iface, IWICColorTransform **ppIColorTransform) { - FIXME("(%p,%p): stub\n", iface, ppIColorTransform); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIColorTransform); + return ColorTransform_Create(ppIColorTransform); } static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface, diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h index 617db71..8eae4a7 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -53,6 +53,7 @@ extern HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator) DECLSPEC_ extern HRESULT PaletteImpl_Create(IWICPalette **palette) DECLSPEC_HIDDEN; extern HRESULT StreamImpl_Create(IWICStream **stream) DECLSPEC_HIDDEN; extern HRESULT ColorContext_Create(IWICColorContext **context) DECLSPEC_HIDDEN; +extern HRESULT ColorTransform_Create(IWICColorTransform **transform) DECLSPEC_HIDDEN; extern HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer, UINT srcwidth, UINT srcheight, INT srcstride,
1
0
0
0
Hans Leidekker : windowscodecs: Implement IWICColorContext:: InitializeFromFilename.
by Alexandre Julliard
06 Feb '13
06 Feb '13
Module: wine Branch: master Commit: b64eb8a8d635f519f994b6bceea2a15d8f41dc5e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b64eb8a8d635f519f994b6bce…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Feb 6 13:51:32 2013 +0100 windowscodecs: Implement IWICColorContext::InitializeFromFilename. --- dlls/windowscodecs/colorcontext.c | 69 ++++++++++++++++++++++++++++++--- dlls/windowscodecs/tests/pngformat.c | 61 ++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 7 deletions(-) diff --git a/dlls/windowscodecs/colorcontext.c b/dlls/windowscodecs/colorcontext.c index 457b4db..ca40184 100644 --- a/dlls/windowscodecs/colorcontext.c +++ b/dlls/windowscodecs/colorcontext.c @@ -96,27 +96,82 @@ static ULONG WINAPI ColorContext_Release(IWICColorContext *iface) return ref; } +static HRESULT load_profile(const WCHAR *filename, BYTE **profile, UINT *len) +{ + HANDLE handle; + DWORD count; + LARGE_INTEGER size; + BOOL ret; + + *len = 0; + *profile = NULL; + handle = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + if (handle == INVALID_HANDLE_VALUE) return HRESULT_FROM_WIN32(GetLastError()); + + if (!(GetFileSizeEx(handle, &size))) + { + CloseHandle(handle); + return HRESULT_FROM_WIN32(GetLastError()); + } + if (size.u.HighPart) + { + WARN("file too large\n"); + CloseHandle(handle); + return E_FAIL; + } + if (!(*profile = HeapAlloc(GetProcessHeap(), 0, size.u.LowPart))) + { + CloseHandle(handle); + return E_OUTOFMEMORY; + } + ret = ReadFile(handle, *profile, size.u.LowPart, &count, NULL); + CloseHandle(handle); + if (!ret) return HRESULT_FROM_WIN32(GetLastError()); + if (count != size.u.LowPart) return E_FAIL; + *len = count; + return S_OK; +} + static HRESULT WINAPI ColorContext_InitializeFromFilename(IWICColorContext *iface, LPCWSTR wzFilename) { - FIXME("(%p,%s)\n", iface, debugstr_w(wzFilename)); - return E_NOTIMPL; + ColorContext *This = impl_from_IWICColorContext(iface); + BYTE *profile; + UINT len; + HRESULT hr; + TRACE("(%p,%s)\n", iface, debugstr_w(wzFilename)); + + if (This->type != WICColorContextUninitialized && This->type != WICColorContextProfile) + return WINCODEC_ERR_WRONGSTATE; + + if (!wzFilename) return E_INVALIDARG; + + hr = load_profile(wzFilename, &profile, &len); + if (FAILED(hr)) return hr; + + HeapFree(GetProcessHeap(), 0, This->profile); + This->profile = profile; + This->profile_len = len; + This->type = WICColorContextProfile; + + return S_OK; } static HRESULT WINAPI ColorContext_InitializeFromMemory(IWICColorContext *iface, const BYTE *pbBuffer, UINT cbBufferSize) { ColorContext *This = impl_from_IWICColorContext(iface); + BYTE *profile; TRACE("(%p,%p,%u)\n", iface, pbBuffer, cbBufferSize); - if (This->type != WICColorContextUninitialized) + if (This->type != WICColorContextUninitialized && This->type != WICColorContextProfile) return WINCODEC_ERR_WRONGSTATE; - HeapFree(GetProcessHeap(), 0, This->profile); - if (!(This->profile = HeapAlloc(GetProcessHeap(), 0, cbBufferSize))) - return E_OUTOFMEMORY; + if (!(profile = HeapAlloc(GetProcessHeap(), 0, cbBufferSize))) return E_OUTOFMEMORY; + memcpy(profile, pbBuffer, cbBufferSize); - memcpy(This->profile, pbBuffer, cbBufferSize); + HeapFree(GetProcessHeap(), 0, This->profile); + This->profile = profile; This->profile_len = cbBufferSize; This->type = WICColorContextProfile; diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c index 3f4e855..b21f5f7 100644 --- a/dlls/windowscodecs/tests/pngformat.c +++ b/dlls/windowscodecs/tests/pngformat.c @@ -317,6 +317,27 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size return decoder; } +static WCHAR *save_profile( BYTE *buffer, UINT size ) +{ + static const WCHAR tstW[] = {'t','s','t',0}; + WCHAR path[MAX_PATH], filename[MAX_PATH], *ret; + HANDLE handle; + DWORD count; + + GetTempPathW(MAX_PATH, path); + GetTempFileNameW(path, tstW, 0, filename); + + handle = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + if (handle == INVALID_HANDLE_VALUE) return NULL; + + WriteFile(handle, buffer, size, &count, NULL); + CloseHandle( handle ); + + ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(filename) + 1) * sizeof(WCHAR)); + lstrcpyW(ret, filename); + return ret; +} + static void test_color_contexts(void) { HRESULT hr; @@ -325,7 +346,9 @@ static void test_color_contexts(void) IWICColorContext *context; WICColorContextType type; UINT count, colorspace, size; + WCHAR *tmpfile; BYTE *buffer; + BOOL ret; decoder = create_decoder(png_no_color_profile, sizeof(png_no_color_profile)); ok(decoder != 0, "Failed to load PNG image data\n"); @@ -453,6 +476,8 @@ static void test_color_contexts(void) buffer = HeapAlloc(GetProcessHeap(), 0, size); hr = IWICColorContext_GetProfileBytes(context, size, buffer, &size); ok(hr == S_OK, "GetProfileBytes error %#x\n", hr); + + tmpfile = save_profile( buffer, size ); HeapFree(GetProcessHeap(), 0, buffer); type = 0xdeadbeef; @@ -468,6 +493,42 @@ static void test_color_contexts(void) hr = IWICColorContext_InitializeFromExifColorSpace(context, 1); ok(hr == WINCODEC_ERR_WRONGSTATE, "InitializeFromExifColorSpace error %#x\n", hr); + if (tmpfile) + { + hr = IWICColorContext_InitializeFromFilename(context, NULL); + ok(hr == E_INVALIDARG, "InitializeFromFilename error %#x\n", hr); + + hr = IWICColorContext_InitializeFromFilename(context, tmpfile); + ok(hr == S_OK, "InitializeFromFilename error %#x\n", hr); + + ret = DeleteFileW(tmpfile); + ok(ret, "DeleteFileW failed %u\n", GetLastError()); + + type = 0xdeadbeef; + hr = IWICColorContext_GetType(context, &type); + ok(hr == S_OK, "GetType error %#x\n", hr); + ok(type == WICColorContextProfile, "unexpected type %u\n", type); + + colorspace = 0xdeadbeef; + hr = IWICColorContext_GetExifColorSpace(context, &colorspace); + ok(hr == S_OK, "GetExifColorSpace error %#x\n", hr); + ok(colorspace == 0xffffffff, "unexpected color space %u\n", colorspace); + + hr = IWICColorContext_InitializeFromExifColorSpace(context, 1); + ok(hr == WINCODEC_ERR_WRONGSTATE, "InitializeFromExifColorSpace error %#x\n", hr); + + size = 0; + hr = IWICColorContext_GetProfileBytes(context, 0, NULL, &size); + ok(hr == S_OK, "GetProfileBytes error %#x\n", hr); + ok(size, "unexpected size %u\n", size); + + buffer = HeapAlloc(GetProcessHeap(), 0, size); + hr = IWICColorContext_GetProfileBytes(context, size, buffer, &size); + ok(hr == S_OK, "GetProfileBytes error %#x\n", hr); + + HeapFree(GetProcessHeap(), 0, buffer); + HeapFree(GetProcessHeap(), 0, tmpfile); + } IWICColorContext_Release(context); IWICBitmapFrameDecode_Release(frame); IWICBitmapDecoder_Release(decoder);
1
0
0
0
Ken Thomases : winemac: Implement fake support for the active Windows keyboard layout.
by Alexandre Julliard
06 Feb '13
06 Feb '13
Module: wine Branch: master Commit: 956ec4320174f003d753d2e94213f9c58b23d0e8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=956ec4320174f003d753d2e94…
Author: Ken Thomases <ken(a)codeweavers.com> Date: Wed Feb 6 04:37:04 2013 -0600 winemac: Implement fake support for the active Windows keyboard layout. --- dlls/winemac.drv/keyboard.c | 127 +++++++++++++++++++++++++++++++++++++ dlls/winemac.drv/macdrv.h | 1 + dlls/winemac.drv/winemac.drv.spec | 3 + 3 files changed, 131 insertions(+), 0 deletions(-) diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index ae8df76..7b773e3 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -847,6 +847,93 @@ void macdrv_keyboard_changed(const macdrv_event *event) /*********************************************************************** + * get_locale_keyboard_layout + */ +static HKL get_locale_keyboard_layout(void) +{ + ULONG_PTR layout; + LANGID langid; + + layout = GetUserDefaultLCID(); + + /* + * Microsoft Office expects this value to be something specific + * for Japanese and Korean Windows with an IME the value is 0xe001 + * We should probably check to see if an IME exists and if so then + * set this word properly. + */ + langid = PRIMARYLANGID(LANGIDFROMLCID(layout)); + if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN) + layout |= 0xe001 << 16; /* IME */ + else + layout |= layout << 16; + + return (HKL)layout; +} + + +/*********************************************************************** + * match_keyboard_layout + */ +static BOOL match_keyboard_layout(HKL hkl) +{ + const DWORD isIME = 0xE0000000; + HKL current_hkl = get_locale_keyboard_layout(); + + /* if the layout is an IME, only match the low word (LCID) */ + if (((ULONG_PTR)hkl & isIME) == isIME) + return (LOWORD(hkl) == LOWORD(current_hkl)); + else + return (hkl == current_hkl); +} + + +/*********************************************************************** + * ActivateKeyboardLayout (MACDRV.@) + */ +HKL CDECL macdrv_ActivateKeyboardLayout(HKL hkl, UINT flags) +{ + HKL oldHkl = 0; + struct macdrv_thread_data *thread_data = macdrv_init_thread_data(); + + /* FIXME: Use Text Input Services or NSTextInputContext to actually + change the Mac keyboard input source. */ + + FIXME("hkl %p flags %04x: semi-stub!\n", hkl, flags); + if (flags & KLF_SETFORPROCESS) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + FIXME("KLF_SETFORPROCESS not supported\n"); + return 0; + } + + if (flags) + FIXME("flags %x not supported\n",flags); + + if (hkl == (HKL)HKL_NEXT || hkl == (HKL)HKL_PREV) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + FIXME("HKL_NEXT and HKL_PREV not supported\n"); + return 0; + } + + if (!match_keyboard_layout(hkl)) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + FIXME("setting keyboard of different locales not supported\n"); + return 0; + } + + oldHkl = thread_data->active_keyboard_layout; + if (!oldHkl) oldHkl = get_locale_keyboard_layout(); + + thread_data->active_keyboard_layout = hkl; + + return oldHkl; +} + + +/*********************************************************************** * Beep (MACDRV.@) */ void CDECL macdrv_Beep(void) @@ -945,6 +1032,46 @@ INT CDECL macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size) /*********************************************************************** + * GetKeyboardLayout (MACDRV.@) + */ +HKL CDECL macdrv_GetKeyboardLayout(DWORD thread_id) +{ + if (!thread_id || thread_id == GetCurrentThreadId()) + { + struct macdrv_thread_data *thread_data = macdrv_thread_data(); + if (thread_data && thread_data->active_keyboard_layout) + return thread_data->active_keyboard_layout; + } + else + FIXME("couldn't return keyboard layout for thread %04x\n", thread_id); + + /* FIXME: Use TISGetInputSourceProperty() and kTISPropertyInputSourceLanguages + * to get input source language ID string. Use + * CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier() to convert that + * to a Windows locale ID and from there to a layout handle. + */ + + return get_locale_keyboard_layout(); +} + + +/*********************************************************************** + * GetKeyboardLayoutName (MACDRV.@) + */ +BOOL CDECL macdrv_GetKeyboardLayoutName(LPWSTR name) +{ + static const WCHAR formatW[] = {'%','0','8','x',0}; + DWORD layout; + + layout = HandleToUlong(get_locale_keyboard_layout()); + if (HIWORD(layout) == LOWORD(layout)) layout = LOWORD(layout); + sprintfW(name, formatW, layout); + TRACE("returning %s\n", debugstr_w(name)); + return TRUE; +} + + +/*********************************************************************** * MapVirtualKeyEx (MACDRV.@) */ UINT CDECL macdrv_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl) diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 4dc1e3e..e24d8ab 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -89,6 +89,7 @@ struct macdrv_thread_data int iso_keyboard; CGEventFlags last_modifiers; UInt32 dead_key_state; + HKL active_keyboard_layout; WORD keyc2vkey[128]; WORD keyc2scan[128]; }; diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec index 1bb7d8c..30df9d6 100644 --- a/dlls/winemac.drv/winemac.drv.spec +++ b/dlls/winemac.drv/winemac.drv.spec @@ -4,11 +4,14 @@ # USER driver +@ cdecl ActivateKeyboardLayout(long long) macdrv_ActivateKeyboardLayout @ cdecl Beep() macdrv_Beep @ cdecl CreateDesktopWindow(long) macdrv_CreateDesktopWindow @ cdecl CreateWindow(long) macdrv_CreateWindow @ cdecl DestroyWindow(long) macdrv_DestroyWindow @ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors +@ cdecl GetKeyboardLayout(long) macdrv_GetKeyboardLayout +@ cdecl GetKeyboardLayoutName(ptr) macdrv_GetKeyboardLayoutName @ cdecl GetKeyNameText(long ptr long) macdrv_GetKeyNameText @ cdecl GetMonitorInfo(long ptr) macdrv_GetMonitorInfo @ cdecl MapVirtualKeyEx(long long long) macdrv_MapVirtualKeyEx
1
0
0
0
Ken Thomases : winemac: Implement GetKeyNameText().
by Alexandre Julliard
06 Feb '13
06 Feb '13
Module: wine Branch: master Commit: 2b4d95cd477da28ead3caa970a46d3a4fa249e67 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2b4d95cd477da28ead3caa970…
Author: Ken Thomases <ken(a)codeweavers.com> Date: Wed Feb 6 04:37:00 2013 -0600 winemac: Implement GetKeyNameText(). --- dlls/winemac.drv/keyboard.c | 171 +++++++++++++++++++++++++++++++++++++ dlls/winemac.drv/winemac.drv.spec | 1 + 2 files changed, 172 insertions(+), 0 deletions(-) diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index ecd89fc..ae8df76 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -312,6 +312,88 @@ static const struct { }; +static const struct { + DWORD vkey; + const char *name; +} vkey_names[] = { + { VK_ADD, "Num +" }, + { VK_BACK, "Backspace" }, + { VK_CAPITAL, "Caps Lock" }, + { VK_CONTROL, "Ctrl" }, + { VK_DECIMAL, "Num Del" }, + { VK_DELETE | 0x100, "Delete" }, + { VK_DIVIDE | 0x100, "Num /" }, + { VK_DOWN | 0x100, "Down" }, + { VK_END | 0x100, "End" }, + { VK_ESCAPE, "Esc" }, + { VK_F1, "F1" }, + { VK_F2, "F2" }, + { VK_F3, "F3" }, + { VK_F4, "F4" }, + { VK_F5, "F5" }, + { VK_F6, "F6" }, + { VK_F7, "F7" }, + { VK_F8, "F8" }, + { VK_F9, "F9" }, + { VK_F10, "F10" }, + { VK_F11, "F11" }, + { VK_F12, "F12" }, + { VK_F13, "F13" }, + { VK_F14, "F14" }, + { VK_F15, "F15" }, + { VK_F16, "F16" }, + { VK_F17, "F17" }, + { VK_F18, "F18" }, + { VK_F19, "F19" }, + { VK_F20, "F20" }, + { VK_F21, "F21" }, + { VK_F22, "F22" }, + { VK_F23, "F23" }, + { VK_F24, "F24" }, + { VK_HELP | 0x100, "Help" }, + { VK_HOME | 0x100, "Home" }, + { VK_INSERT | 0x100, "Insert" }, + { VK_LCONTROL, "Ctrl" }, + { VK_LEFT | 0x100, "Left" }, + { VK_LMENU, "Alt" }, + { VK_LSHIFT, "Shift" }, + { VK_LWIN | 0x100, "Win" }, + { VK_MENU, "Alt" }, + { VK_MULTIPLY, "Num *" }, + { VK_NEXT | 0x100, "Page Down" }, + { VK_NUMLOCK | 0x100, "Num Lock" }, + { VK_NUMPAD0, "Num 0" }, + { VK_NUMPAD1, "Num 1" }, + { VK_NUMPAD2, "Num 2" }, + { VK_NUMPAD3, "Num 3" }, + { VK_NUMPAD4, "Num 4" }, + { VK_NUMPAD5, "Num 5" }, + { VK_NUMPAD6, "Num 6" }, + { VK_NUMPAD7, "Num 7" }, + { VK_NUMPAD8, "Num 8" }, + { VK_NUMPAD9, "Num 9" }, + { VK_OEM_CLEAR, "Num Clear" }, + { VK_OEM_NEC_EQUAL | 0x100, "Num =" }, + { VK_PRIOR | 0x100, "Page Up" }, + { VK_RCONTROL | 0x100, "Right Ctrl" }, + { VK_RETURN, "Return" }, + { VK_RETURN | 0x100, "Num Enter" }, + { VK_RIGHT | 0x100, "Right" }, + { VK_RMENU | 0x100, "Right Alt" }, + { VK_RSHIFT, "Right Shift" }, + { VK_RWIN | 0x100, "Right Win" }, + { VK_SEPARATOR, "Num ," }, + { VK_SHIFT, "Shift" }, + { VK_SPACE, "Space" }, + { VK_SUBTRACT, "Num -" }, + { VK_TAB, "Tab" }, + { VK_UP | 0x100, "Up" }, + { VK_VOLUME_DOWN | 0x100, "Volume Down" }, + { VK_VOLUME_MUTE | 0x100, "Mute" }, + { VK_VOLUME_UP | 0x100, "Volume Up" }, +}; + + static BOOL char_matches_string(WCHAR wchar, UniChar *string, BOOL ignore_diacritics) { BOOL ret; @@ -774,6 +856,95 @@ void CDECL macdrv_Beep(void) /*********************************************************************** + * GetKeyNameText (MACDRV.@) + */ +INT CDECL macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size) +{ + struct macdrv_thread_data *thread_data = macdrv_init_thread_data(); + int scan, keyc; + + scan = (lparam >> 16) & 0x1FF; + for (keyc = 0; keyc < sizeof(thread_data->keyc2scan)/sizeof(thread_data->keyc2scan[0]); keyc++) + { + if (thread_data->keyc2scan[keyc] == scan) + { + static const WCHAR dead[] = {' ','d','e','a','d',0}; + const UCKeyboardLayout *uchr; + UInt32 deadKeyState = 0; + UniCharCount len; + OSStatus status; + + uchr = (const UCKeyboardLayout*)CFDataGetBytePtr(thread_data->keyboard_layout_uchr); + status = UCKeyTranslate(uchr, keyc, kUCKeyActionDisplay, 0, thread_data->keyboard_type, + 0, &deadKeyState, size - 1, &len, (UniChar*)buffer); + if (status != noErr) + len = 0; + if (len && isgraphW(buffer[0])) + buffer[len] = 0; + else + { + DWORD vkey = thread_data->keyc2vkey[keyc]; + int i; + + if (scan & 0x100) vkey |= 0x100; + + if (lparam & (1 << 25)) + { + /* Caller doesn't care about distinctions between left and + right keys. */ + switch (vkey) + { + case VK_LSHIFT: + case VK_RSHIFT: + vkey = VK_SHIFT; break; + case VK_LCONTROL: + case VK_RCONTROL: + vkey = VK_CONTROL; break; + case VK_LMENU: + case VK_RMENU: + vkey = VK_MENU; break; + } + } + + len = 0; + for (i = 0; i < sizeof(vkey_names) / sizeof(vkey_names[0]); i++) + { + if (vkey_names[i].vkey == vkey) + { + len = MultiByteToWideChar(CP_UTF8, 0, vkey_names[i].name, -1, buffer, size); + if (len) len--; + break; + } + } + + if (!len) + { + static const WCHAR format[] = {'K','e','y',' ','0','x','%','0','2','x',0}; + snprintfW(buffer, size, format, vkey); + len = strlenW(buffer); + } + } + + if (!len) + break; + + if (status == noErr && deadKeyState) + { + lstrcpynW(buffer + len, dead, size - len); + len = strlenW(buffer); + } + + TRACE("lparam 0x%08x -> %s\n", lparam, debugstr_w(buffer)); + return len; + } + } + + WARN("found no name for lparam 0x%08x\n", lparam); + return 0; +} + + +/*********************************************************************** * MapVirtualKeyEx (MACDRV.@) */ UINT CDECL macdrv_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl) diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec index 754f697..1bb7d8c 100644 --- a/dlls/winemac.drv/winemac.drv.spec +++ b/dlls/winemac.drv/winemac.drv.spec @@ -9,6 +9,7 @@ @ cdecl CreateWindow(long) macdrv_CreateWindow @ cdecl DestroyWindow(long) macdrv_DestroyWindow @ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors +@ cdecl GetKeyNameText(long ptr long) macdrv_GetKeyNameText @ cdecl GetMonitorInfo(long ptr) macdrv_GetMonitorInfo @ cdecl MapVirtualKeyEx(long long long) macdrv_MapVirtualKeyEx @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) macdrv_MsgWaitForMultipleObjectsEx
1
0
0
0
Ken Thomases : winemac: Implement VkKeyScanEx().
by Alexandre Julliard
06 Feb '13
06 Feb '13
Module: wine Branch: master Commit: 80baa3a0e9389c0a79731c70d42645ff885b0b08 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=80baa3a0e9389c0a79731c70d…
Author: Ken Thomases <ken(a)codeweavers.com> Date: Wed Feb 6 04:36:57 2013 -0600 winemac: Implement VkKeyScanEx(). --- dlls/winemac.drv/keyboard.c | 73 +++++++++++++++++++++++++++++++++++++ dlls/winemac.drv/winemac.drv.spec | 1 + 2 files changed, 74 insertions(+), 0 deletions(-) diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index e969359..ecd89fc 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -1087,3 +1087,76 @@ done: TRACE_(key)("returning %d / %s\n", ret, debugstr_wn(bufW, abs(ret))); return ret; } + + +/*********************************************************************** + * VkKeyScanEx (MACDRV.@) + * + * Note: Windows ignores HKL parameter and uses current active layout instead + */ +SHORT CDECL macdrv_VkKeyScanEx(WCHAR wChar, HKL hkl) +{ + struct macdrv_thread_data *thread_data = macdrv_init_thread_data(); + SHORT ret = -1; + int state; + const UCKeyboardLayout *uchr; + + TRACE("%04x, %p\n", wChar, hkl); + + uchr = (const UCKeyboardLayout*)CFDataGetBytePtr(thread_data->keyboard_layout_uchr); + if (!uchr) + { + TRACE("no keyboard layout UCHR data; returning -1\n"); + return -1; + } + + for (state = 0; state < 8; state++) + { + UInt32 modifierKeyState = 0; + int keyc; + + if (state & 1) + modifierKeyState |= (shiftKey >> 8); + if ((state & 6) == 6) + modifierKeyState |= (optionKey >> 8); + else + { + if (state & 2) + modifierKeyState |= (controlKey >> 8); + if (state & 4) + modifierKeyState |= (cmdKey >> 8); + } + + for (keyc = 0; keyc < sizeof(thread_data->keyc2vkey) / sizeof(thread_data->keyc2vkey[0]); keyc++) + { + UInt32 deadKeyState = 0; + UniChar uchar; + UniCharCount len; + OSStatus status; + + if (!thread_data->keyc2vkey[keyc]) continue; + + status = UCKeyTranslate(uchr, keyc, kUCKeyActionDown, modifierKeyState, + thread_data->keyboard_type, 0, &deadKeyState, + 1, &len, &uchar); + if (status == noErr && len == 1 && uchar == wChar) + { + WORD vkey = thread_data->keyc2vkey[keyc]; + + ret = vkey | (state << 8); + if ((VK_NUMPAD0 <= vkey && vkey <= VK_DIVIDE) || + keyc == kVK_ANSI_KeypadClear || keyc == kVK_ANSI_KeypadEnter || + keyc == kVK_ANSI_KeypadEquals) + { + /* Keep searching for a non-numpad match, which is preferred. */ + } + else + goto done; + } + } + } + +done: + TRACE(" -> 0x%04x\n", ret); + return ret; +} diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec index 0d91bd8..754f697 100644 --- a/dlls/winemac.drv/winemac.drv.spec +++ b/dlls/winemac.drv/winemac.drv.spec @@ -22,6 +22,7 @@ @ cdecl ShowWindow(long long ptr long) macdrv_ShowWindow @ cdecl ToUnicodeEx(long long ptr ptr long long long) macdrv_ToUnicodeEx @ cdecl UpdateLayeredWindow(long ptr ptr) macdrv_UpdateLayeredWindow +@ cdecl VkKeyScanEx(long long) macdrv_VkKeyScanEx @ cdecl WindowMessage(long long long long) macdrv_WindowMessage @ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) macdrv_WindowPosChanged @ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) macdrv_WindowPosChanging
1
0
0
0
Ken Thomases : winemac: Implement MapVirtualKeyEx().
by Alexandre Julliard
06 Feb '13
06 Feb '13
Module: wine Branch: master Commit: a649d845ed52903cac6c3f1e459c5f74befd11b3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a649d845ed52903cac6c3f1e4…
Author: Ken Thomases <ken(a)codeweavers.com> Date: Wed Feb 6 04:36:52 2013 -0600 winemac: Implement MapVirtualKeyEx(). --- dlls/winemac.drv/keyboard.c | 125 +++++++++++++++++++++++++++++++++++++ dlls/winemac.drv/winemac.drv.spec | 1 + 2 files changed, 126 insertions(+), 0 deletions(-) diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index d67a20c..e969359 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -774,6 +774,131 @@ void CDECL macdrv_Beep(void) /*********************************************************************** + * MapVirtualKeyEx (MACDRV.@) + */ +UINT CDECL macdrv_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl) +{ + struct macdrv_thread_data *thread_data = macdrv_init_thread_data(); + UINT ret = 0; + int keyc; + + TRACE("wCode=0x%x, wMapType=%d, hkl %p\n", wCode, wMapType, hkl); + + switch (wMapType) + { + case MAPVK_VK_TO_VSC: /* vkey-code to scan-code */ + case MAPVK_VK_TO_VSC_EX: + switch (wCode) + { + case VK_SHIFT: wCode = VK_LSHIFT; break; + case VK_CONTROL: wCode = VK_LCONTROL; break; + case VK_MENU: wCode = VK_LMENU; break; + } + + /* vkey -> keycode -> scan */ + for (keyc = 0; keyc < sizeof(thread_data->keyc2vkey)/sizeof(thread_data->keyc2vkey[0]); keyc++) + { + if (thread_data->keyc2vkey[keyc] == wCode) + { + ret = thread_data->keyc2scan[keyc] & 0xFF; + break; + } + } + break; + + case MAPVK_VSC_TO_VK: /* scan-code to vkey-code */ + case MAPVK_VSC_TO_VK_EX: + /* scan -> keycode -> vkey */ + for (keyc = 0; keyc < sizeof(thread_data->keyc2vkey)/sizeof(thread_data->keyc2vkey[0]); keyc++) + if ((thread_data->keyc2scan[keyc] & 0xFF) == (wCode & 0xFF)) + { + ret = thread_data->keyc2vkey[keyc]; + /* Only stop if it's not a numpad vkey; otherwise keep + looking for a potential better vkey. */ + if (ret && (ret < VK_NUMPAD0 || VK_DIVIDE < ret)) + break; + } + + if (wMapType == MAPVK_VSC_TO_VK) + switch (ret) + { + case VK_LSHIFT: + case VK_RSHIFT: + ret = VK_SHIFT; break; + case VK_LCONTROL: + case VK_RCONTROL: + ret = VK_CONTROL; break; + case VK_LMENU: + case VK_RMENU: + ret = VK_MENU; break; + } + + break; + + case MAPVK_VK_TO_CHAR: /* vkey-code to character */ + { + /* vkey -> keycode -> (UCKeyTranslate) wide char */ + struct macdrv_thread_data *thread_data = macdrv_thread_data(); + const UCKeyboardLayout *uchr; + UniChar s[10]; + OSStatus status; + UInt32 deadKeyState; + UniCharCount len; + BOOL deadKey = FALSE; + + if ((VK_PRIOR <= wCode && wCode <= VK_HELP) || + (VK_F1 <= wCode && wCode <= VK_F24)) + break; + + if (!thread_data || !thread_data->keyboard_layout_uchr) + { + WARN("No keyboard layout uchr data\n"); + break; + } + + uchr = (const UCKeyboardLayout*)CFDataGetBytePtr(thread_data->keyboard_layout_uchr); + + /* Find the Mac keycode corresponding to the vkey */ + for (keyc = 0; keyc < sizeof(thread_data->keyc2vkey)/sizeof(thread_data->keyc2vkey[0]); keyc++) + if (thread_data->keyc2vkey[keyc] == wCode) break; + + if (keyc >= sizeof(thread_data->keyc2vkey)/sizeof(thread_data->keyc2vkey[0])) + { + WARN("Unknown virtual key %X\n", wCode); + break; + } + + TRACE("Found keycode %u\n", keyc); + + deadKeyState = 0; + status = UCKeyTranslate(uchr, keyc, kUCKeyActionDown, 0, + thread_data->keyboard_type, 0, &deadKeyState, + sizeof(s)/sizeof(s[0]), &len, s); + if (status == noErr && !len && deadKeyState) + { + deadKey = TRUE; + deadKeyState = 0; + status = UCKeyTranslate(uchr, keyc, kUCKeyActionDown, 0, + thread_data->keyboard_type, kUCKeyTranslateNoDeadKeysMask, + &deadKeyState, sizeof(s)/sizeof(s[0]), &len, s); + } + + if (status == noErr && len) + ret = toupperW(s[0]) | (deadKey ? 0x80000000 : 0); + + break; + } + default: /* reserved */ + FIXME("Unknown wMapType %d\n", wMapType); + break; + } + + TRACE("returning 0x%04x\n", ret); + return ret; +} + + +/*********************************************************************** * ToUnicodeEx (MACDRV.@) * * The ToUnicode function translates the specified virtual-key code and keyboard diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec index f4502ea..0d91bd8 100644 --- a/dlls/winemac.drv/winemac.drv.spec +++ b/dlls/winemac.drv/winemac.drv.spec @@ -10,6 +10,7 @@ @ cdecl DestroyWindow(long) macdrv_DestroyWindow @ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors @ cdecl GetMonitorInfo(long ptr) macdrv_GetMonitorInfo +@ cdecl MapVirtualKeyEx(long long long) macdrv_MapVirtualKeyEx @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) macdrv_MsgWaitForMultipleObjectsEx @ cdecl ScrollDC(long long long ptr ptr long ptr) macdrv_ScrollDC @ cdecl SetFocus(long) macdrv_SetFocus
1
0
0
0
Ken Thomases : winemac: Implement Beep().
by Alexandre Julliard
06 Feb '13
06 Feb '13
Module: wine Branch: master Commit: 3fcb69b7ca0c2f301b278949f80d3e09f904e18b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3fcb69b7ca0c2f301b278949f…
Author: Ken Thomases <ken(a)codeweavers.com> Date: Wed Feb 6 04:36:49 2013 -0600 winemac: Implement Beep(). --- dlls/winemac.drv/cocoa_app.m | 12 ++++++++++++ dlls/winemac.drv/keyboard.c | 9 +++++++++ dlls/winemac.drv/macdrv_cocoa.h | 1 + dlls/winemac.drv/winemac.drv.spec | 1 + 4 files changed, 23 insertions(+), 0 deletions(-) diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index cd09f95..3853ec9 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -373,3 +373,15 @@ CFDataRef macdrv_copy_keyboard_layout(CGEventSourceKeyboardType* keyboard_type, return result; } + +/*********************************************************************** + * macdrv_beep + * + * Play the beep sound configured by the user in System Preferences. + */ +void macdrv_beep(void) +{ + OnMainThreadAsync(^{ + NSBeep(); + }); +} diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index b41f55a..d67a20c 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -765,6 +765,15 @@ void macdrv_keyboard_changed(const macdrv_event *event) /*********************************************************************** + * Beep (MACDRV.@) + */ +void CDECL macdrv_Beep(void) +{ + macdrv_beep(); +} + + +/*********************************************************************** * ToUnicodeEx (MACDRV.@) * * The ToUnicode function translates the specified virtual-key code and keyboard diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 62bc996..242a78e 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -115,6 +115,7 @@ extern int macdrv_err_on; extern int macdrv_start_cocoa_app(unsigned long long tickcount) DECLSPEC_HIDDEN; extern void macdrv_window_rejected_focus(const struct macdrv_event *event) DECLSPEC_HIDDEN; +extern void macdrv_beep(void) DECLSPEC_HIDDEN; /* display */ diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec index a227187..f4502ea 100644 --- a/dlls/winemac.drv/winemac.drv.spec +++ b/dlls/winemac.drv/winemac.drv.spec @@ -4,6 +4,7 @@ # USER driver +@ cdecl Beep() macdrv_Beep @ cdecl CreateDesktopWindow(long) macdrv_CreateDesktopWindow @ cdecl CreateWindow(long) macdrv_CreateWindow @ cdecl DestroyWindow(long) macdrv_DestroyWindow
1
0
0
0
Michael Stefaniuc : ieframe: Let C look like C.
by Alexandre Julliard
06 Feb '13
06 Feb '13
Module: wine Branch: master Commit: 0c183c4e7917c1c560d4b5e5da51a84ec2b7bdd6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0c183c4e7917c1c560d4b5e5d…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Feb 6 10:59:50 2013 +0100 ieframe: Let C look like C. --- dlls/ieframe/intshcut.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/ieframe/intshcut.c b/dlls/ieframe/intshcut.c index 71373c7..d4b71a7 100644 --- a/dlls/ieframe/intshcut.c +++ b/dlls/ieframe/intshcut.c @@ -613,7 +613,7 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *pFile, LPCOLESTR pszFileNam WriteFile(file, str_eol, lstrlenA(str_eol), &bytesWritten, NULL); hr = IPropertySetStorage_Open(This->property_set_storage, &FMTID_Intshcut, STGM_READ|STGM_SHARE_EXCLUSIVE, &pPropStgRead); - if SUCCEEDED(hr) + if (SUCCEEDED(hr)) { hr = IPropertyStorage_ReadMultiple(pPropStgRead, 2, ps, pvread); if (hr == S_FALSE) @@ -622,7 +622,7 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *pFile, LPCOLESTR pszFileNam hr = S_OK; IPropertyStorage_Release(pPropStgRead); } - else if SUCCEEDED(hr) + else if (SUCCEEDED(hr)) { char indexString[50]; len = WideCharToMultiByte(CP_UTF8, 0, pvread[0].u.pwszVal, -1, NULL, 0, 0, 0); @@ -819,7 +819,7 @@ static InternetShortcut *create_shortcut(void) newshortcut->refCount = 1; hr = StgCreateStorageEx(NULL, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, STGFMT_STORAGE, 0, NULL, NULL, &IID_IPropertySetStorage, (void **) &newshortcut->property_set_storage); - if FAILED(hr) + if (FAILED(hr)) { TRACE("Failed to create the storage object needed for the shortcut.\n"); heap_free(newshortcut); @@ -827,7 +827,7 @@ static InternetShortcut *create_shortcut(void) } hr = IPropertySetStorage_Create(newshortcut->property_set_storage, &FMTID_Intshcut, NULL, PROPSETFLAG_DEFAULT, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &dummy); - if FAILED(hr) + if (FAILED(hr)) { TRACE("Failed to create the property object needed for the shortcut.\n"); IPropertySetStorage_Release(newshortcut->property_set_storage);
1
0
0
0
← Newer
1
...
38
39
40
41
42
43
44
45
46
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Results per page:
10
25
50
100
200