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
March 2011
----- 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
849 discussions
Start a n
N
ew thread
Juan Lang : wininet: Store entries in url cache with valid expiration date.
by Alexandre Julliard
04 Mar '11
04 Mar '11
Module: wine Branch: master Commit: 0b5ea6f970bdaaeab5a2b177d9d681aa22e42094 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0b5ea6f970bdaaeab5a2b177d…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Mar 3 11:20:11 2011 -0800 wininet: Store entries in url cache with valid expiration date. --- dlls/wininet/http.c | 197 ++++++++++++++++++++++++++++++++++++++++++++++- dlls/wininet/internet.h | 1 + 2 files changed, 197 insertions(+), 1 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 0467860..85484bf 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -1577,7 +1577,7 @@ static void HTTPREQ_Destroy(object_header_t *hdr) memset(&ft, 0, sizeof(FILETIME)); if(HTTP_GetRequestURL(request, url)) { - CommitUrlCacheEntryW(url, request->cacheFile, ft, ft, + CommitUrlCacheEntryW(url, request->cacheFile, request->expires, ft, NORMAL_CACHE_ENTRY, NULL, 0, NULL, 0); } } @@ -3577,6 +3577,199 @@ static void HTTP_InsertCookies(http_request_t *request) HeapFree(GetProcessHeap(), 0, lpszUrl); } +static WORD HTTP_ParseDay(LPCWSTR day) +{ + static const WCHAR sun[] = { 's','u','n',0 }; + static const WCHAR mon[] = { 'm','o','n',0 }; + static const WCHAR tue[] = { 't','u','e',0 }; + static const WCHAR wed[] = { 'w','e','d',0 }; + static const WCHAR thu[] = { 't','h','u',0 }; + static const WCHAR fri[] = { 'f','r','i',0 }; + static const WCHAR sat[] = { 's','a','t',0 }; + + if (!strcmpiW(day, sun)) return 0; + if (!strcmpiW(day, mon)) return 1; + if (!strcmpiW(day, tue)) return 2; + if (!strcmpiW(day, wed)) return 3; + if (!strcmpiW(day, thu)) return 4; + if (!strcmpiW(day, fri)) return 5; + if (!strcmpiW(day, sat)) return 6; + /* Invalid */ + return 7; +} + +static WORD HTTP_ParseMonth(LPCWSTR month) +{ + static const WCHAR jan[] = { 'j','a','n',0 }; + static const WCHAR feb[] = { 'f','e','b',0 }; + static const WCHAR mar[] = { 'm','a','r',0 }; + static const WCHAR apr[] = { 'a','p','r',0 }; + static const WCHAR may[] = { 'm','a','y',0 }; + static const WCHAR jun[] = { 'j','u','n',0 }; + static const WCHAR jul[] = { 'j','u','l',0 }; + static const WCHAR aug[] = { 'a','u','g',0 }; + static const WCHAR sep[] = { 's','e','p',0 }; + static const WCHAR oct[] = { 'o','c','t',0 }; + static const WCHAR nov[] = { 'n','o','v',0 }; + static const WCHAR dec[] = { 'd','e','c',0 }; + + if (!strcmpiW(month, jan)) return 1; + if (!strcmpiW(month, feb)) return 2; + if (!strcmpiW(month, mar)) return 3; + if (!strcmpiW(month, apr)) return 4; + if (!strcmpiW(month, may)) return 5; + if (!strcmpiW(month, jun)) return 6; + if (!strcmpiW(month, jul)) return 7; + if (!strcmpiW(month, aug)) return 8; + if (!strcmpiW(month, sep)) return 9; + if (!strcmpiW(month, oct)) return 10; + if (!strcmpiW(month, nov)) return 11; + if (!strcmpiW(month, dec)) return 12; + /* Invalid */ + return 0; +} + +/* FIXME: only accepts dates in RFC 1123 format, which is the only correct + * format for HTTP, but which may not be the only format actually seen in the + * wild.
http://www.hackcraft.net/web/datetime/
suggests at least RFC 850 + * dates and dates as formatted by asctime() should be accepted as well. + */ +static BOOL HTTP_ParseDate(LPCWSTR value, FILETIME *ft) +{ + static const WCHAR gmt[]= { 'G','M','T',0 }; + WCHAR *ptr, *nextPtr, day[4], month[4], *monthPtr; + unsigned long num; + SYSTEMTIME st; + + ptr = strchrW(value, ','); + if (!ptr) + { + ERR("unexpected date format %s\n", debugstr_w(value)); + return FALSE; + } + if (ptr - value != 3) + { + ERR("unexpected weekday %s\n", debugstr_wn(value, ptr - value)); + return FALSE; + } + memcpy(day, value, (ptr - value) * sizeof(WCHAR)); + day[3] = 0; + st.wDayOfWeek = HTTP_ParseDay(day); + if (st.wDayOfWeek > 6) + { + ERR("unexpected weekday %s\n", debugstr_wn(value, ptr - value)); + return FALSE; + } + ptr++; + + while (isspaceW(*ptr)) + ptr++; + + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr || !num || num > 31) + { + ERR("unexpected day %s\n", debugstr_w(value)); + return FALSE; + } + ptr = nextPtr; + st.wDay = (WORD)num; + + while (isspaceW(*ptr)) + ptr++; + + for (monthPtr = month; !isspace(*ptr) && + monthPtr - month < sizeof(month) / sizeof(month[0]) - 1; + monthPtr++, ptr++) + *monthPtr = *ptr; + *monthPtr = 0; + st.wMonth = HTTP_ParseMonth(month); + if (!st.wMonth || st.wMonth > 12) + { + ERR("unexpected month %s\n", debugstr_w(month)); + return FALSE; + } + + while (isspaceW(*ptr)) + ptr++; + + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr || num < 1601 || num > 30827) + { + ERR("unexpected year %s\n", debugstr_w(value)); + return FALSE; + } + ptr = nextPtr; + st.wYear = (WORD)num; + + while (isspaceW(*ptr)) + ptr++; + + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr || *nextPtr != ':') + { + ERR("unexpected time format %s\n", debugstr_w(ptr)); + return FALSE; + } + if (num > 23) + { + ERR("unexpected hour in time format %s\n", debugstr_w(ptr)); + return FALSE; + } + ptr = nextPtr + 1; + st.wHour = (WORD)num; + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr || *nextPtr != ':') + { + ERR("unexpected time format %s\n", debugstr_w(ptr)); + return FALSE; + } + if (num > 59) + { + ERR("unexpected minute in time format %s\n", debugstr_w(ptr)); + return FALSE; + } + ptr = nextPtr + 1; + st.wMinute = (WORD)num; + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr) + { + ERR("unexpected time format %s\n", debugstr_w(ptr)); + return FALSE; + } + if (num > 59) + { + ERR("unexpected second in time format %s\n", debugstr_w(ptr)); + return FALSE; + } + ptr = nextPtr + 1; + st.wSecond = (WORD)num; + + while (isspaceW(*ptr)) + ptr++; + + if (strcmpW(ptr, gmt)) + { + ERR("unexpected time zone %s\n", debugstr_w(ptr)); + return FALSE; + } + return SystemTimeToFileTime(&st, ft); +} + +static void HTTP_ProcessExpires(http_request_t *request) +{ + int headerIndex; + + headerIndex = HTTP_GetCustomHeaderIndex(request, szExpires, 0, FALSE); + if (headerIndex != -1) + { + LPHTTPHEADERW expiresHeader = &request->custHeaders[headerIndex]; + FILETIME ft; + + if (HTTP_ParseDate(expiresHeader->lpszValue, &ft)) + request->expires = ft; + } +} + /*********************************************************************** * HTTP_HttpSendRequestW (internal) * @@ -3755,6 +3948,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, sizeof(DWORD)); HTTP_ProcessCookies(request); + HTTP_ProcessExpires(request); if (!set_content_length( request )) HTTP_FinishedReading(request); @@ -3942,6 +4136,7 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_ /* process cookies here. Is this right? */ HTTP_ProcessCookies(request); + HTTP_ProcessExpires(request); if (!set_content_length( request )) HTTP_FinishedReading(request); diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 1d89045..40fa696 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -276,6 +276,7 @@ typedef struct DWORD nCustHeaders; HANDLE hCacheFile; LPWSTR cacheFile; + FILETIME expires; struct HttpAuthInfo *authInfo; struct HttpAuthInfo *proxyAuthInfo;
1
0
0
0
Alexandre Julliard : user32: Remove GetClipboardFormatName from the user driver interface.
by Alexandre Julliard
04 Mar '11
04 Mar '11
Module: wine Branch: master Commit: 383d8ac105df9dfdafa4e1176ea928bdc17259f1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=383d8ac105df9dfdafa4e1176…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 3 21:51:29 2011 +0100 user32: Remove GetClipboardFormatName from the user driver interface. --- dlls/user32/clipboard.c | 15 ++++----------- dlls/user32/driver.c | 13 ------------- dlls/user32/tests/clipboard.c | 12 ++---------- dlls/user32/user_private.h | 1 - dlls/winex11.drv/clipboard.c | 26 +++++--------------------- dlls/winex11.drv/winex11.drv.spec | 1 - 6 files changed, 11 insertions(+), 57 deletions(-) diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c index 7b84686..875a027 100644 --- a/dlls/user32/clipboard.c +++ b/dlls/user32/clipboard.c @@ -243,7 +243,8 @@ UINT WINAPI RegisterClipboardFormatA(LPCSTR formatName) */ INT WINAPI GetClipboardFormatNameW(UINT wFormat, LPWSTR retStr, INT maxlen) { - return USER_Driver->pGetClipboardFormatName(wFormat, retStr, maxlen); + if (wFormat < MAXINTATOM) return 0; + return GlobalGetAtomNameW( wFormat, retStr, maxlen ); } @@ -252,16 +253,8 @@ INT WINAPI GetClipboardFormatNameW(UINT wFormat, LPWSTR retStr, INT maxlen) */ INT WINAPI GetClipboardFormatNameA(UINT wFormat, LPSTR retStr, INT maxlen) { - INT ret; - LPWSTR p = HeapAlloc( GetProcessHeap(), 0, maxlen*sizeof(WCHAR) ); - if(p == NULL) return 0; /* FIXME: is this the correct failure value? */ - - ret = GetClipboardFormatNameW( wFormat, p, maxlen ); - - if (ret && maxlen > 0 && !WideCharToMultiByte( CP_ACP, 0, p, -1, retStr, maxlen, 0, 0)) - retStr[maxlen-1] = 0; - HeapFree( GetProcessHeap(), 0, p ); - return ret; + if (wFormat < MAXINTATOM) return 0; + return GlobalGetAtomNameA( wFormat, retStr, maxlen ); } diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index 8f64219..d40789c 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -99,7 +99,6 @@ static const USER_DRIVER *load_driver(void) GET_USER_FUNC(EnumClipboardFormats); GET_USER_FUNC(IsClipboardFormatAvailable); GET_USER_FUNC(RegisterClipboardFormat); - GET_USER_FUNC(GetClipboardFormatName); GET_USER_FUNC(EndClipboardUpdate); GET_USER_FUNC(ChangeDisplaySettingsEx); GET_USER_FUNC(EnumDisplayMonitors); @@ -275,11 +274,6 @@ static HANDLE CDECL nulldrv_GetClipboardData( UINT format ) return 0; } -static INT CDECL nulldrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len ) -{ - return FALSE; -} - static BOOL CDECL nulldrv_IsClipboardFormatAvailable( UINT format ) { return FALSE; @@ -462,7 +456,6 @@ static USER_DRIVER null_driver = nulldrv_EndClipboardUpdate, nulldrv_EnumClipboardFormats, nulldrv_GetClipboardData, - nulldrv_GetClipboardFormatName, nulldrv_IsClipboardFormatAvailable, nulldrv_RegisterClipboardFormat, nulldrv_SetClipboardData, @@ -628,11 +621,6 @@ static HANDLE CDECL loaderdrv_GetClipboardData( UINT format ) return load_driver()->pGetClipboardData( format ); } -static INT CDECL loaderdrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len ) -{ - return load_driver()->pGetClipboardFormatName( format, buffer, len ); -} - static BOOL CDECL loaderdrv_IsClipboardFormatAvailable( UINT format ) { return load_driver()->pIsClipboardFormatAvailable( format ); @@ -809,7 +797,6 @@ static USER_DRIVER lazy_load_driver = loaderdrv_EndClipboardUpdate, loaderdrv_EnumClipboardFormats, loaderdrv_GetClipboardData, - loaderdrv_GetClipboardFormatName, loaderdrv_IsClipboardFormatAvailable, loaderdrv_RegisterClipboardFormat, loaderdrv_SetClipboardData, diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index 781334e..c461df4 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -140,6 +140,7 @@ todo_wine atom_id = GlobalFindAtomA("my_cool_clipboard_format"); ok(atom_id == 0, "GlobalFindAtomA should fail\n"); test_last_error(ERROR_FILE_NOT_FOUND); + } for (format_id = 0; format_id < 0xffff; format_id++) { @@ -147,18 +148,9 @@ todo_wine len = GetClipboardFormatNameA(format_id, buf, 256); if (format_id < 0xc000) - { ok(!len, "GetClipboardFormatNameA should fail, but it returned %d (%s)\n", len, buf); - test_last_error(ERROR_INVALID_PARAMETER); - } else - { - if (len) - trace("%04x: %s\n", format_id, len ? buf : ""); - else - test_last_error(ERROR_INVALID_HANDLE); - } - } + if (len) trace("%04x: %s\n", format_id, len ? buf : ""); } ret = OpenClipboard(0); diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 51636de..f7b79b3 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -81,7 +81,6 @@ typedef struct tagUSER_DRIVER { void (CDECL *pEndClipboardUpdate)(void); /* End clipboard update */ UINT (CDECL *pEnumClipboardFormats)(UINT); /* Enumerate clipboard formats */ HANDLE (CDECL *pGetClipboardData)(UINT); /* Get specified selection data */ - INT (CDECL *pGetClipboardFormatName)(UINT, LPWSTR, UINT); /* Get a clipboard format name */ BOOL (CDECL *pIsClipboardFormatAvailable)(UINT); /* Check if specified format is available */ UINT (CDECL *pRegisterClipboardFormat)(LPCWSTR); /* Register a clipboard format */ BOOL (CDECL *pSetClipboardData)(UINT, HANDLE, BOOL); /* Set specified selection data */ diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 8b9fe2d..1a3704d 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -283,12 +283,11 @@ static Window thread_selection_wnd(void) static const char *debugstr_format( UINT id ) { - if (id >= 0xc000) - { - WCHAR buffer[256]; - GlobalGetAtomNameW( id, buffer, 256 ); + WCHAR buffer[256]; + + if (GetClipboardFormatNameW( id, buffer, 256 )) return wine_dbg_sprintf( "%04x %s", id, debugstr_w(buffer) ); - } + switch (id) { #define BUILTIN(id) case id: return #id; @@ -378,7 +377,7 @@ static void intern_atoms(void) i = 0; LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry ) if (!format->drvData) { - GlobalGetAtomNameW( format->wFormatID, buffer, 256 ); + GetClipboardFormatNameW( format->wFormatID, buffer, 256 ); len = WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, NULL, 0, NULL, NULL); names[i] = HeapAlloc(GetProcessHeap(), 0, len); WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, names[i++], len, NULL, NULL); @@ -2501,21 +2500,6 @@ UINT CDECL X11DRV_RegisterClipboardFormat(LPCWSTR FormatName) } -/************************************************************************** - * X11DRV_GetClipboardFormatName - */ -INT CDECL X11DRV_GetClipboardFormatName(UINT wFormat, LPWSTR retStr, INT maxlen) -{ - TRACE("(%04X, %p, %d) !\n", wFormat, retStr, maxlen); - - if (wFormat < 0xc000) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - return GlobalGetAtomNameW( wFormat, retStr, maxlen ); -} - static void selection_acquire(void) { Window owner; diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 2298b99..cc5cf43 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -91,7 +91,6 @@ @ cdecl EndClipboardUpdate() X11DRV_EndClipboardUpdate @ cdecl EnumClipboardFormats(long) X11DRV_EnumClipboardFormats @ cdecl GetClipboardData(long) X11DRV_GetClipboardData -@ cdecl GetClipboardFormatName(long ptr long) X11DRV_GetClipboardFormatName @ cdecl GetDC(long long long ptr ptr long) X11DRV_GetDC @ cdecl IsClipboardFormatAvailable(long) X11DRV_IsClipboardFormatAvailable @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) X11DRV_MsgWaitForMultipleObjectsEx
1
0
0
0
Alexandre Julliard : winex11: Always reference clipboard formats by atom instead of name.
by Alexandre Julliard
04 Mar '11
04 Mar '11
Module: wine Branch: master Commit: 57921fec3ac4fa1e5b36bccc467b7219926f7b25 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=57921fec3ac4fa1e5b36bccc4…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 3 21:37:35 2011 +0100 winex11: Always reference clipboard formats by atom instead of name. --- dlls/winex11.drv/clipboard.c | 164 ++++++++++++------------------------------ 1 files changed, 46 insertions(+), 118 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=57921fec3ac4fa1e5b36b…
1
0
0
0
Alexandre Julliard : winex11: Pre-register atoms for all the built-in clipboard formats.
by Alexandre Julliard
04 Mar '11
04 Mar '11
Module: wine Branch: master Commit: f15e91a883b5a1d1a72f1388172b5b31a6986b02 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f15e91a883b5a1d1a72f13881…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 3 21:27:34 2011 +0100 winex11: Pre-register atoms for all the built-in clipboard formats. --- dlls/winex11.drv/clipboard.c | 46 ++++++++++++++++++++-------------------- dlls/winex11.drv/x11drv.h | 20 +++++++++++++++++ dlls/winex11.drv/x11drv_main.c | 20 +++++++++++++++++ 3 files changed, 63 insertions(+), 23 deletions(-) diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index c281bef..a1d4c6b 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -218,30 +218,30 @@ static const struct } builtin_formats[] = { { CF_TEXT, wszCF_TEXT, XA_STRING, X11DRV_CLIPBOARD_ImportXAString, X11DRV_CLIPBOARD_ExportString}, - { CF_BITMAP, wszCF_BITMAP, 0, X11DRV_CLIPBOARD_ImportClipboardData, NULL}, - { CF_METAFILEPICT, wszCF_METAFILEPICT, 0, X11DRV_CLIPBOARD_ImportMetaFilePict, X11DRV_CLIPBOARD_ExportMetaFilePict }, - { CF_SYLK, wszCF_SYLK, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_DIF, wszCF_DIF, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_TIFF, wszCF_TIFF, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_OEMTEXT, wszCF_OEMTEXT, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_BITMAP, wszCF_BITMAP, XATOM_WCF_BITMAP, X11DRV_CLIPBOARD_ImportClipboardData, NULL}, + { CF_METAFILEPICT, wszCF_METAFILEPICT, XATOM_WCF_METAFILEPICT, X11DRV_CLIPBOARD_ImportMetaFilePict, X11DRV_CLIPBOARD_ExportMetaFilePict }, + { CF_SYLK, wszCF_SYLK, XATOM_WCF_SYLK, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_DIF, wszCF_DIF, XATOM_WCF_DIF, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_TIFF, wszCF_TIFF, XATOM_WCF_TIFF, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_OEMTEXT, wszCF_OEMTEXT, XATOM_WCF_OEMTEXT, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, { CF_DIB, wszCF_DIB, XA_PIXMAP, X11DRV_CLIPBOARD_ImportXAPIXMAP, X11DRV_CLIPBOARD_ExportXAPIXMAP }, - { CF_PALETTE, wszCF_PALETTE, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_PENDATA, wszCF_PENDATA, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_RIFF, wszCF_RIFF, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_WAVE, wszCF_WAVE, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_UNICODETEXT, wszUTF8STRING, 0, X11DRV_CLIPBOARD_ImportUTF8, X11DRV_CLIPBOARD_ExportString }, + { CF_PALETTE, wszCF_PALETTE, XATOM_WCF_PALETTE, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_PENDATA, wszCF_PENDATA, XATOM_WCF_PENDATA, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_RIFF, wszCF_RIFF, XATOM_WCF_RIFF, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_WAVE, wszCF_WAVE, XATOM_WCF_WAVE, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_UNICODETEXT, wszUTF8STRING, XATOM_UTF8_STRING, X11DRV_CLIPBOARD_ImportUTF8, X11DRV_CLIPBOARD_ExportString }, /* If UTF8_STRING is not available, attempt COMPOUND_TEXT */ - { CF_UNICODETEXT, wszCOMPOUNDTEXT, 0, X11DRV_CLIPBOARD_ImportCompoundText, X11DRV_CLIPBOARD_ExportString }, - { CF_ENHMETAFILE, wszCF_ENHMETAFILE, 0, X11DRV_CLIPBOARD_ImportEnhMetaFile, X11DRV_CLIPBOARD_ExportEnhMetaFile }, - { CF_HDROP, wszCF_HDROP, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_LOCALE, wszCF_LOCALE, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_DIBV5, wszCF_DIBV5, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_OWNERDISPLAY, wszCF_OWNERDISPLAY, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_DSPTEXT, wszCF_DSPTEXT, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_DSPBITMAP, wszCF_DSPBITMAP, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_DSPMETAFILEPICT, wszCF_DSPMETAFILEPICT, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_DSPENHMETAFILE, wszCF_DSPENHMETAFILE, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, - { CF_DIB, wszIMAGEBMP, 0, X11DRV_CLIPBOARD_ImportImageBmp, X11DRV_CLIPBOARD_ExportImageBmp }, + { CF_UNICODETEXT, wszCOMPOUNDTEXT, XATOM_COMPOUND_TEXT, X11DRV_CLIPBOARD_ImportCompoundText, X11DRV_CLIPBOARD_ExportString }, + { CF_ENHMETAFILE, wszCF_ENHMETAFILE, XATOM_WCF_ENHMETAFILE, X11DRV_CLIPBOARD_ImportEnhMetaFile, X11DRV_CLIPBOARD_ExportEnhMetaFile }, + { CF_HDROP, wszCF_HDROP, XATOM_WCF_HDROP, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_LOCALE, wszCF_LOCALE, XATOM_WCF_LOCALE, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_DIBV5, wszCF_DIBV5, XATOM_WCF_DIBV5, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_OWNERDISPLAY, wszCF_OWNERDISPLAY, XATOM_WCF_OWNERDISPLAY, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_DSPTEXT, wszCF_DSPTEXT, XATOM_WCF_DSPTEXT, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_DSPBITMAP, wszCF_DSPBITMAP, XATOM_WCF_DSPBITMAP, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_DSPMETAFILEPICT, wszCF_DSPMETAFILEPICT, XATOM_WCF_DSPMETAFILEPICT, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_DSPENHMETAFILE, wszCF_DSPENHMETAFILE, XATOM_WCF_DSPENHMETAFILE, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, + { CF_DIB, wszIMAGEBMP, XATOM_image_bmp, X11DRV_CLIPBOARD_ImportImageBmp, X11DRV_CLIPBOARD_ExportImageBmp }, }; static struct list format_list = LIST_INIT( format_list ); @@ -362,7 +362,7 @@ void X11DRV_InitClipboard(void) if (!(format = HeapAlloc( GetProcessHeap(), 0, sizeof(*format )))) break; format->wFormatID = builtin_formats[i].id; format->Name = builtin_formats[i].name; - format->drvData = builtin_formats[i].data; + format->drvData = GET_ATOM(builtin_formats[i].data); format->wFlags = CF_FLAG_BUILTINFMT; format->lpDrvImportFunc = builtin_formats[i].import; format->lpDrvExportFunc = builtin_formats[i].export; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 92898ef..6f0c8db 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -677,7 +677,27 @@ enum x11drv_atoms XATOM_XdndTarget, XATOM_XdndTypeList, XATOM_HTML_Format, + XATOM_WCF_BITMAP, XATOM_WCF_DIB, + XATOM_WCF_DIBV5, + XATOM_WCF_DIF, + XATOM_WCF_DSPBITMAP, + XATOM_WCF_DSPENHMETAFILE, + XATOM_WCF_DSPMETAFILEPICT, + XATOM_WCF_DSPTEXT, + XATOM_WCF_ENHMETAFILE, + XATOM_WCF_HDROP, + XATOM_WCF_LOCALE, + XATOM_WCF_METAFILEPICT, + XATOM_WCF_OEMTEXT, + XATOM_WCF_OWNERDISPLAY, + XATOM_WCF_PALETTE, + XATOM_WCF_PENDATA, + XATOM_WCF_RIFF, + XATOM_WCF_SYLK, + XATOM_WCF_TIFF, + XATOM_WCF_WAVE, + XATOM_image_bmp, XATOM_image_gif, XATOM_image_jpeg, XATOM_image_png, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 54f56b9..606bc28 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -179,7 +179,27 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "XdndTarget", "XdndTypeList", "HTML Format", + "WCF_BITMAP", "WCF_DIB", + "WCF_DIBV5", + "WCF_DIF", + "WCF_DSPBITMAP", + "WCF_DSPENHMETAFILE", + "WCF_DSPMETAFILEPICT", + "WCF_DSPTEXT", + "WCF_ENHMETAFILE", + "WCF_HDROP", + "WCF_LOCALE", + "WCF_METAFILEPICT", + "WCF_OEMTEXT", + "WCF_OWNERDISPLAY", + "WCF_PALETTE", + "WCF_PENDATA", + "WCF_RIFF", + "WCF_SYLK", + "WCF_TIFF", + "WCF_WAVE", + "image/bmp", "image/gif", "image/jpeg", "image/png",
1
0
0
0
Alexandre Julliard : winex11: Add a debug helper for printing clipboard formats.
by Alexandre Julliard
04 Mar '11
04 Mar '11
Module: wine Branch: master Commit: ade3b4f148fc681be975c28290786638538b1219 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ade3b4f148fc681be975c2829…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 3 21:09:22 2011 +0100 winex11: Add a debug helper for printing clipboard formats. --- dlls/winex11.drv/clipboard.c | 57 +++++++++++++++++++++++++++++++++++------ 1 files changed, 48 insertions(+), 9 deletions(-) diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 30aee96..c281bef 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -310,6 +310,44 @@ static Window thread_selection_wnd(void) return w; } +static const char *debugstr_format( UINT id ) +{ + if (id >= 0xc000) + { + WCHAR buffer[256]; + GlobalGetAtomNameW( id, buffer, 256 ); + return wine_dbg_sprintf( "%04x %s", id, debugstr_w(buffer) ); + } + switch (id) + { +#define BUILTIN(id) case id: return #id; + BUILTIN(CF_TEXT) + BUILTIN(CF_BITMAP) + BUILTIN(CF_METAFILEPICT) + BUILTIN(CF_SYLK) + BUILTIN(CF_DIF) + BUILTIN(CF_TIFF) + BUILTIN(CF_OEMTEXT) + BUILTIN(CF_DIB) + BUILTIN(CF_PALETTE) + BUILTIN(CF_PENDATA) + BUILTIN(CF_RIFF) + BUILTIN(CF_WAVE) + BUILTIN(CF_UNICODETEXT) + BUILTIN(CF_ENHMETAFILE) + BUILTIN(CF_HDROP) + BUILTIN(CF_LOCALE) + BUILTIN(CF_DIBV5) + BUILTIN(CF_OWNERDISPLAY) + BUILTIN(CF_DSPTEXT) + BUILTIN(CF_DSPBITMAP) + BUILTIN(CF_DSPMETAFILEPICT) + BUILTIN(CF_DSPENHMETAFILE) +#undef BUILTIN + default: return wine_dbg_sprintf( "%04x", id ); + } +} + /************************************************************************** * X11DRV_InitClipboard */ @@ -498,8 +536,8 @@ static WINE_CLIPFORMAT *X11DRV_CLIPBOARD_InsertClipboardFormat(LPCWSTR FormatNam list_add_tail( &format_list, &lpNewFormat->entry ); - TRACE("Registering format(%04x): %s drvData %d\n", - lpNewFormat->wFormatID, debugstr_w(FormatName), lpNewFormat->drvData); + TRACE("Registering format %s drvData %d\n", + debugstr_format(lpNewFormat->wFormatID), lpNewFormat->drvData); return lpNewFormat; } @@ -1936,8 +1974,8 @@ static VOID X11DRV_CLIPBOARD_InsertSelectionProperties(Display *display, Atom* p */ while (lpFormat) { - TRACE("Atom#%d Property(%d): --> FormatID(%04x) %s\n", - i, lpFormat->drvData, lpFormat->wFormatID, debugstr_w(lpFormat->Name)); + TRACE("Atom#%d Property(%d): --> Format %s\n", + i, lpFormat->drvData, debugstr_format(lpFormat->wFormatID)); X11DRV_CLIPBOARD_InsertClipboardData(lpFormat->wFormatID, 0, 0, lpFormat, FALSE); lpFormat = X11DRV_CLIPBOARD_LookupProperty(lpFormat, properties[i]); } @@ -1979,8 +2017,8 @@ static VOID X11DRV_CLIPBOARD_InsertSelectionProperties(Display *display, Atom* p ERR("Failed to register %s property. Type will not be cached.\n", names[i]); continue; } - TRACE("Atom#%d Property(%d): --> FormatID(%04x) %s\n", - i, lpFormat->drvData, lpFormat->wFormatID, debugstr_w(lpFormat->Name)); + TRACE("Atom#%d Property(%d): --> Format %s\n", + i, lpFormat->drvData, debugstr_format(lpFormat->wFormatID)); X11DRV_CLIPBOARD_InsertClipboardData(lpFormat->wFormatID, 0, 0, lpFormat, FALSE); } wine_tsx11_lock(); @@ -2145,7 +2183,8 @@ static BOOL X11DRV_CLIPBOARD_ReadSelectionData(Display *display, LPWINE_CLIPDATA } TRACE("Requesting conversion of %s property (%d) from selection type %08x\n", - debugstr_w(lpData->lpFormat->Name), lpData->lpFormat->drvData, (UINT)selectionCacheSrc); + debugstr_format(lpData->lpFormat->wFormatID), lpData->lpFormat->drvData, + (UINT)selectionCacheSrc); wine_tsx11_lock(); XConvertSelection(display, selectionCacheSrc, lpData->lpFormat->drvData, @@ -3168,8 +3207,8 @@ static void X11DRV_HandleSelectionRequest( HWND hWnd, XSelectionRequestEvent *ev { int mode = PropModeReplace; - TRACE("\tUpdating property %s, %d bytes\n", debugstr_w(lpFormat->Name), cBytes); - + TRACE("\tUpdating property %s, %d bytes\n", + debugstr_format(lpFormat->wFormatID), cBytes); wine_tsx11_lock(); do {
1
0
0
0
Alexandre Julliard : winex11: Convert the clipboard format list to a standard Wine list.
by Alexandre Julliard
04 Mar '11
04 Mar '11
Module: wine Branch: master Commit: 7aa4acb80ab3c22f67b2c8073873c72ec0dd2c4f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7aa4acb80ab3c22f67b2c8073…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 3 20:52:13 2011 +0100 winex11: Convert the clipboard format list to a standard Wine list. --- dlls/winex11.drv/clipboard.c | 206 +++++++++++++++--------------------------- 1 files changed, 75 insertions(+), 131 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=7aa4acb80ab3c22f67b2c…
1
0
0
0
Alexandre Julliard : winex11: Convert the clipboard data list to a standard Wine list.
by Alexandre Julliard
04 Mar '11
04 Mar '11
Module: wine Branch: master Commit: bfa753ba55a95415febbf4b03ccec99321cc3ff4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bfa753ba55a95415febbf4b03…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 3 20:25:01 2011 +0100 winex11: Convert the clipboard data list to a standard Wine list. --- dlls/winex11.drv/clipboard.c | 103 ++++++++++-------------------------------- 1 files changed, 24 insertions(+), 79 deletions(-) diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 3610af7..37d1f3f 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -79,6 +79,7 @@ #include "windef.h" #include "winbase.h" #include "x11drv.h" +#include "wine/list.h" #include "wine/debug.h" #include "wine/unicode.h" #include "wine/server.h" @@ -121,13 +122,12 @@ typedef struct tagWINE_CLIPFORMAT { } WINE_CLIPFORMAT, *LPWINE_CLIPFORMAT; typedef struct tagWINE_CLIPDATA { + struct list entry; UINT wFormatID; HANDLE hData; UINT wFlags; UINT drvData; LPWINE_CLIPFORMAT lpFormat; - struct tagWINE_CLIPDATA *PrevData; - struct tagWINE_CLIPDATA *NextData; } WINE_CLIPDATA, *LPWINE_CLIPDATA; #define CF_FLAG_BUILTINFMT 0x0001 /* Built-in windows format */ @@ -311,7 +311,7 @@ static const struct /* * Cached clipboard data. */ -static LPWINE_CLIPDATA ClipData = NULL; +static struct list data_list = LIST_INIT( data_list ); static UINT ClipDataCount = 0; /* @@ -487,24 +487,12 @@ static LPWINE_CLIPFORMAT X11DRV_CLIPBOARD_LookupProperty(LPWINE_CLIPFORMAT curre */ static LPWINE_CLIPDATA X11DRV_CLIPBOARD_LookupData(DWORD wID) { - LPWINE_CLIPDATA lpData = ClipData; + WINE_CLIPDATA *data; - if (lpData) - { - do - { - if (lpData->wFormatID == wID) - break; - - lpData = lpData->NextData; - } - while(lpData != ClipData); - - if (lpData->wFormatID != wID) - lpData = NULL; - } + LIST_FOR_EACH_ENTRY( data, &data_list, WINE_CLIPDATA, entry ) + if (data->wFormatID == wID) return data; - return lpData; + return NULL; } @@ -649,23 +637,7 @@ static BOOL X11DRV_CLIPBOARD_InsertClipboardData(UINT wFormatID, HANDLE hData, D lpData->lpFormat = lpFormat; lpData->drvData = 0; - if (ClipData) - { - LPWINE_CLIPDATA lpPrevData = ClipData->PrevData; - - lpData->PrevData = lpPrevData; - lpData->NextData = ClipData; - - lpPrevData->NextData = lpData; - ClipData->PrevData = lpData; - } - else - { - lpData->NextData = lpData; - lpData->PrevData = lpData; - ClipData = lpData; - } - + list_add_tail( &data_list, &lpData->entry ); ClipDataCount++; } @@ -2734,33 +2706,15 @@ int CDECL X11DRV_AcquireClipboard(HWND hWndClipWindow) */ void CDECL X11DRV_EmptyClipboard(BOOL keepunowned) { - if (ClipData) - { - LPWINE_CLIPDATA lpData, lpStart; - LPWINE_CLIPDATA lpNext = ClipData; - - TRACE(" called with %d entries in cache.\n", ClipDataCount); - - do - { - lpStart = ClipData; - lpData = lpNext; - lpNext = lpData->NextData; - - if (!keepunowned || !(lpData->wFlags & CF_FLAG_UNOWNED)) - { - lpData->PrevData->NextData = lpData->NextData; - lpData->NextData->PrevData = lpData->PrevData; - - if (lpData == ClipData) - ClipData = lpNext != lpData ? lpNext : NULL; - - X11DRV_CLIPBOARD_FreeData(lpData); - HeapFree(GetProcessHeap(), 0, lpData); + WINE_CLIPDATA *data, *next; - ClipDataCount--; - } - } while (lpNext != lpStart); + LIST_FOR_EACH_ENTRY_SAFE( data, next, &data_list, WINE_CLIPDATA, entry ) + { + if (keepunowned && (data->wFlags & CF_FLAG_UNOWNED)) continue; + list_remove( &data->entry ); + X11DRV_CLIPBOARD_FreeData( data ); + HeapFree( GetProcessHeap(), 0, data ); + ClipDataCount--; } TRACE(" %d entries remaining in cache.\n", ClipDataCount); @@ -2820,7 +2774,7 @@ INT CDECL X11DRV_CountClipboardFormats(void) UINT CDECL X11DRV_EnumClipboardFormats(UINT wFormat) { CLIPBOARDINFO cbinfo; - UINT wNextFormat = 0; + struct list *ptr = NULL; TRACE("(%04X)\n", wFormat); @@ -2828,18 +2782,16 @@ UINT CDECL X11DRV_EnumClipboardFormats(UINT wFormat) if (!wFormat) { - if (ClipData) - wNextFormat = ClipData->wFormatID; + ptr = list_head( &data_list ); } else { LPWINE_CLIPDATA lpData = X11DRV_CLIPBOARD_LookupData(wFormat); - - if (lpData && lpData->NextData != ClipData) - wNextFormat = lpData->NextData->wFormatID; + if (lpData) ptr = list_next( &data_list, &lpData->entry ); } - return wNextFormat; + if (!ptr) return 0; + return LIST_ENTRY( ptr, WINE_CLIPDATA, entry )->wFormatID; } @@ -3032,9 +2984,9 @@ static Atom X11DRV_SelectionRequest_TARGETS( Display *display, Window requestor, */ cTargets = 1; /* Include TARGETS */ - if (!(lpData = ClipData)) return None; + if (!list_head( &data_list )) return None; - do + LIST_FOR_EACH_ENTRY( lpData, &data_list, WINE_CLIPDATA, entry ) { lpFormats = ClipFormats; @@ -3046,10 +2998,7 @@ static Atom X11DRV_SelectionRequest_TARGETS( Display *display, Window requestor, lpFormats = lpFormats->NextFormat; } - - lpData = lpData->NextData; } - while (lpData != ClipData); TRACE(" found %d formats\n", cTargets); @@ -3059,10 +3008,9 @@ static Atom X11DRV_SelectionRequest_TARGETS( Display *display, Window requestor, return None; i = 0; - lpData = ClipData; targets[i++] = x11drv_atom(TARGETS); - do + LIST_FOR_EACH_ENTRY( lpData, &data_list, WINE_CLIPDATA, entry ) { lpFormats = ClipFormats; @@ -3074,10 +3022,7 @@ static Atom X11DRV_SelectionRequest_TARGETS( Display *display, Window requestor, lpFormats = lpFormats->NextFormat; } - - lpData = lpData->NextData; } - while (lpData != ClipData); wine_tsx11_lock();
1
0
0
0
Erich Hoover : shdocvw: Implement IWebBrowser::ExecWB and IWebBrowser:: QueryStatusWB.
by Alexandre Julliard
03 Mar '11
03 Mar '11
Module: wine Branch: master Commit: 4ec8e1a0371b6070ed654b4e56f66f1f0f9e7f6e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4ec8e1a0371b6070ed654b4e5…
Author: Erich Hoover <ehoover(a)mines.edu> Date: Tue Mar 1 13:25:41 2011 -0700 shdocvw: Implement IWebBrowser::ExecWB and IWebBrowser::QueryStatusWB. --- dlls/shdocvw/tests/webbrowser.c | 195 +++++++++++++++++++++++++++++++++++---- dlls/shdocvw/webbrowser.c | 67 +++++++++++++- 2 files changed, 240 insertions(+), 22 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=4ec8e1a0371b6070ed654…
1
0
0
0
Maarten Lankhorst : gdiplus: Implement GdipAddPathString.
by Alexandre Julliard
03 Mar '11
03 Mar '11
Module: wine Branch: master Commit: b8a1e6c68791ca6e8d583cd2f99d36da498a2ac4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b8a1e6c68791ca6e8d583cd2f…
Author: Maarten Lankhorst <m.b.lankhorst(a)gmail.com> Date: Thu Feb 17 11:06:43 2011 +0100 gdiplus: Implement GdipAddPathString. --- dlls/gdiplus/gdiplus_private.h | 10 ++ dlls/gdiplus/graphics.c | 7 +-- dlls/gdiplus/graphicspath.c | 179 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 186 insertions(+), 10 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 42e28fa..68998df 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -397,4 +397,14 @@ struct GpRegion{ region_element node; }; +typedef GpStatus (*gdip_format_string_callback)(HDC hdc, + GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, + GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, + INT lineno, const RectF *bounds, void *user_data); + +GpStatus gdip_format_string(HDC hdc, + GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, + GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, + gdip_format_string_callback callback, void *user_data); + #endif diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 5f226e9..43513c8 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3989,12 +3989,7 @@ GpStatus WINGDIPAPI GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, INT w return GdipIsVisibleRect(graphics, (REAL)x, (REAL)y, (REAL)width, (REAL)height, result); } -typedef GpStatus (*gdip_format_string_callback)(HDC hdc, - GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, - GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, - INT lineno, const RectF *bounds, void *user_data); - -static GpStatus gdip_format_string(HDC hdc, +GpStatus gdip_format_string(HDC hdc, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, gdip_format_string_callback callback, void *user_data) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 5a68147..992bd7c 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -831,16 +831,187 @@ GpStatus WINGDIPAPI GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points, return status; } +static float fromfixedpoint(const FIXED v) +{ + float f = ((float)v.fract) / (1<<(sizeof(v.fract)*8)); + f += v.value; + return f; +} + +struct format_string_args +{ + GpPath *path; + UINT maxY; +}; + +static GpStatus format_string_callback(HDC dc, + GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, + GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, + INT lineno, const RectF *bounds, void *priv) +{ + static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} }; + struct format_string_args *args = priv; + GpPath *path = args->path; + GpStatus status = Ok; + float x = bounds->X; + float y = bounds->Y; + int i; + + for (i = index; i < length; ++i) + { + GLYPHMETRICS gm; + TTPOLYGONHEADER *ph = NULL; + char *start; + DWORD len, ofs = 0; + UINT bb_end; + len = GetGlyphOutlineW(dc, string[i], GGO_BEZIER, &gm, 0, NULL, &identity); + if (len == GDI_ERROR) + { + status = GenericError; + break; + } + ph = GdipAlloc(len); + start = (char *)ph; + if (!ph || !lengthen_path(path, len / sizeof(POINTFX))) + { + status = OutOfMemory; + break; + } + GetGlyphOutlineW(dc, string[i], GGO_BEZIER, &gm, len, start, &identity); + bb_end = gm.gmBlackBoxY + gm.gmptGlyphOrigin.y; + if (bb_end + y > args->maxY) + args->maxY = bb_end + y; + + ofs = 0; + while (ofs < len) + { + DWORD ofs_start = ofs; + ph = (TTPOLYGONHEADER*)&start[ofs]; + path->pathdata.Types[path->pathdata.Count] = PathPointTypeStart; + path->pathdata.Points[path->pathdata.Count].X = x + fromfixedpoint(ph->pfxStart.x); + path->pathdata.Points[path->pathdata.Count++].Y = y + bb_end - fromfixedpoint(ph->pfxStart.y); + TRACE("Starting at count %i with pos %f, %f)\n", path->pathdata.Count, x, y); + ofs += sizeof(*ph); + while (ofs - ofs_start < ph->cb) + { + TTPOLYCURVE *curve = (TTPOLYCURVE*)&start[ofs]; + int j; + ofs += sizeof(TTPOLYCURVE) + (curve->cpfx - 1) * sizeof(POINTFX); + + switch (curve->wType) + { + case TT_PRIM_LINE: + for (j = 0; j < curve->cpfx; ++j) + { + path->pathdata.Types[path->pathdata.Count] = PathPointTypeLine; + path->pathdata.Points[path->pathdata.Count].X = x + fromfixedpoint(curve->apfx[j].x); + path->pathdata.Points[path->pathdata.Count++].Y = y + bb_end - fromfixedpoint(curve->apfx[j].y); + } + break; + case TT_PRIM_CSPLINE: + for (j = 0; j < curve->cpfx; ++j) + { + path->pathdata.Types[path->pathdata.Count] = PathPointTypeBezier; + path->pathdata.Points[path->pathdata.Count].X = x + fromfixedpoint(curve->apfx[j].x); + path->pathdata.Points[path->pathdata.Count++].Y = y + bb_end - fromfixedpoint(curve->apfx[j].y); + } + break; + default: + ERR("Unhandled type: %u\n", curve->wType); + status = GenericError; + } + } + path->pathdata.Types[path->pathdata.Count - 1] |= PathPointTypeCloseSubpath; + } + path->newfigure = TRUE; + x += gm.gmCellIncX; + y += gm.gmCellIncY; + + GdipFree(ph); + if (status != Ok) + break; + } + + return status; +} + GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT length, GDIPCONST GpFontFamily* family, INT style, REAL emSize, GDIPCONST RectF* layoutRect, GDIPCONST GpStringFormat* format) { - FIXME("(%p, %p, %d, %p, %d, %f, %p, %p): stub\n", path, string, length, family, style, emSize, layoutRect, format); - return NotImplemented; + GpFont *font; + GpStatus status; + HANDLE hfont; + HDC dc; + GpPath *backup; + struct format_string_args args; + int i; + + FIXME("(%p, %s, %d, %p, %d, %f, %p, %p): stub\n", path, debugstr_w(string), length, family, style, emSize, layoutRect, format); + if (!path || !string || !family || !emSize || !layoutRect || !format) + return InvalidParameter; + + status = GdipCreateFont(family, emSize, style, UnitPixel, &font); + if (status != Ok) + return status; + + hfont = CreateFontIndirectW(&font->lfw); + if (!hfont) + { + WARN("Failed to create font\n"); + return GenericError; + } + + if ((status = GdipClonePath(path, &backup)) != Ok) + { + DeleteObject(hfont); + return status; + } + + dc = CreateCompatibleDC(0); + SelectObject(dc, hfont); + + args.path = path; + args.maxY = 0; + status = gdip_format_string(dc, string, length, NULL, layoutRect, format, format_string_callback, &args); + + DeleteDC(dc); + DeleteObject(hfont); + + if (status != Ok) /* free backup */ + { + GdipFree(path->pathdata.Points); + GdipFree(path->pathdata.Types); + *path = *backup; + GdipFree(backup); + return status; + } + if (format && format->vertalign == StringAlignmentCenter && layoutRect->Y + args.maxY < layoutRect->Height) + { + float inc = layoutRect->Height - args.maxY - layoutRect->Y; + inc /= 2; + for (i = backup->pathdata.Count; i < path->pathdata.Count; ++i) + path->pathdata.Points[i].Y += inc; + } else if (format && format->vertalign == StringAlignmentFar) { + float inc = layoutRect->Height - args.maxY - layoutRect->Y; + for (i = backup->pathdata.Count; i < path->pathdata.Count; ++i) + path->pathdata.Points[i].Y += inc; + } + GdipDeletePath(backup); + return status; } GpStatus WINGDIPAPI GdipAddPathStringI(GpPath* path, GDIPCONST WCHAR* string, INT length, GDIPCONST GpFontFamily* family, INT style, REAL emSize, GDIPCONST Rect* layoutRect, GDIPCONST GpStringFormat* format) { - FIXME("(%p, %p, %d, %p, %d, %f, %p, %p): stub\n", path, string, length, family, style, emSize, layoutRect, format); - return NotImplemented; + if (layoutRect) + { + RectF layoutRectF = { + (REAL)layoutRect->X, + (REAL)layoutRect->Y, + (REAL)layoutRect->Width, + (REAL)layoutRect->Height + }; + return GdipAddPathString(path, string, length, family, style, emSize, &layoutRectF, format); + } + return InvalidParameter; } GpStatus WINGDIPAPI GdipClonePath(GpPath* path, GpPath **clone)
1
0
0
0
Maarten Lankhorst : gdiplus: Add tests and fix GdipDrawImagePointsRect.
by Alexandre Julliard
03 Mar '11
03 Mar '11
Module: wine Branch: master Commit: c0576948833522e71aa9cc2c77ce5d515b473d2f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c0576948833522e71aa9cc2c7…
Author: Maarten Lankhorst <m.b.lankhorst(a)gmail.com> Date: Thu Feb 17 10:51:33 2011 +0100 gdiplus: Add tests and fix GdipDrawImagePointsRect. --- dlls/gdiplus/graphics.c | 5 +++ dlls/gdiplus/tests/graphics.c | 56 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 0 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 65700da..5f226e9 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -2161,6 +2161,9 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData); + if (count > 3) + return NotImplemented; + if(!graphics || !image || !points || count != 3) return InvalidParameter; @@ -2170,6 +2173,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image memcpy(ptf, points, 3 * sizeof(GpPointF)); ptf[3].X = ptf[2].X + ptf[1].X - ptf[0].X; ptf[3].Y = ptf[2].Y + ptf[1].Y - ptf[0].Y; + if (!srcwidth || !srcheight || ptf[3].X == ptf[0].X || ptf[3].Y == ptf[0].Y) + return Ok; transform_and_round_points(graphics, pti, ptf, 4); if (image->picture) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 9a746b1..275c237 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -1130,6 +1130,60 @@ static void test_GdipDrawLineI(void) ReleaseDC(hwnd, hdc); } +static void test_GdipDrawImagePointsRect(void) +{ + GpStatus status; + GpGraphics *graphics = NULL; + GpPointF ptf[4]; + GpBitmap *bm = NULL; + BYTE rbmi[sizeof(BITMAPINFOHEADER)]; + BYTE buff[400]; + BITMAPINFO *bmi = (BITMAPINFO*)rbmi; + HDC hdc = GetDC( hwnd ); + if (!hdc) + return; + + memset(rbmi, 0, sizeof(rbmi)); + bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi->bmiHeader.biWidth = 10; + bmi->bmiHeader.biHeight = 10; + bmi->bmiHeader.biPlanes = 1; + bmi->bmiHeader.biBitCount = 32; + bmi->bmiHeader.biCompression = BI_RGB; + status = GdipCreateBitmapFromGdiDib(bmi, buff, &bm); + expect(Ok, status); + ok(NULL != bm, "Expected bitmap to be initialized\n"); + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ptf[0].X = 0; + ptf[0].Y = 0; + ptf[1].X = 10; + ptf[1].Y = 0; + ptf[2].X = 0; + ptf[2].Y = 10; + ptf[3].X = 10; + ptf[3].Y = 10; + status = GdipDrawImagePointsRect(graphics, (GpImage*)bm, ptf, 4, 0, 0, 10, 10, UnitPixel, NULL, NULL, NULL); + expect(NotImplemented, status); + status = GdipDrawImagePointsRect(graphics, (GpImage*)bm, ptf, 2, 0, 0, 10, 10, UnitPixel, NULL, NULL, NULL); + expect(InvalidParameter, status); + status = GdipDrawImagePointsRect(graphics, (GpImage*)bm, ptf, 3, 0, 0, 10, 10, UnitPixel, NULL, NULL, NULL); + expect(Ok, status); + status = GdipDrawImagePointsRect(graphics, NULL, ptf, 3, 0, 0, 10, 10, UnitPixel, NULL, NULL, NULL); + expect(InvalidParameter, status); + status = GdipDrawImagePointsRect(graphics, (GpImage*)bm, NULL, 3, 0, 0, 10, 10, UnitPixel, NULL, NULL, NULL); + expect(InvalidParameter, status); + status = GdipDrawImagePointsRect(graphics, (GpImage*)bm, ptf, 3, 0, 0, 0, 0, UnitPixel, NULL, NULL, NULL); + expect(Ok, status); + memset(ptf, 0, sizeof(ptf)); + status = GdipDrawImagePointsRect(graphics, (GpImage*)bm, ptf, 3, 0, 0, 10, 10, UnitPixel, NULL, NULL, NULL); + expect(Ok, status); + + GdipDisposeImage((GpImage*)bm); + GdipDeleteGraphics(graphics); + ReleaseDC(hwnd, hdc); +} + static void test_GdipDrawLinesI(void) { GpStatus status; @@ -1603,6 +1657,7 @@ static void test_Get_Release_DC(void) expect(ObjectBusy, status); status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, 5); expect(ObjectBusy, status); + /* try to delete before release */ status = GdipDeleteGraphics(graphics); expect(ObjectBusy, status); @@ -2998,6 +3053,7 @@ START_TEST(graphics) test_GdipDrawCurve3I(); test_GdipDrawLineI(); test_GdipDrawLinesI(); + test_GdipDrawImagePointsRect(); test_GdipFillClosedCurve(); test_GdipFillClosedCurveI(); test_GdipDrawString();
1
0
0
0
← Newer
1
...
74
75
76
77
78
79
80
...
85
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
Results per page:
10
25
50
100
200