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
March
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
September 2009
----- 2025 -----
March 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
3 participants
866 discussions
Start a n
N
ew thread
Vincent Povirk : gdiplus: Use WIC to encode images.
by Alexandre Julliard
02 Sep '09
02 Sep '09
Module: wine Branch: master Commit: e4a3ad81bef7a03eaade11e9a02acd03b44f0701 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e4a3ad81bef7a03eaade11e9a…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Mon Aug 24 15:15:31 2009 -0500 gdiplus: Use WIC to encode images. --- dlls/gdiplus/image.c | 219 +++++++++++++++++++++++++++++-------------------- 1 files changed, 130 insertions(+), 89 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 6c48663..61e7b03 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -1623,8 +1623,8 @@ static GpStatus decode_image_olepicture_metafile(IStream* stream, REFCLSID clsid return Ok; } -typedef GpStatus (*encode_image_func)(LPVOID bitmap_bits, LPBITMAPINFO bitmap_info, - void **output, unsigned int *output_size); +typedef GpStatus (*encode_image_func)(GpImage *image, IStream* stream, + GDIPCONST CLSID* clsid, GDIPCONST EncoderParameters* params); typedef GpStatus (*decode_image_func)(IStream *stream, REFCLSID clsid, GpImage** image); @@ -1771,48 +1771,138 @@ GpStatus WINGDIPAPI GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR* filenam #define BITMAP_FORMAT_PNG 0x5089 #define BITMAP_FORMAT_APM 0xcdd7 -static GpStatus encode_image_BMP(LPVOID bitmap_bits, LPBITMAPINFO bitmap_info, - void **output, unsigned int *output_size) +static GpStatus encode_image_WIC(GpImage *image, IStream* stream, + GDIPCONST CLSID* clsid, GDIPCONST EncoderParameters* params) { - int num_palette_entries; - BITMAPFILEHEADER *bmp_file_hdr; - BITMAPINFO *bmp_info_hdr; + GpStatus stat; + GpBitmap *bitmap; + IWICBitmapEncoder *encoder; + IWICBitmapFrameEncode *frameencode; + IPropertyBag2 *encoderoptions; + HRESULT hr; + UINT width, height; + PixelFormat gdipformat=0; + WICPixelFormatGUID wicformat; + GpRect rc; + BitmapData lockeddata; + HRESULT initresult; + UINT i; - if (bitmap_info->bmiHeader.biClrUsed) { - num_palette_entries = bitmap_info->bmiHeader.biClrUsed; - if (num_palette_entries > 256) num_palette_entries = 256; - } else { - if (bitmap_info->bmiHeader.biBitCount <= 8) - num_palette_entries = 1 << bitmap_info->bmiHeader.biBitCount; - else - num_palette_entries = 0; + if (image->type != ImageTypeBitmap) + return GenericError; + + bitmap = (GpBitmap*)image; + + GdipGetImageWidth(image, &width); + GdipGetImageHeight(image, &height); + + rc.X = 0; + rc.Y = 0; + rc.Width = width; + rc.Height = height; + + initresult = CoInitialize(NULL); + + hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICBitmapEncoder, (void**)&encoder); + if (FAILED(hr)) + { + if (SUCCEEDED(initresult)) CoUninitialize(); + return hresult_to_status(hr); } - *output_size = - sizeof(BITMAPFILEHEADER) + - sizeof(BITMAPINFOHEADER) + - num_palette_entries * sizeof(RGBQUAD) + - bitmap_info->bmiHeader.biSizeImage; + hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache); - *output = GdipAlloc(*output_size); + if (SUCCEEDED(hr)) + { + hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frameencode, &encoderoptions); + } - bmp_file_hdr = *output; - bmp_file_hdr->bfType = BITMAP_FORMAT_BMP; - bmp_file_hdr->bfSize = *output_size; - bmp_file_hdr->bfOffBits = - sizeof(BITMAPFILEHEADER) + - sizeof(BITMAPINFOHEADER) + - num_palette_entries * sizeof (RGBQUAD); + if (SUCCEEDED(hr)) /* created frame */ + { + hr = IWICBitmapFrameEncode_Initialize(frameencode, encoderoptions); - bmp_info_hdr = (BITMAPINFO*) ((unsigned char*)(*output) + sizeof(BITMAPFILEHEADER)); - memcpy(bmp_info_hdr, bitmap_info, sizeof(BITMAPINFOHEADER) + num_palette_entries * sizeof(RGBQUAD)); - memcpy((unsigned char *)(*output) + - sizeof(BITMAPFILEHEADER) + - sizeof(BITMAPINFOHEADER) + - num_palette_entries * sizeof(RGBQUAD), - bitmap_bits, bitmap_info->bmiHeader.biSizeImage); + if (SUCCEEDED(hr)) + hr = IWICBitmapFrameEncode_SetSize(frameencode, width, height); - return Ok; + if (SUCCEEDED(hr)) + /* FIXME: use the resolution from the image */ + hr = IWICBitmapFrameEncode_SetResolution(frameencode, 96.0, 96.0); + + if (SUCCEEDED(hr)) + { + for (i=0; wic_pixel_formats[i]; i++) + { + if (wic_gdip_formats[i] == bitmap->format) + break; + } + if (wic_pixel_formats[i]) + memcpy(&wicformat, wic_pixel_formats[i], sizeof(GUID)); + else + memcpy(&wicformat, &GUID_WICPixelFormat32bppBGRA, sizeof(GUID)); + + hr = IWICBitmapFrameEncode_SetPixelFormat(frameencode, &wicformat); + + for (i=0; wic_pixel_formats[i]; i++) + { + if (IsEqualGUID(&wicformat, wic_pixel_formats[i])) + break; + } + if (wic_pixel_formats[i]) + gdipformat = wic_gdip_formats[i]; + else + { + ERR("cannot provide pixel format %s\n", debugstr_guid(&wicformat)); + hr = E_FAIL; + } + } + + if (SUCCEEDED(hr)) + { + stat = GdipBitmapLockBits(bitmap, &rc, ImageLockModeRead, gdipformat, + &lockeddata); + + if (stat == Ok) + { + UINT row_size = (lockeddata.Width * PIXELFORMATBPP(gdipformat) + 7)/8; + BYTE *row; + + /* write one row at a time in case stride is negative */ + row = lockeddata.Scan0; + for (i=0; i<lockeddata.Height; i++) + { + hr = IWICBitmapFrameEncode_WritePixels(frameencode, 1, row_size, row_size, row); + if (FAILED(hr)) break; + row += lockeddata.Stride; + } + + GdipBitmapUnlockBits(bitmap, &lockeddata); + } + else + hr = E_FAIL; + } + + if (SUCCEEDED(hr)) + hr = IWICBitmapFrameEncode_Commit(frameencode); + + IWICBitmapFrameEncode_Release(frameencode); + IPropertyBag2_Release(encoderoptions); + } + + if (SUCCEEDED(hr)) + hr = IWICBitmapEncoder_Commit(encoder); + + IWICBitmapEncoder_Release(encoder); + + if (SUCCEEDED(initresult)) CoUninitialize(); + + return hresult_to_status(hr); +} + +static GpStatus encode_image_BMP(GpImage *image, IStream* stream, + GDIPCONST CLSID* clsid, GDIPCONST EncoderParameters* params) +{ + return encode_image_WIC(image, stream, &CLSID_WICBmpEncoder, params); } /***************************************************************************** @@ -1822,30 +1912,14 @@ GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream, GDIPCONST CLSID* clsid, GDIPCONST EncoderParameters* params) { GpStatus stat; - HBITMAP hbmp; - HBITMAP old_hbmp; - HDC hdc; - int bm_is_selected; - BITMAPINFO bmp_info; - LPVOID bmp_bits; encode_image_func encode_image; - LPVOID output; - unsigned int output_size; - unsigned int dummy; int i; - old_hbmp = 0; - output = NULL; - output_size = 0; - TRACE("%p %p %p %p\n", image, stream, clsid, params); if(!image || !stream) return InvalidParameter; - if (image->type != ImageTypeBitmap) - return GenericError; - /* select correct encoder */ encode_image = NULL; for (i = 0; i < NUM_CODECS; i++) { @@ -1856,40 +1930,7 @@ GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream, if (encode_image == NULL) return UnknownImageFormat; - hbmp = ((GpBitmap*)image)->hbitmap; - if (!hbmp) - return GenericError; - hdc = ((GpBitmap*)image)->hdc; - bm_is_selected = (hdc != 0); - if (!bm_is_selected) { - hdc = CreateCompatibleDC(0); - old_hbmp = SelectObject(hdc, hbmp); - } - - /* get bits from HBITMAP */ - bmp_info.bmiHeader.biSize = sizeof(bmp_info.bmiHeader); - bmp_info.bmiHeader.biBitCount = 0; - GetDIBits(hdc, hbmp, 0, 0, NULL, &bmp_info, DIB_RGB_COLORS); - - bmp_bits = GdipAlloc(bmp_info.bmiHeader.biSizeImage); - - if (bmp_bits) - GetDIBits(hdc, hbmp, 0, abs(bmp_info.bmiHeader.biHeight), bmp_bits, &bmp_info, DIB_RGB_COLORS); - - if (!bm_is_selected) { - SelectObject(hdc, old_hbmp); - DeleteDC(hdc); - } - - if (!bmp_bits) - return OutOfMemory; - - stat = encode_image(bmp_bits, &bmp_info, &output, &output_size); - if (stat == Ok) - IStream_Write(stream, output, output_size, &dummy); - - GdipFree(output); - GdipFree(bmp_bits); + stat = encode_image(image, stream, clsid, params); return stat; }
1
0
0
0
Vincent Povirk : oleaut32: Use WIC to decode PNG images.
by Alexandre Julliard
02 Sep '09
02 Sep '09
Module: wine Branch: master Commit: e5d2a6932d7609601d7bc3f9c80aff31008c8fe3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e5d2a6932d7609601d7bc3f9c…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Tue Sep 1 17:31:20 2009 -0500 oleaut32: Use WIC to decode PNG images. --- dlls/oleaut32/Makefile.in | 1 - dlls/oleaut32/olepicture.c | 257 +------------------------------------------- 2 files changed, 1 insertions(+), 257 deletions(-) diff --git a/dlls/oleaut32/Makefile.in b/dlls/oleaut32/Makefile.in index 59b4b91..7e90511 100644 --- a/dlls/oleaut32/Makefile.in +++ b/dlls/oleaut32/Makefile.in @@ -8,7 +8,6 @@ IMPORTS = uuid ole32 rpcrt4 user32 gdi32 advapi32 kernel32 ntdll DELAYIMPORTS = comctl32 urlmon windowscodecs EXTRADEFS = -D_OLEAUT32_ -DCOM_NO_WINDOWS_H \ -DENTRY_PREFIX=OLEAUTPS_ -DPROXY_CLSID=CLSID_PSDispatch -DPROXY_DELEGATION -DREGISTER_PROXY_DLL -EXTRAINCL = @PNGINCL@ C_SRCS = \ connpt.c \ diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c index f3e7789..052aa9a 100644 --- a/dlls/oleaut32/olepicture.c +++ b/dlls/oleaut32/olepicture.c @@ -46,13 +46,6 @@ #include <stdio.h> #include <string.h> -#ifdef HAVE_PNG_H -#include <png.h> -#endif - -/* Must be before wine includes, the header has things conflicting with - * WINE headers. - */ #define COBJMACROS #define NONAMELESSUNION #define NONAMELESSSTRUCT @@ -1192,254 +1185,6 @@ static HRESULT OLEPictureImpl_LoadWICDecoder(OLEPictureImpl *This, REFCLSID deco } /***************************************************** -* start of PNG-specific code -* currently only supports colortype PNG_COLOR_TYPE_RGB -*/ -#ifdef SONAME_LIBPNG -typedef struct{ - ULONG position; - ULONG size; - BYTE * buff; -} png_io; - -static void png_stream_read_data(png_structp png_ptr, png_bytep data, - png_size_t length) -{ - png_io * io_ptr = png_ptr->io_ptr; - - if(length + io_ptr->position > io_ptr->size){ - length = io_ptr->size - io_ptr->position; - } - - memcpy(data, io_ptr->buff + io_ptr->position, length); - - io_ptr->position += length; -} - -static void *libpng_handle; -#define MAKE_FUNCPTR(f) static typeof(f) * p##f -MAKE_FUNCPTR(png_create_read_struct); -MAKE_FUNCPTR(png_create_info_struct); -MAKE_FUNCPTR(png_set_read_fn); -MAKE_FUNCPTR(png_read_info); -MAKE_FUNCPTR(png_read_image); -MAKE_FUNCPTR(png_get_rowbytes); -MAKE_FUNCPTR(png_set_bgr); -MAKE_FUNCPTR(png_destroy_read_struct); -MAKE_FUNCPTR(png_set_palette_to_rgb); -MAKE_FUNCPTR(png_read_update_info); -MAKE_FUNCPTR(png_get_tRNS); -MAKE_FUNCPTR(png_get_PLTE); -MAKE_FUNCPTR(png_set_expand); -#undef MAKE_FUNCPTR - -static void *load_libpng(void) -{ - if((libpng_handle = wine_dlopen(SONAME_LIBPNG, RTLD_NOW, NULL, 0)) != NULL) { - -#define LOAD_FUNCPTR(f) \ - if((p##f = wine_dlsym(libpng_handle, #f, NULL, 0)) == NULL) { \ - libpng_handle = NULL; \ - return NULL; \ - } - LOAD_FUNCPTR(png_create_read_struct); - LOAD_FUNCPTR(png_create_info_struct); - LOAD_FUNCPTR(png_set_read_fn); - LOAD_FUNCPTR(png_read_info); - LOAD_FUNCPTR(png_read_image); - LOAD_FUNCPTR(png_get_rowbytes); - LOAD_FUNCPTR(png_set_bgr); - LOAD_FUNCPTR(png_destroy_read_struct); - LOAD_FUNCPTR(png_set_palette_to_rgb); - LOAD_FUNCPTR(png_read_update_info); - LOAD_FUNCPTR(png_get_tRNS); - LOAD_FUNCPTR(png_get_PLTE); - LOAD_FUNCPTR(png_set_expand); - -#undef LOAD_FUNCPTR - } - return libpng_handle; -} -#endif /* SONAME_LIBPNG */ - -static HRESULT OLEPictureImpl_LoadPNG(OLEPictureImpl *This, BYTE *xbuf, ULONG xread) -{ -#ifdef SONAME_LIBPNG - png_io io; - png_structp png_ptr = NULL; - png_infop info_ptr = NULL; - INT row, rowsize, height, width, num_trans, i, j; - png_bytep* row_pointers = NULL; - png_bytep pngdata = NULL; - BITMAPINFOHEADER bmi; - HDC hdcref = NULL, hdcXor, hdcMask; - HRESULT ret; - BOOL transparency; - png_bytep trans; - png_color_16p trans_values; - COLORREF white = RGB(255, 255, 255), black = RGB(0, 0, 0); - HBITMAP hbmoldXor, hbmoldMask, temp; - - if(!libpng_handle) { - if(!load_libpng()) { - ERR("Failed reading PNG because unable to find %s\n",SONAME_LIBPNG); - return E_FAIL; - } - } - - io.size = xread; - io.position = 0; - io.buff = xbuf; - - png_ptr = ppng_create_read_struct(PNG_LIBPNG_VER_STRING, - NULL, NULL, NULL); - - if(setjmp(png_jmpbuf(png_ptr))){ - TRACE("Error in libpng\n"); - ret = E_FAIL; - goto end; - } - - info_ptr = ppng_create_info_struct(png_ptr); - ppng_set_read_fn(png_ptr, &io, png_stream_read_data); - ppng_read_info(png_ptr, info_ptr); - - if(!(png_ptr->color_type == PNG_COLOR_TYPE_RGB || - png_ptr->color_type == PNG_COLOR_TYPE_PALETTE || - png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)){ - FIXME("Unsupported .PNG type: %d\n", png_ptr->color_type); - ret = E_FAIL; - goto end; - } - - transparency = (ppng_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &trans_values) - == PNG_INFO_tRNS); - - /* sets format from anything to RGBA */ - ppng_set_expand(png_ptr); - /* sets format to BGRA */ - ppng_set_bgr(png_ptr); - - ppng_read_update_info(png_ptr, info_ptr); - - rowsize = ppng_get_rowbytes(png_ptr, info_ptr); - /* align rowsize to 4-byte boundary */ - rowsize = (rowsize + 3) & ~3; - height = info_ptr->height; - width = info_ptr->width; - - pngdata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, height * rowsize); - row_pointers = HeapAlloc(GetProcessHeap(), 0, height * (sizeof(VOID *))); - - if(!pngdata || !row_pointers){ - ret = E_FAIL; - goto end; - } - - for (row = 0; row < height; row++){ - row_pointers[row] = pngdata + row * rowsize; - } - - ppng_read_image(png_ptr, row_pointers); - - bmi.biSize = sizeof(bmi); - bmi.biWidth = width; - bmi.biHeight = -height; - bmi.biPlanes = 1; - bmi.biBitCount = info_ptr->channels * 8; - bmi.biCompression = BI_RGB; - bmi.biSizeImage = height * rowsize; - bmi.biXPelsPerMeter = 0; - bmi.biYPelsPerMeter = 0; - bmi.biClrUsed = 0; - bmi.biClrImportant = 0; - - hdcref = GetDC(0); - This->desc.u.bmp.hbitmap = CreateDIBitmap( - hdcref, - &bmi, - CBM_INIT, - pngdata, - (BITMAPINFO*)&bmi, - DIB_RGB_COLORS - ); - - /* only fully-transparent alpha is handled */ - if((info_ptr->channels != 4) || !transparency){ - ReleaseDC(0, hdcref); - goto succ; - } - - This->hbmXor = CreateDIBitmap( - hdcref, - &bmi, - CBM_INIT, - pngdata, - (BITMAPINFO*)&bmi, - DIB_RGB_COLORS - ); - - /* set transparent pixels to black, all others to white */ - for(i = 0; i < height; i++){ - for(j = 3; j < rowsize; j += 4){ - if(row_pointers[i][j] == 0) - *((DWORD*)(&row_pointers[i][j - 3])) = black; - else - *((DWORD*)(&row_pointers[i][j - 3])) = white; - } - } - - temp = CreateDIBitmap( - hdcref, - &bmi, - CBM_INIT, - pngdata, - (BITMAPINFO*)&bmi, - DIB_RGB_COLORS - ); - - ReleaseDC(0, hdcref); - - This->hbmMask = CreateBitmap(width,-height,1,1,NULL); - hdcXor = CreateCompatibleDC(NULL); - hdcMask = CreateCompatibleDC(NULL); - - hbmoldXor = SelectObject(hdcXor,temp); - hbmoldMask = SelectObject(hdcMask,This->hbmMask); - SetBkColor(hdcXor,black); - BitBlt(hdcMask,0,0,width,height,hdcXor,0,0,SRCCOPY); - - SelectObject(hdcXor,This->hbmXor); - DeleteObject(temp); - - SetTextColor(hdcXor,white); - SetBkColor(hdcXor,black); - BitBlt(hdcXor,0,0,width,height,hdcMask,0,0,SRCAND); - - SelectObject(hdcXor,hbmoldXor); - SelectObject(hdcMask,hbmoldMask); - - DeleteDC(hdcXor); - DeleteDC(hdcMask); - -succ: - This->desc.picType = PICTYPE_BITMAP; - OLEPictureImpl_SetBitmap(This); - ret = S_OK; - -end: - if(png_ptr) - ppng_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : NULL, NULL); - HeapFree(GetProcessHeap(), 0, row_pointers); - HeapFree(GetProcessHeap(), 0, pngdata); - return ret; -#else /* SONAME_LIBPNG */ - ERR("Trying to load PNG picture, but PNG supported not compiled in.\n"); - return E_FAIL; -#endif -} - -/***************************************************** * start of Icon-specific code */ @@ -1721,7 +1466,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { hr = OLEPictureImpl_LoadDIB(This, xbuf, xread); break; case BITMAP_FORMAT_PNG: /* PNG */ - hr = OLEPictureImpl_LoadPNG(This, xbuf, xread); + hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICPngDecoder, xbuf, xread); break; case BITMAP_FORMAT_APM: /* APM */ hr = OLEPictureImpl_LoadAPM(This, xbuf, xread);
1
0
0
0
Jacek Caban : mshtml: Fixed script tests on IE6 and IE7.
by Alexandre Julliard
02 Sep '09
02 Sep '09
Module: wine Branch: master Commit: ab199297bc3ddede531f72fa5cd08315dc822643 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ab199297bc3ddede531f72fa5…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Sep 1 23:32:09 2009 +0200 mshtml: Fixed script tests on IE6 and IE7. --- dlls/mshtml/tests/script.c | 22 +++++++++------------- 1 files changed, 9 insertions(+), 13 deletions(-) diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index 2c74ff7..877b58a 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -662,15 +662,6 @@ static void test_func(IDispatchEx *obj) ok(V_DISPATCH(&var) != NULL, "V_DISPATCH(var) == NULL\n"); disp = V_DISPATCH(&var); - memset(&dp, 0, sizeof(dp)); - memset(&ei, 0, sizeof(ei)); - VariantInit(&var); - hres = IDispatchEx_InvokeEx(obj, id, LOCALE_NEUTRAL, DISPATCH_PROPERTYGET, &dp, &var, &ei, NULL); - ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); - ok(V_VT(&var) == VT_DISPATCH, "V_VT(var)=%d\n", V_VT(&var)); - ok(V_DISPATCH(&var) == disp, "V_DISPATCH(var) != disp\n"); - VariantClear(&var); - hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); IDispatch_Release(disp); ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres); @@ -681,10 +672,12 @@ static void test_func(IDispatchEx *obj) memset(&ei, 0, sizeof(ei)); VariantInit(&var); hres = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dp, &var, &ei, NULL); - ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); - ok(V_VT(&var) == VT_BSTR, "V_VT(var)=%d\n", V_VT(&var)); - ok(!strcmp_wa(V_BSTR(&var), "[object]"), "V_BSTR(var) = %s\n", wine_dbgstr_w(V_BSTR(&var))); - VariantClear(&var); + ok(hres == S_OK || broken(E_ACCESSDENIED), "InvokeEx failed: %08x\n", hres); + if(SUCCEEDED(hres)) { + ok(V_VT(&var) == VT_BSTR, "V_VT(var)=%d\n", V_VT(&var)); + ok(!strcmp_wa(V_BSTR(&var), "[object]"), "V_BSTR(var) = %s\n", wine_dbgstr_w(V_BSTR(&var))); + VariantClear(&var); + } dp.cArgs = 1; dp.rgvarg = &var; @@ -877,6 +870,9 @@ static HRESULT WINAPI ActiveScript_QueryInterface(IActiveScript *iface, REFIID r return S_OK; } + if(IsEqualGUID(&IID_IActiveScriptDebug, riid)) + return E_NOINTERFACE; + ok(0, "unexpected riid %s\n", debugstr_guid(riid)); return E_NOINTERFACE; }
1
0
0
0
Jacek Caban : jscript.idl: Added IActiveScriptDebug declaration.
by Alexandre Julliard
02 Sep '09
02 Sep '09
Module: wine Branch: master Commit: 4cfa6cafda98e4c22a3c52d3e149991066b039c7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4cfa6cafda98e4c22a3c52d3e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Sep 1 23:31:51 2009 +0200 jscript.idl: Added IActiveScriptDebug declaration. --- include/activdbg.idl | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 89 insertions(+), 0 deletions(-) diff --git a/include/activdbg.idl b/include/activdbg.idl index c046ad3..f3cdff1 100644 --- a/include/activdbg.idl +++ b/include/activdbg.idl @@ -22,6 +22,7 @@ import "activscp.idl"; interface IDebugDocumentContext; interface IRemoteDebugApplication; +interface IEnumDebugCodeContexts; /* FIXME: */ interface IEnumDebugStackFrames; @@ -79,6 +80,88 @@ typedef enum tagERRORRESUMEACTION { ERRORRESUMEACTION_SkipErrorStatement, } ERRORRESUMEACTION; +typedef WORD SOURCE_TEXT_ATTR; + +#ifdef INTEROPLIB +enum enum_SOURCE_TEXT_ATTR +{ + SOURCETEXT_ATTR_KEYWORD = 0x01, + SOURCETEXT_ATTR_COMMENT = 0x02, + SOURCETEXT_ATTR_NONSOURCE = 0x04, + SOURCETEXT_ATTR_OPERATOR = 0x08, + SOURCETEXT_ATTR_NUMBER = 0x10, + SOURCETEXT_ATTR_STRING = 0x20, + SOURCETEXT_ATTR_FUNCTION_START = 0x40 +}; +#endif + +const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_KEYWORD = 0x01; +const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_COMMENT = 0x02; +const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_NONSOURCE = 0x04; +const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_OPERATOR = 0x08; +const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_NUMBER = 0x10; +const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_STRING = 0x20; +const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_FUNCTION_START = 0x40; + +/************************************************************ + * interface IActiveScriptDebug32 + */ +[ + object, + uuid(51973c10-cb0c-11d0-b5c9-00a0244a0e7a), + pointer_default(unique) +] +interface IActiveScriptDebug32 : IUnknown +{ + HRESULT GetScriptTextAttributes( + [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode, + [in] ULONG uNumCodeChars, + [in] LPCOLESTR pstrDelimiter, + [in] DWORD dwFlags, + [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr); + + HRESULT GetScriptletTextAttributes( + [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode, + [in] ULONG uNumCodeChars, + [in] LPCOLESTR pstrDelimiter, + [in] DWORD dwFlags, + [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr); + + HRESULT EnumCodeContextsOfPosition( + [in] DWORD dwSourceContext, + [in] ULONG uCharacterOffset, + [in] ULONG uNumChars, + [out] IEnumDebugCodeContexts **ppescc); +} + +[ + object, + uuid(bc437e23-f5b8-47f4-bb79-7d1ce5483b86), + pointer_default(unique) +] +interface IActiveScriptDebug64 : IUnknown +{ + HRESULT GetScriptTextAttributes( + [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode, + [in] ULONG uNumCodeChars, + [in] LPCOLESTR pstrDelimiter, + [in] DWORD dwFlags, + [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr); + + HRESULT GetScriptletTextAttributes( + [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode, + [in] ULONG uNumCodeChars, + [in] LPCOLESTR pstrDelimiter, + [in] DWORD dwFlags, + [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr); + + HRESULT EnumCodeContextsOfPosition( + [in] DWORDLONG dwSourceContext, + [in] ULONG uCharacterOffset, + [in] ULONG uNumChars, + [out] IEnumDebugCodeContexts **ppescc); +} + /************************************************************ * interface IDebugDocumentInfo */ @@ -473,6 +556,9 @@ interface IActiveScriptSiteDebug64 : IUnknown cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS") cpp_quote("#ifdef _WIN64") +cpp_quote("#define IActiveScriptDebug IActiveScriptDebug64") +cpp_quote("#define IID_IActiveScriptDebug IID_IActiveScriptDebug64") + cpp_quote("#define IActiveScriptSiteDebug IActiveScriptSiteDebug64") cpp_quote("#define IID_IActiveScriptSiteDebug IID_IActiveScriptSiteDebug64") @@ -481,6 +567,9 @@ cpp_quote("#define IID_IDebugApplication IID_IDebugApplication64") cpp_quote("#else") +cpp_quote("#define IActiveScriptDebug IActiveScriptDebug32") +cpp_quote("#define IID_IActiveScriptDebug IID_IActiveScriptDebug32") + cpp_quote("#define IActiveScriptSiteDebug IActiveScriptSiteDebug32") cpp_quote("#define IID_IActiveScriptSiteDebug IID_IActiveScriptSiteDebug32")
1
0
0
0
Eric Pouech : winedbg: Fix backend prototypes for PowerPC and Alpha.
by Alexandre Julliard
02 Sep '09
02 Sep '09
Module: wine Branch: master Commit: 31cf71c244250253da56a58cc21fc8d58295859d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=31cf71c244250253da56a58cc…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Sep 1 22:23:43 2009 +0200 winedbg: Fix backend prototypes for PowerPC and Alpha. --- programs/winedbg/be_alpha.c | 8 ++++---- programs/winedbg/be_ppc.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/programs/winedbg/be_alpha.c b/programs/winedbg/be_alpha.c index aeeb79a..8ced1d6 100644 --- a/programs/winedbg/be_alpha.c +++ b/programs/winedbg/be_alpha.c @@ -60,25 +60,25 @@ static const struct dbg_internal_var* be_alpha_init_registers(CONTEXT* ctx) return be_alpha_ctx; } -static unsigned be_alpha_is_step_over_insn(void* insn) +static unsigned be_alpha_is_step_over_insn(const void* insn) { dbg_printf("not done\n"); return FALSE; } -static unsigned be_alpha_is_function_return(void* insn) +static unsigned be_alpha_is_function_return(const void* insn) { dbg_printf("not done\n"); return FALSE; } -static unsigned be_alpha_is_break_insn(void* insn) +static unsigned be_alpha_is_break_insn(const void* insn) { dbg_printf("not done\n"); return FALSE; } -static unsigned be_alpha_is_func_call(void* insn, void** insn_callee) +static unsigned be_alpha_is_func_call(const void* insn, ADDRESS64* callee) { return FALSE; } diff --git a/programs/winedbg/be_ppc.c b/programs/winedbg/be_ppc.c index 2e8826e..bff1571 100644 --- a/programs/winedbg/be_ppc.c +++ b/programs/winedbg/be_ppc.c @@ -73,25 +73,25 @@ static const struct dbg_internal_var* be_ppc_init_registers(CONTEXT* ctx) return be_ppc_ctx; } -static unsigned be_ppc_is_step_over_insn(void* insn) +static unsigned be_ppc_is_step_over_insn(const void* insn) { dbg_printf("not done\n"); return FALSE; } -static unsigned be_ppc_is_function_return(void* insn) +static unsigned be_ppc_is_function_return(const void* insn) { dbg_printf("not done\n"); return FALSE; } -static unsigned be_ppc_is_break_insn(void* insn) +static unsigned be_ppc_is_break_insn(const void* insn) { dbg_printf("not done\n"); return FALSE; } -static unsigned be_ppc_is_func_call(void* insn, void** insn_callee) +static unsigned be_ppc_is_func_call(const void* insn, ADDRESS64* callee) { return FALSE; }
1
0
0
0
Juan Lang : ws2_32: Add a fixme for IPPROTO_IPV6.
by Alexandre Julliard
02 Sep '09
02 Sep '09
Module: wine Branch: master Commit: 8e42dbf7a5c8d53cbb583b45c90465c93c43433f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8e42dbf7a5c8d53cbb583b45c…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Sep 1 10:37:51 2009 -0700 ws2_32: Add a fixme for IPPROTO_IPV6. --- dlls/ws2_32/socket.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 0f6e254..ab88925 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2125,6 +2125,10 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, FIXME("Unknown IPPROTO_IP optname 0x%08x\n", optname); return SOCKET_ERROR; + case WS_IPPROTO_IPV6: + FIXME("IPPROTO_IPV6 unimplemented (optname 0x%08x)\n", optname); + return SOCKET_ERROR; + default: WARN("Unknown level: 0x%08x\n", level); SetLastError(WSAEINVAL);
1
0
0
0
Juan Lang : include: Define IPPROTO_IPV6.
by Alexandre Julliard
02 Sep '09
02 Sep '09
Module: wine Branch: master Commit: 93f74ea98c0352c453644926cd7824cb4cda12e5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=93f74ea98c0352c453644926c…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Sep 1 09:17:33 2009 -0700 include: Define IPPROTO_IPV6. --- include/winsock.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/include/winsock.h b/include/winsock.h index 6870197..69819d5 100644 --- a/include/winsock.h +++ b/include/winsock.h @@ -266,6 +266,7 @@ extern "C" { #define IPPROTO_TCP 6 #define IPPROTO_UDP 17 #define IPPROTO_IDP 22 +#define IPPROTO_IPV6 41 #define IPPROTO_ND 77 #define IPPROTO_RAW 255 #define IPPROTO_MAX 256 @@ -277,6 +278,7 @@ extern "C" { #define WS_IPPROTO_TCP 6 #define WS_IPPROTO_UDP 17 #define WS_IPPROTO_IDP 22 +#define WS_IPPROTO_IPV6 41 #define WS_IPPROTO_ND 77 #define WS_IPPROTO_RAW 255 #define WS_IPPROTO_MAX 256
1
0
0
0
Aric Stewart : msctf/tests: Test ITfThreadMgr::AssociateFocus.
by Alexandre Julliard
02 Sep '09
02 Sep '09
Module: wine Branch: master Commit: 6245ef837b71e4a69a8c47db7eec9e3eb1054879 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6245ef837b71e4a69a8c47db7…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Tue Sep 1 07:08:11 2009 -0500 msctf/tests: Test ITfThreadMgr::AssociateFocus. --- dlls/msctf/tests/inputprocessor.c | 141 ++++++++++++++++++++++++++++++++++++- 1 files changed, 139 insertions(+), 2 deletions(-) diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c index 6e8bbdc..1770cac 100644 --- a/dlls/msctf/tests/inputprocessor.c +++ b/dlls/msctf/tests/inputprocessor.c @@ -43,6 +43,7 @@ static ITextStoreACPSink *ACPSink; #define SINK_UNEXPECTED 0 #define SINK_EXPECTED 1 #define SINK_FIRED 2 +#define SINK_IGNORE 3 static BOOL test_ShouldActivate = FALSE; static BOOL test_ShouldDeactivate = FALSE; @@ -150,8 +151,11 @@ static HRESULT WINAPI TextStoreACP_RequestLock(ITextStoreACP *iface, static HRESULT WINAPI TextStoreACP_GetStatus(ITextStoreACP *iface, TS_STATUS *pdcs) { - ok(test_ACP_GetStatus == SINK_EXPECTED, "Unexpected TextStoreACP_GetStatus\n"); - test_ACP_GetStatus = SINK_FIRED; + ok(test_ACP_GetStatus == SINK_EXPECTED || test_ACP_GetStatus == SINK_IGNORE, "Unexpected TextStoreACP_GetStatus\n"); + if (test_ACP_GetStatus == SINK_EXPECTED) + test_ACP_GetStatus = SINK_FIRED; + else if (test_ACP_GetStatus == SINK_IGNORE) + trace("Ignoring fired TextStoreACP_GetStatus\n"); pdcs->dwDynamicFlags = documentStatus; return S_OK; } @@ -1855,6 +1859,138 @@ static void test_Compartments(void) ITfDocumentMgr_Release(dm); } +static void processPendingMessages(void) +{ + MSG msg; + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } +} + +static void test_AssociateFocus(void) +{ + ITfDocumentMgr *dm1, *dm2, *olddm, *dmcheck, *dmorig; + HWND wnd1, wnd2, wnd3; + HRESULT hr; + + ITfThreadMgr_GetFocus(g_tm, &dmorig); + test_CurrentFocus = NULL; + test_PrevFocus = dmorig; + test_OnSetFocus = SINK_EXPECTED; + hr = ITfThreadMgr_SetFocus(g_tm,NULL); + ok(test_OnSetFocus == SINK_FIRED,"OnSetFocus not fired as expected\n"); + ITfDocumentMgr_Release(dmorig); + + hr = ITfThreadMgr_CreateDocumentMgr(g_tm,&dm1); + ok(SUCCEEDED(hr),"CreateDocumentMgr failed\n"); + + hr = ITfThreadMgr_CreateDocumentMgr(g_tm,&dm2); + ok(SUCCEEDED(hr),"CreateDocumentMgr failed\n"); + + wnd1 = CreateWindow("edit",NULL,WS_POPUP|WS_VISIBLE,0,0,200,60,NULL,NULL,NULL,NULL); + ok(wnd1!=NULL,"Unable to create window 1\n"); + wnd2 = CreateWindow("edit",NULL,WS_POPUP|WS_VISIBLE,0,0,200,60,NULL,NULL,NULL,NULL); + ok(wnd2!=NULL,"Unable to create window 2\n"); + wnd3 = CreateWindow("edit",NULL,WS_POPUP|WS_VISIBLE,0,0,200,60,NULL,NULL,NULL,NULL); + ok(wnd3!=NULL,"Unable to create window 3\n"); + + processPendingMessages(); + + SetFocus(wnd1); + processPendingMessages(); + test_CurrentFocus = dm1; + test_PrevFocus = NULL; + test_OnSetFocus = SINK_EXPECTED; + hr = ITfThreadMgr_AssociateFocus(g_tm,wnd1,dm1,&olddm); + ok(SUCCEEDED(hr),"AssociateFocus failed\n"); + ok(test_OnSetFocus == SINK_FIRED,"OnSetFocus not fired as expected\n"); + ok(olddm == NULL, "unexpected old DocumentMgr\n"); + + processPendingMessages(); + + ITfThreadMgr_GetFocus(g_tm, &dmcheck); + ok(dmcheck == dm1, "Expected DocumentMgr not focused\n"); + ITfDocumentMgr_Release(dmcheck); + + hr = ITfThreadMgr_AssociateFocus(g_tm,wnd2,dm2,&olddm); + ok(SUCCEEDED(hr),"AssociateFocus failed\n"); + processPendingMessages(); + ITfThreadMgr_GetFocus(g_tm, &dmcheck); + ok(dmcheck == dm1, "Expected DocumentMgr not focused\n"); + ITfDocumentMgr_Release(dmcheck); + + hr = ITfThreadMgr_AssociateFocus(g_tm,wnd3,dm2,&olddm); + ok(SUCCEEDED(hr),"AssociateFocus failed\n"); + processPendingMessages(); + ITfThreadMgr_GetFocus(g_tm, &dmcheck); + ok(dmcheck == dm1, "Expected DocumentMgr not focused\n"); + ITfDocumentMgr_Release(dmcheck); + + test_CurrentFocus = dm2; + test_PrevFocus = dm1; + test_OnSetFocus = SINK_EXPECTED; + SetFocus(wnd2); + processPendingMessages(); + ok(test_OnSetFocus == SINK_FIRED,"OnSetFocus not fired as expected\n"); + + SetFocus(wnd3); + processPendingMessages(); + + test_CurrentFocus = dm1; + test_PrevFocus = dm2; + test_OnSetFocus = SINK_EXPECTED; + SetFocus(wnd1); + processPendingMessages(); + ok(test_OnSetFocus == SINK_FIRED,"OnSetFocus not fired as expected\n"); + + hr = ITfThreadMgr_AssociateFocus(g_tm,wnd3,NULL,&olddm); + ok(SUCCEEDED(hr),"AssociateFocus failed\n"); + ok(olddm == dm2, "incorrect old DocumentMgr returned\n"); + ITfDocumentMgr_Release(olddm); + + test_CurrentFocus = dmorig; + test_PrevFocus = dm1; + test_OnSetFocus = SINK_EXPECTED; + test_ACP_GetStatus = SINK_EXPECTED; + ITfThreadMgr_SetFocus(g_tm,dmorig); + ok(test_OnSetFocus == SINK_FIRED,"OnSetFocus not fired as expected\n"); + + test_CurrentFocus = NULL; + test_PrevFocus = dmorig; + test_OnSetFocus = SINK_EXPECTED; + SetFocus(wnd3); + processPendingMessages(); + ok(test_OnSetFocus == SINK_FIRED,"OnSetFocus not fired as expected\n"); + + hr = ITfThreadMgr_AssociateFocus(g_tm,wnd2,NULL,&olddm); + ok(SUCCEEDED(hr),"AssociateFocus failed\n"); + ok(olddm == dm2, "incorrect old DocumentMgr returned\n"); + ITfDocumentMgr_Release(olddm); + hr = ITfThreadMgr_AssociateFocus(g_tm,wnd1,NULL,&olddm); + ok(SUCCEEDED(hr),"AssociateFocus failed\n"); + ok(olddm == dm1, "incorrect old DocumentMgr returned\n"); + ITfDocumentMgr_Release(olddm); + + SetFocus(wnd2); + processPendingMessages(); + SetFocus(wnd1); + processPendingMessages(); + + ITfDocumentMgr_Release(dm1); + ITfDocumentMgr_Release(dm2); + DestroyWindow(wnd1); + DestroyWindow(wnd2); + DestroyWindow(wnd3); + + test_CurrentFocus = dmorig; + test_PrevFocus = NULL; + test_OnSetFocus = SINK_EXPECTED; + test_ACP_GetStatus = SINK_IGNORE; + ITfThreadMgr_SetFocus(g_tm,dmorig); + ok(test_OnSetFocus == SINK_FIRED,"OnSetFocus not fired as expected\n"); +} + START_TEST(inputprocessor) { if (SUCCEEDED(initialize())) @@ -1871,6 +2007,7 @@ START_TEST(inputprocessor) test_KeystrokeMgr(); test_TStoApplicationText(); test_Compartments(); + test_AssociateFocus(); test_endSession(); test_EnumLanguageProfiles(); test_FindClosestCategory();
1
0
0
0
Aric Stewart : msctf: Implement ITfThreadMgr::AssociateFocus.
by Alexandre Julliard
02 Sep '09
02 Sep '09
Module: wine Branch: master Commit: 81118f7f06a40f71ccb263808a1ed47ad63883b9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=81118f7f06a40f71ccb263808…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Tue Sep 1 07:07:57 2009 -0500 msctf: Implement ITfThreadMgr::AssociateFocus. --- dlls/msctf/threadmgr.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 111 insertions(+), 2 deletions(-) diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c index 4b21b56..0661fec 100644 --- a/dlls/msctf/threadmgr.c +++ b/dlls/msctf/threadmgr.c @@ -71,6 +71,13 @@ typedef struct tagDocumentMgrs ITfDocumentMgr *docmgr; } DocumentMgrEntry; +typedef struct tagAssociatedWindow +{ + struct list entry; + HWND hwnd; + ITfDocumentMgr *docmgr; +} AssociatedWindow; + typedef struct tagACLMulti { const ITfThreadMgrVtbl *ThreadMgrVtbl; const ITfSourceVtbl *SourceVtbl; @@ -98,6 +105,9 @@ typedef struct tagACLMulti { struct list CurrentPreservedKeys; struct list CreatedDocumentMgrs; + struct list AssociatedFocusWindows; + HHOOK focusHook; + /* kept as separate lists to reduce unnecessary iterations */ struct list ActiveLanguageProfileNotifySink; struct list DisplayAttributeNotifySink; @@ -116,6 +126,7 @@ typedef struct tagEnumTfDocumentMgr { } EnumTfDocumentMgr; static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentMgrs **ppOut); +LRESULT CALLBACK ThreadFocusHookProc(int nCode, WPARAM wParam, LPARAM lParam); static inline ThreadMgr *impl_from_ITfSourceVtbl(ITfSource *iface) { @@ -142,6 +153,22 @@ static inline ThreadMgr *impl_from_ITfThreadMgrEventSink(ITfThreadMgrEventSink * return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ThreadMgrEventSinkVtbl)); } +static HRESULT SetupWindowsHook(ThreadMgr *This) +{ + if (!This->focusHook) + { + This->focusHook = SetWindowsHookExW(WH_CBT, ThreadFocusHookProc, 0, + GetCurrentThreadId()); + if (!This->focusHook) + { + ERR("Unable to set focus hook\n"); + return E_FAIL; + } + return S_OK; + } + return S_FALSE; +} + static void free_sink(ThreadMgrSink *sink) { IUnknown_Release(sink->interfaces.pIUnknown); @@ -152,6 +179,10 @@ static void ThreadMgr_Destructor(ThreadMgr *This) { struct list *cursor, *cursor2; + /* unhook right away */ + if (This->focusHook) + UnhookWindowsHookEx(This->focusHook); + TlsSetValue(tlsIndex,NULL); TRACE("destroying %p\n", This); if (This->focus) @@ -211,6 +242,13 @@ static void ThreadMgr_Destructor(ThreadMgr *This) HeapFree(GetProcessHeap(),0,mgr); } + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->AssociatedFocusWindows) + { + AssociatedWindow *wnd = LIST_ENTRY(cursor,AssociatedWindow,entry); + list_remove(cursor); + HeapFree(GetProcessHeap(),0,wnd); + } + CompartmentMgr_Destructor(This->CompartmentMgr); HeapFree(GetProcessHeap(),0,This); @@ -406,9 +444,43 @@ static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *p static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd, ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev) { + struct list *cursor, *cursor2; ThreadMgr *This = (ThreadMgr *)iface; - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + AssociatedWindow *wnd; + + TRACE("(%p) %p %p %p\n",This,hwnd,pdimNew,ppdimPrev); + + if (!ppdimPrev) + return E_INVALIDARG; + + *ppdimPrev = NULL; + + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->AssociatedFocusWindows) + { + wnd = LIST_ENTRY(cursor,AssociatedWindow,entry); + if (wnd->hwnd == hwnd) + { + if (wnd->docmgr) + ITfDocumentMgr_AddRef(wnd->docmgr); + *ppdimPrev = wnd->docmgr; + wnd->docmgr = pdimNew; + if (GetFocus() == hwnd) + ThreadMgr_SetFocus(iface,pdimNew); + return S_OK; + } + } + + wnd = HeapAlloc(GetProcessHeap(),0,sizeof(AssociatedWindow)); + wnd->hwnd = hwnd; + wnd->docmgr = pdimNew; + list_add_head(&This->AssociatedFocusWindows,&wnd->entry); + + if (GetFocus() == hwnd) + ThreadMgr_SetFocus(iface,pdimNew); + + SetupWindowsHook(This); + + return S_OK; } static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThreadFocus) @@ -1132,6 +1204,7 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) list_init(&This->CurrentPreservedKeys); list_init(&This->CreatedDocumentMgrs); + list_init(&This->AssociatedFocusWindows); list_init(&This->ActiveLanguageProfileNotifySink); list_init(&This->DisplayAttributeNotifySink); @@ -1305,3 +1378,39 @@ void ThreadMgr_OnDocumentMgrDestruction(ITfThreadMgr *tm, ITfDocumentMgr *mgr) } FIXME("ITfDocumenMgr %p not found in this thread\n",mgr); } + +LRESULT CALLBACK ThreadFocusHookProc(int nCode, WPARAM wParam, LPARAM lParam) +{ + ThreadMgr *This; + + This = TlsGetValue(tlsIndex); + if (!This) + { + ERR("Hook proc but no ThreadMgr for this thread. Serious Error\n"); + return 0; + } + if (!This->focusHook) + { + ERR("Hook proc but no ThreadMgr focus Hook. Serious Error\n"); + return 0; + } + + if (nCode == HCBT_SETFOCUS) /* focus change within our thread */ + { + struct list *cursor; + + LIST_FOR_EACH(cursor, &This->AssociatedFocusWindows) + { + AssociatedWindow *wnd = LIST_ENTRY(cursor,AssociatedWindow,entry); + if (wnd->hwnd == (HWND)wParam) + { + TRACE("Triggering Associated window focus\n"); + if (This->focus != wnd->docmgr) + ThreadMgr_SetFocus((ITfThreadMgr*)This, wnd->docmgr); + break; + } + } + } + + return CallNextHookEx(This->focusHook, nCode, wParam, lParam); +}
1
0
0
0
Ge van Geldorp : kernel32/tests: Fix locale tests on Vista and higher.
by Alexandre Julliard
02 Sep '09
02 Sep '09
Module: wine Branch: master Commit: 277585fd11504bf25255052ab54862e594c97c70 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=277585fd11504bf25255052ab…
Author: Ge van Geldorp <ggeldorp(a)vmware.com> Date: Tue Sep 1 12:19:35 2009 +0200 kernel32/tests: Fix locale tests on Vista and higher. --- dlls/kernel32/tests/locale.c | 335 +++++++++++++++--------------------------- 1 files changed, 119 insertions(+), 216 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=277585fd11504bf252550…
1
0
0
0
← Newer
1
...
80
81
82
83
84
85
86
87
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Results per page:
10
25
50
100
200