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 2017
----- 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
717 discussions
Start a n
N
ew thread
André Hentschel : iphlpapi: Implement GetUnicastIpAddressTable.
by Alexandre Julliard
30 Mar '17
30 Mar '17
Module: wine Branch: master Commit: eda35423f4f52a1e9a2cb93219a4dd6c280baedf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=eda35423f4f52a1e9a2cb9321…
Author: André Hentschel <nerv(a)dawncrow.de> Date: Mon Mar 27 22:48:00 2017 +0200 iphlpapi: Implement GetUnicastIpAddressTable. Signed-off-by: André Hentschel <nerv(a)dawncrow.de> Signed-off-by: Bruno Jesus <bjesus(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/iphlpapi.spec | 2 +- dlls/iphlpapi/iphlpapi_main.c | 78 ++++++++++++++++++++++++++++++++++++++++++ dlls/iphlpapi/tests/iphlpapi.c | 56 ++++++++++++++++++++++++++++++ include/netioapi.h | 6 ++++ 4 files changed, 141 insertions(+), 1 deletion(-) diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec index d69b80e..4e01926 100644 --- a/dlls/iphlpapi/iphlpapi.spec +++ b/dlls/iphlpapi/iphlpapi.spec @@ -148,7 +148,7 @@ @ stdcall GetUdpTable( ptr ptr long ) @ stub GetUdpTableFromStack @ stdcall GetUnicastIpAddressEntry( ptr ) -#@ stub GetUnicastIpAddressTable +@ stdcall GetUnicastIpAddressTable(long ptr) @ stdcall GetUniDirectionalAdapterInfo( ptr ptr ) @ stdcall Icmp6CreateFile() #@ stub Icmp6ParseReplies diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 6f16807..1407bfb 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -2534,6 +2534,84 @@ DWORD WINAPI GetUnicastIpAddressEntry(MIB_UNICASTIPADDRESS_ROW *row) return ret; } +DWORD WINAPI GetUnicastIpAddressTable(ADDRESS_FAMILY family, MIB_UNICASTIPADDRESS_TABLE **table) +{ + IP_ADAPTER_ADDRESSES *aa, *ptr; + MIB_UNICASTIPADDRESS_TABLE *data; + DWORD ret, count = 0; + ULONG size, flags; + + TRACE("%u, %p\n", family, table); + + if (!table || (family != WS_AF_INET && family != WS_AF_INET6 && family != WS_AF_UNSPEC)) + return ERROR_INVALID_PARAMETER; + + flags = GAA_FLAG_SKIP_ANYCAST | + GAA_FLAG_SKIP_MULTICAST | + GAA_FLAG_SKIP_DNS_SERVER | + GAA_FLAG_SKIP_FRIENDLY_NAME; + + ret = GetAdaptersAddresses(family, flags, NULL, NULL, &size); + if (ret != ERROR_BUFFER_OVERFLOW) + return ret; + if (!(ptr = HeapAlloc(GetProcessHeap(), 0, size))) + return ERROR_OUTOFMEMORY; + if ((ret = GetAdaptersAddresses(family, flags, NULL, ptr, &size))) + { + HeapFree(GetProcessHeap(), 0, ptr); + return ret; + } + + for (aa = ptr; aa; aa = aa->Next) + { + IP_ADAPTER_UNICAST_ADDRESS *ua = aa->FirstUnicastAddress; + while (ua) + { + count++; + ua = ua->Next; + } + } + + if (!(data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data) + (count - 1) * sizeof(data->Table[0])))) + { + HeapFree(GetProcessHeap(), 0, ptr); + return ERROR_OUTOFMEMORY; + } + + data->NumEntries = 0; + for (aa = ptr; aa; aa = aa->Next) + { + IP_ADAPTER_UNICAST_ADDRESS *ua = aa->FirstUnicastAddress; + while (ua) + { + MIB_UNICASTIPADDRESS_ROW *row = &data->Table[data->NumEntries]; + memcpy(&row->Address, ua->Address.lpSockaddr, ua->Address.iSockaddrLength); + memcpy(&row->InterfaceLuid, &aa->Luid, sizeof(aa->Luid)); + row->InterfaceIndex = aa->u.s.IfIndex; + row->PrefixOrigin = ua->PrefixOrigin; + row->SuffixOrigin = ua->SuffixOrigin; + row->ValidLifetime = ua->ValidLifetime; + row->PreferredLifetime = ua->PreferredLifetime; + row->OnLinkPrefixLength = ua->OnLinkPrefixLength; + row->SkipAsSource = 0; + row->DadState = ua->DadState; + if (row->Address.si_family == WS_AF_INET6) + row->ScopeId.u.Value = row->Address.Ipv6.sin6_scope_id; + else + row->ScopeId.u.Value = 0; + NtQuerySystemTime(&row->CreationTimeStamp); + + data->NumEntries++; + ua = ua->Next; + } + } + + HeapFree(GetProcessHeap(), 0, ptr); + + *table = data; + return ret; +} + /****************************************************************** * GetUniDirectionalAdapterInfo (IPHLPAPI.@) * diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index bc99660..9deccc2 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -76,6 +76,7 @@ static DWORD (WINAPI *pGetUdpTable)(PMIB_UDPTABLE,PDWORD,BOOL); static DWORD (WINAPI *pGetPerAdapterInfo)(ULONG,PIP_PER_ADAPTER_INFO,PULONG); static DWORD (WINAPI *pGetAdaptersAddresses)(ULONG,ULONG,PVOID,PIP_ADAPTER_ADDRESSES,PULONG); static DWORD (WINAPI *pGetUnicastIpAddressEntry)(MIB_UNICASTIPADDRESS_ROW*); +static DWORD (WINAPI *pGetUnicastIpAddressTable)(ADDRESS_FAMILY,MIB_UNICASTIPADDRESS_TABLE**); static DWORD (WINAPI *pNotifyAddrChange)(PHANDLE,LPOVERLAPPED); static BOOL (WINAPI *pCancelIPChangeNotify)(LPOVERLAPPED); static DWORD (WINAPI *pGetExtendedTcpTable)(PVOID,PDWORD,BOOL,ULONG,TCP_TABLE_CLASS,ULONG); @@ -125,6 +126,7 @@ static void loadIPHlpApi(void) pGetPerAdapterInfo = (void *)GetProcAddress(hLibrary, "GetPerAdapterInfo"); pGetAdaptersAddresses = (void *)GetProcAddress(hLibrary, "GetAdaptersAddresses"); pGetUnicastIpAddressEntry = (void *)GetProcAddress(hLibrary, "GetUnicastIpAddressEntry"); + pGetUnicastIpAddressTable = (void *)GetProcAddress(hLibrary, "GetUnicastIpAddressTable"); pNotifyAddrChange = (void *)GetProcAddress(hLibrary, "NotifyAddrChange"); pCancelIPChangeNotify = (void *)GetProcAddress(hLibrary, "CancelIPChangeNotify"); pGetExtendedTcpTable = (void *)GetProcAddress(hLibrary, "GetExtendedTcpTable"); @@ -2095,6 +2097,59 @@ static void test_GetUnicastIpAddressEntry(void) HeapFree(GetProcessHeap(), 0, ptr); } +static void test_GetUnicastIpAddressTable(void) +{ + MIB_UNICASTIPADDRESS_TABLE *table; + DWORD ret; + ULONG i; + + if (!pGetUnicastIpAddressTable) + { + win_skip( "GetUnicastIpAddressTable not available\n" ); + return; + } + + ret = pGetUnicastIpAddressTable(AF_UNSPEC, NULL); + ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret ); + + ret = pGetUnicastIpAddressTable(AF_BAN, &table); + ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret ); + + ret = pGetUnicastIpAddressTable(AF_INET, &table); + ok( ret == NO_ERROR, "got %u\n", ret ); + trace("GetUnicastIpAddressTable(AF_INET): NumEntries %u\n", table->NumEntries); + pFreeMibTable(table); + + ret = pGetUnicastIpAddressTable(AF_INET6, &table); + ok( ret == NO_ERROR, "got %u\n", ret ); + trace("GetUnicastIpAddressTable(AF_INET6): NumEntries %u\n", table->NumEntries); + pFreeMibTable(table); + + ret = pGetUnicastIpAddressTable(AF_UNSPEC, &table); + ok( ret == NO_ERROR, "got %u\n", ret ); + trace("GetUnicastIpAddressTable(AF_UNSPEC): NumEntries %u\n", table->NumEntries); + for (i = 0; i < table->NumEntries && winetest_debug > 1; i++) + { + trace("Index %u:\n", i); + trace("Address.si_family: %u\n", table->Table[i].Address.si_family); + trace("InterfaceLuid.Info.Reserved: %u\n", table->Table[i].InterfaceLuid.Info.Reserved); + trace("InterfaceLuid.Info.NetLuidIndex: %u\n", table->Table[i].InterfaceLuid.Info.NetLuidIndex); + trace("InterfaceLuid.Info.IfType: %u\n", table->Table[i].InterfaceLuid.Info.IfType); + trace("InterfaceIndex: %u\n", table->Table[i].InterfaceIndex); + trace("PrefixOrigin: %u\n", table->Table[i].PrefixOrigin); + trace("SuffixOrigin: %u\n", table->Table[i].SuffixOrigin); + trace("ValidLifetime: %u seconds\n", table->Table[i].ValidLifetime); + trace("PreferredLifetime: %u seconds\n", table->Table[i].PreferredLifetime); + trace("OnLinkPrefixLength: %u\n", table->Table[i].OnLinkPrefixLength); + trace("SkipAsSource: %u\n", table->Table[i].SkipAsSource); + trace("DadState: %u\n", table->Table[i].DadState); + trace("ScopeId.Value: %u\n", table->Table[i].ScopeId.Value); + trace("CreationTimeStamp: %08x%08x\n", table->Table[i].CreationTimeStamp.HighPart, table->Table[i].CreationTimeStamp.LowPart); + } + + pFreeMibTable(table); +} + START_TEST(iphlpapi) { @@ -2120,6 +2175,7 @@ START_TEST(iphlpapi) test_GetIfEntry2(); test_GetIfTable2(); test_GetUnicastIpAddressEntry(); + test_GetUnicastIpAddressTable(); freeIPHlpApi(); } } diff --git a/include/netioapi.h b/include/netioapi.h index b34d019..cabfe9e 100644 --- a/include/netioapi.h +++ b/include/netioapi.h @@ -145,6 +145,12 @@ typedef struct _MIB_UNICASTIPADDRESS_ROW LARGE_INTEGER CreationTimeStamp; } MIB_UNICASTIPADDRESS_ROW, *PMIB_UNICASTIPADDRESS_ROW; +typedef struct _MIB_UNICASTIPADDRESS_TABLE +{ + ULONG NumEntries; + MIB_UNICASTIPADDRESS_ROW Table[1]; +} MIB_UNICASTIPADDRESS_TABLE, *PMIB_UNICASTIPADDRESS_TABLE; + typedef VOID (WINAPI *PIPINTERFACE_CHANGE_CALLBACK)(PVOID, PMIB_IPINTERFACE_ROW, MIB_NOTIFICATION_TYPE); typedef VOID (WINAPI *PUNICAST_IPADDRESS_CHANGE_CALLBACK)(PVOID, PMIB_UNICASTIPADDRESS_ROW,
1
0
0
0
Austin English : d3d10: Sync spec file to Windows 10.
by Alexandre Julliard
30 Mar '17
30 Mar '17
Module: wine Branch: master Commit: 12a7b2b41c6ec692b01d079d6726c85ea00e71e5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=12a7b2b41c6ec692b01d079d6…
Author: Austin English <austinenglish(a)gmail.com> Date: Tue Mar 28 15:41:10 2017 -0500 d3d10: Sync spec file to Windows 10. Signed-off-by: Austin English <austinenglish(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10/d3d10.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/d3d10/d3d10.spec b/dlls/d3d10/d3d10.spec index db42511..62dd94d 100644 --- a/dlls/d3d10/d3d10.spec +++ b/dlls/d3d10/d3d10.spec @@ -1,3 +1,4 @@ +# 1 stub RevertToOldImplementation @ stdcall D3D10CompileEffectFromMemory(ptr long ptr ptr ptr long long ptr ptr) @ stdcall D3D10CompileShader(ptr long str ptr ptr str str long ptr ptr) @ stdcall D3D10CreateBlob(long ptr) d3dcompiler_43.D3DCreateBlob
1
0
0
0
Hugh McMaster : regedit: Make "Unknown Type" translatable.
by Alexandre Julliard
30 Mar '17
30 Mar '17
Module: wine Branch: master Commit: 9ad4152e6d18f5af34ca66c4a4f36774cab807c7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9ad4152e6d18f5af34ca66c4a…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Mar 30 12:11:42 2017 +0000 regedit: Make "Unknown Type" translatable. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- po/ar.po | 2 +- po/bg.po | 2 +- po/ca.po | 2 +- po/cs.po | 2 +- po/da.po | 2 +- po/de.po | 2 +- po/el.po | 2 +- po/en.po | 2 +- po/en_US.po | 2 +- po/eo.po | 2 +- po/es.po | 2 +- po/fa.po | 2 +- po/fi.po | 2 +- po/fr.po | 2 +- po/he.po | 2 +- po/hi.po | 2 +- po/hr.po | 2 +- po/hu.po | 2 +- po/it.po | 2 +- po/ja.po | 2 +- po/ko.po | 2 +- po/lt.po | 2 +- po/ml.po | 2 +- po/nb_NO.po | 2 +- po/nl.po | 2 +- po/or.po | 2 +- po/pa.po | 2 +- po/pl.po | 2 +- po/pt_BR.po | 2 +- po/pt_PT.po | 2 +- po/rm.po | 2 +- po/ro.po | 2 +- po/ru.po | 2 +- po/sk.po | 2 +- po/sl.po | 2 +- po/sr_RS(a)cyrillic.po | 2 +- po/sr_RS(a)latin.po | 2 +- po/sv.po | 2 +- po/te.po | 2 +- po/th.po | 2 +- po/tr.po | 2 +- po/uk.po | 2 +- po/wa.po | 2 +- po/wine.pot | 2 +- po/zh_CN.po | 2 +- po/zh_TW.po | 2 +- programs/regedit/regedit.rc | 1 + programs/regedit/regproc.c | 12 +++++++++--- programs/regedit/resource.h | 1 + 49 files changed, 57 insertions(+), 49 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=9ad4152e6d18f5af34ca6…
1
0
0
0
Huw Davies : user32: Limit the menu height to that of the work area.
by Alexandre Julliard
30 Mar '17
30 Mar '17
Module: wine Branch: master Commit: 3c0ddd59716dab6408a540c90f4cef19c6d2f1d6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3c0ddd59716dab6408a540c90…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Mar 30 10:58:33 2017 +0100 user32: Limit the menu height to that of the work area. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/menu.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 543e0c1..e2ab09c 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -1136,31 +1136,18 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner, TRACE("%s\n", wine_dbgstr_rect( &lpitem->rect)); } - -/*********************************************************************** - * MENU_GetMaxPopupHeight - */ -static UINT -MENU_GetMaxPopupHeight(const POPUPMENU *lppop) -{ - if (lppop->cyMax) - return lppop->cyMax; - return GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYBORDER); -} - - /*********************************************************************** * MENU_PopupMenuCalcSize * * Calculate the size of a popup menu. */ -static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop ) +static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop, UINT max_height ) { MENUITEM *lpitem; HDC hdc; UINT start, i; BOOL textandbmp = FALSE, multi_col = FALSE; - int orgX, orgY, maxTab, maxTabWidth, maxHeight; + int orgX, orgY, maxTab, maxTabWidth; lppop->Width = lppop->Height = 0; SetRectEmpty(&lppop->items_rect); @@ -1230,10 +1217,9 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop ) lppop->Width = lppop->items_rect.right + MENU_MARGIN; /* Adjust popup height if it exceeds maximum */ - maxHeight = MENU_GetMaxPopupHeight(lppop); - if (lppop->Height >= maxHeight) + if (lppop->Height >= max_height) { - lppop->Height = maxHeight; + lppop->Height = max_height; lppop->bScrolling = !multi_col; /* When the scroll arrows are present, don't add the top/bottom margin as well */ if (lppop->bScrolling) @@ -1894,6 +1880,7 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags, POINT pt; HMONITOR monitor; MONITORINFO info; + UINT max_height; TRACE("owner=%p hmenu=%p id=0x%04x x=0x%04x y=0x%04x xa=0x%04x ya=0x%04x\n", hwndOwner, hmenu, id, x, y, xanchor, yanchor); @@ -1906,9 +1893,6 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags, } menu->nScrollPos = 0; - MENU_PopupMenuCalcSize( menu ); - - /* adjust popup menu pos so that it fits within the desktop */ /* FIXME: should use item rect */ pt.x = x; @@ -1917,6 +1901,14 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags, info.cbSize = sizeof(info); GetMonitorInfoW( monitor, &info ); + max_height = info.rcWork.bottom - info.rcWork.top; + if (menu->cyMax) + max_height = min( max_height, menu->cyMax ); + + MENU_PopupMenuCalcSize( menu, max_height ); + + /* adjust popup menu pos so that it fits within the desktop */ + if (flags & TPM_LAYOUTRTL) flags ^= TPM_RIGHTALIGN;
1
0
0
0
Huw Davies : user32: Disable scrolling for multi-column menus.
by Alexandre Julliard
30 Mar '17
30 Mar '17
Module: wine Branch: master Commit: 1d4992282d8e36cf4c4836045d042c983a3d6f0c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1d4992282d8e36cf4c4836045…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Mar 30 10:58:32 2017 +0100 user32: Disable scrolling for multi-column menus. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/menu.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index dd62063..543e0c1 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -1159,7 +1159,7 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop ) MENUITEM *lpitem; HDC hdc; UINT start, i; - BOOL textandbmp = FALSE; + BOOL textandbmp = FALSE, multi_col = FALSE; int orgX, orgY, maxTab, maxTabWidth, maxHeight; lppop->Width = lppop->Height = 0; @@ -1186,8 +1186,11 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop ) /* Parse items until column break or end of menu */ for (i = start; i < lppop->nItems; i++, lpitem++) { - if ((i != start) && - (lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break; + if (lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK)) + { + multi_col = TRUE; + if (i != start) break; + } MENU_CalcItemSize( hdc, lpitem, lppop->hwndOwner, orgX, orgY, FALSE, lppop ); lppop->items_rect.right = max( lppop->items_rect.right, lpitem->rect.right ); @@ -1231,10 +1234,13 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop ) if (lppop->Height >= maxHeight) { lppop->Height = maxHeight; + lppop->bScrolling = !multi_col; /* When the scroll arrows are present, don't add the top/bottom margin as well */ - lppop->items_rect.top += get_scroll_arrow_height(lppop) - MENU_MARGIN; - lppop->items_rect.bottom = lppop->Height - get_scroll_arrow_height(lppop); - lppop->bScrolling = TRUE; + if (lppop->bScrolling) + { + lppop->items_rect.top = get_scroll_arrow_height(lppop); + lppop->items_rect.bottom = lppop->Height - get_scroll_arrow_height(lppop); + } } else {
1
0
0
0
Huw Davies : user32: Don' t finish tracking when the menu borders or scroll arrows are clicked.
by Alexandre Julliard
30 Mar '17
30 Mar '17
Module: wine Branch: master Commit: d4544f7feda2c8249b32c2062ff194436c7cb385 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d4544f7feda2c8249b32c2062…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Mar 30 10:58:31 2017 +0100 user32: Don't finish tracking when the menu borders or scroll arrows are clicked. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/menu.c | 119 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 78 insertions(+), 41 deletions(-) diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 79bef64..dd62063 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -665,6 +665,14 @@ MENU_AdjustMenuItemRect(const POPUPMENU *menu, LPRECT rect) OffsetRect( rect, menu->items_rect.left, menu->items_rect.top - scroll_offset ); } +enum hittest +{ + ht_nowhere, /* outside the menu */ + ht_border, /* anywhere that's not an item or a scroll arrow */ + ht_item, /* a menu item */ + ht_scroll_up, /* scroll up arrow */ + ht_scroll_down /* scroll down arrow */ +}; /*********************************************************************** * MENU_FindItemByCoords @@ -672,30 +680,61 @@ MENU_AdjustMenuItemRect(const POPUPMENU *menu, LPRECT rect) * Find the item at the specified coordinates (screen coords). Does * not work for child windows and therefore should not be called for * an arbitrary system menu. + * + * Returns a hittest code. *pos will contain the position of the + * item or NO_SELECTED_ITEM. If the hittest code is ht_scroll_up + * or ht_scroll_down then *pos will contain the position of the + * item that's just outside the items_rect - ie, the one that would + * be scrolled completely into view. */ -static MENUITEM *MENU_FindItemByCoords( const POPUPMENU *menu, - POINT pt, UINT *pos ) +static enum hittest MENU_FindItemByCoords( const POPUPMENU *menu, POINT pt, UINT *pos ) { MENUITEM *item; UINT i; RECT rect; + enum hittest ht = ht_border; + + *pos = NO_SELECTED_ITEM; + + if (!GetWindowRect(menu->hWnd, &rect) || !PtInRect(&rect, pt)) + return ht_nowhere; - if (!GetWindowRect(menu->hWnd, &rect)) return NULL; if (GetWindowLongW( menu->hWnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) pt.x = rect.right - 1 - pt.x; else pt.x -= rect.left; pt.y -= rect.top; + + if (!PtInRect(&menu->items_rect, pt)) + { + if (!menu->bScrolling || pt.x < menu->items_rect.left || pt.x >= menu->items_rect.right) + return ht_border; + + /* On a scroll arrow. Update pt so that it points to the item just outside items_rect */ + if (pt.y < menu->items_rect.top) + { + ht = ht_scroll_up; + pt.y = menu->items_rect.top - 1; + } + else + { + ht = ht_scroll_down; + pt.y = menu->items_rect.bottom; + } + } + item = menu->items; for (i = 0; i < menu->nItems; i++, item++) { rect = item->rect; MENU_AdjustMenuItemRect(menu, &rect); - if (PtInRect(&rect, pt)) - { - if (pos) *pos = i; - return item; - } + if (PtInRect(&rect, pt)) + { + *pos = i; + if (ht != ht_scroll_up && ht != ht_scroll_down) ht = ht_item; + break; + } } - return NULL; + + return ht; } @@ -2549,29 +2588,28 @@ static BOOL MENU_ButtonDown( MTRACKER* pmt, HMENU hPtMenu, UINT wFlags ) if (hPtMenu) { - UINT id = 0; - POPUPMENU *ptmenu = MENU_GetMenu( hPtMenu ); - MENUITEM *item; + UINT pos; + POPUPMENU *ptmenu = MENU_GetMenu( hPtMenu ); + enum hittest ht = ht_nowhere; - if( IS_SYSTEM_MENU(ptmenu) ) - item = ptmenu->items; - else - item = MENU_FindItemByCoords( ptmenu, pmt->pt, &id ); + if( IS_SYSTEM_MENU(ptmenu) ) + pos = 0; + else + ht = MENU_FindItemByCoords( ptmenu, pmt->pt, &pos ); - if( item ) - { - if( ptmenu->FocusedItem != id ) - MENU_SwitchTracking( pmt, hPtMenu, id, wFlags ); + if (pos != NO_SELECTED_ITEM) + { + if (ptmenu->FocusedItem != pos) + MENU_SwitchTracking( pmt, hPtMenu, pos, wFlags ); - /* If the popup menu is not already "popped" */ - if(!(item->fState & MF_MOUSESELECT )) - { - pmt->hCurrentMenu = MENU_ShowSubPopup( pmt->hOwnerWnd, hPtMenu, FALSE, wFlags ); - } + /* If the popup menu is not already "popped" */ + if (!(ptmenu->items[pos].fState & MF_MOUSESELECT)) + pmt->hCurrentMenu = MENU_ShowSubPopup( pmt->hOwnerWnd, hPtMenu, FALSE, wFlags ); + } - return TRUE; - } - /* Else the click was on the menu bar, finish the tracking */ + /* A click on an item or anywhere on a popup keeps tracking going */ + if (ht == ht_item || ((ptmenu->wFlags & MF_POPUP) && ht != ht_nowhere)) + return TRUE; } return FALSE; } @@ -2590,20 +2628,19 @@ static INT MENU_ButtonUp( MTRACKER* pmt, HMENU hPtMenu, UINT wFlags) if (hPtMenu) { - UINT id = 0; + UINT pos; POPUPMENU *ptmenu = MENU_GetMenu( hPtMenu ); - MENUITEM *item; if( IS_SYSTEM_MENU(ptmenu) ) - item = ptmenu->items; - else - item = MENU_FindItemByCoords( ptmenu, pmt->pt, &id ); + pos = 0; + else if (MENU_FindItemByCoords( ptmenu, pmt->pt, &pos ) != ht_item) + pos = NO_SELECTED_ITEM; - if( item && (ptmenu->FocusedItem == id )) + if (pos != NO_SELECTED_ITEM && (ptmenu->FocusedItem == pos)) { - debug_print_menuitem ("FocusedItem: ", item, ""); + debug_print_menuitem ("FocusedItem: ", &ptmenu->items[pos], ""); - if( !(item->fType & MF_POPUP) ) + if (!(ptmenu->items[pos].fType & MF_POPUP)) { INT executedMenuId = MENU_ExecFocusedItem( pmt, hPtMenu, wFlags); if (executedMenuId == -1 || executedMenuId == -2) return -1; @@ -2638,8 +2675,8 @@ static BOOL MENU_MouseMove( MTRACKER* pmt, HMENU hPtMenu, UINT wFlags ) ptmenu = MENU_GetMenu( hPtMenu ); if( IS_SYSTEM_MENU(ptmenu) ) id = 0; - else - MENU_FindItemByCoords( ptmenu, pmt->pt, &id ); + else if (MENU_FindItemByCoords( ptmenu, pmt->pt, &id ) != ht_item) + id = NO_SELECTED_ITEM; } if( id == NO_SELECTED_ITEM ) @@ -2650,8 +2687,8 @@ static BOOL MENU_MouseMove( MTRACKER* pmt, HMENU hPtMenu, UINT wFlags ) } else if( ptmenu->FocusedItem != id ) { - MENU_SwitchTracking( pmt, hPtMenu, id, wFlags ); - pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags); + MENU_SwitchTracking( pmt, hPtMenu, id, wFlags ); + pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags); } return TRUE; } @@ -5254,7 +5291,7 @@ INT WINAPI MenuItemFromPoint(HWND hWnd, HMENU hMenu, POINT ptScreen) /*FIXME: Do we have to handle hWnd here? */ if (!menu) return -1; - if (!MENU_FindItemByCoords(menu, ptScreen, &pos)) return -1; + if (MENU_FindItemByCoords( menu, ptScreen, &pos ) != ht_item) return -1; return pos; }
1
0
0
0
Jacek Caban : kernel32: Use default buffer size in CreatePipe if 0 was passed.
by Alexandre Julliard
30 Mar '17
30 Mar '17
Module: wine Branch: master Commit: e44c0f710b72606e1badb4937dc51edeb6e0804e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e44c0f710b72606e1badb4937…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Mar 30 14:02:49 2017 +0200 kernel32: Use default buffer size in CreatePipe if 0 was passed. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/sync.c | 2 ++ dlls/kernel32/tests/pipe.c | 37 +++++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c index 494db9c..ee995f5 100644 --- a/dlls/kernel32/sync.c +++ b/dlls/kernel32/sync.c @@ -1932,6 +1932,8 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe, attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; attr.SecurityQualityOfService = NULL; + if (!size) size = 4096; + timeout.QuadPart = (ULONGLONG)NMPWAIT_USE_DEFAULT_WAIT * -10000; /* generate a unique pipe name (system wide) */ do diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c index fb6d3c0..dc4be32 100644 --- a/dlls/kernel32/tests/pipe.c +++ b/dlls/kernel32/tests/pipe.c @@ -125,6 +125,20 @@ static void _test_signaled(unsigned line, HANDLE handle) ok_(__FILE__,line)(res == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", res); } +#define test_pipe_info(a,b,c,d,e) _test_pipe_info(__LINE__,a,b,c,d,e) +static void _test_pipe_info(unsigned line, HANDLE pipe, DWORD ex_flags, DWORD ex_out_buf_size, DWORD ex_in_buf_size, DWORD ex_max_instances) +{ + DWORD flags = 0xdeadbeef, out_buf_size = 0xdeadbeef, in_buf_size = 0xdeadbeef, max_instances = 0xdeadbeef; + BOOL res; + + res = GetNamedPipeInfo(pipe, &flags, &out_buf_size, &in_buf_size, &max_instances); + ok_(__FILE__,line)(res, "GetNamedPipeInfo failed: %x\n", res); + ok_(__FILE__,line)(flags == ex_flags, "flags = %x, expected %x\n", flags, ex_flags); + ok_(__FILE__,line)(out_buf_size == ex_out_buf_size, "out_buf_size = %x, expected %u\n", out_buf_size, ex_out_buf_size); + ok_(__FILE__,line)(in_buf_size == ex_in_buf_size, "in_buf_size = %x, expected %u\n", in_buf_size, ex_in_buf_size); + ok_(__FILE__,line)(max_instances == ex_max_instances, "max_instances = %x, expected %u\n", max_instances, ex_max_instances); +} + static void test_CreateNamedPipe(int pipemode) { HANDLE hnp; @@ -1319,6 +1333,9 @@ static void test_CreatePipe(void) pipe_attr.bInheritHandle = TRUE; pipe_attr.lpSecurityDescriptor = NULL; ok(CreatePipe(&piperead, &pipewrite, &pipe_attr, 0) != 0, "CreatePipe failed\n"); + test_pipe_info(piperead, FILE_PIPE_SERVER_END, 4096, 4096, 1); + test_pipe_info(pipewrite, 0, 4096, 4096, 1); + ok(WriteFile(pipewrite,PIPENAME,sizeof(PIPENAME), &written, NULL), "Write to anonymous pipe failed\n"); ok(written == sizeof(PIPENAME), "Write to anonymous pipe wrote %d bytes\n", written); ok(ReadFile(piperead,readbuf,sizeof(readbuf),&read, NULL), "Read from non empty pipe failed\n"); @@ -1358,6 +1375,12 @@ static void test_CreatePipe(void) ok(user_apc_ran == FALSE, "user apc ran, pipe using alertable io mode\n"); SleepEx(0, TRUE); /* get rid of apc */ + + ok(CreatePipe(&piperead, &pipewrite, &pipe_attr, 1) != 0, "CreatePipe failed\n"); + test_pipe_info(piperead, FILE_PIPE_SERVER_END, 1, 1, 1); + test_pipe_info(pipewrite, 0, 1, 1, 1); + ok(CloseHandle(pipewrite), "CloseHandle for the Write Pipe failed\n"); + ok(CloseHandle(piperead), "CloseHandle for the read pipe failed\n"); } static void test_CloseHandle(void) @@ -2250,20 +2273,6 @@ static void test_NamedPipeHandleState(void) CloseHandle(server); } -#define test_pipe_info(a,b,c,d,e) _test_pipe_info(__LINE__,a,b,c,d,e) -static void _test_pipe_info(unsigned line, HANDLE pipe, DWORD ex_flags, DWORD ex_out_buf_size, DWORD ex_in_buf_size, DWORD ex_max_instances) -{ - DWORD flags = 0xdeadbeef, out_buf_size = 0xdeadbeef, in_buf_size = 0xdeadbeef, max_instances = 0xdeadbeef; - BOOL res; - - res = GetNamedPipeInfo(pipe, &flags, &out_buf_size, &in_buf_size, &max_instances); - ok_(__FILE__,line)(res, "GetNamedPipeInfo failed: %x\n", res); - ok_(__FILE__,line)(flags == ex_flags, "flags = %x, expected %x\n", flags, ex_flags); - ok_(__FILE__,line)(out_buf_size == ex_out_buf_size, "out_buf_size = %x, expected %u\n", out_buf_size, ex_out_buf_size); - ok_(__FILE__,line)(in_buf_size == ex_in_buf_size, "in_buf_size = %x, expected %u\n", in_buf_size, ex_in_buf_size); - ok_(__FILE__,line)(max_instances == ex_max_instances, "max_instances = %x, expected %u\n", max_instances, ex_max_instances); -} - static void test_GetNamedPipeInfo(void) { HANDLE server;
1
0
0
0
Nikolay Sivov : dwrite: Fix off by one error in glyph count adjustment.
by Alexandre Julliard
30 Mar '17
30 Mar '17
Module: wine Branch: master Commit: 3d7fabf62788f6ea41e48d3daad05aa776d8bc1f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3d7fabf62788f6ea41e48d3da…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Mar 30 15:07:02 2017 +0300 dwrite: Fix off by one error in glyph count adjustment. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/layout.c | 5 ++--- dlls/dwrite/tests/layout.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index a7fff46..590b2c5 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -1269,10 +1269,9 @@ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const run->line = line; if (r->u.regular.run.glyphCount) { - /* trim from the left */ + /* Trim leading and trailing clusters. */ run->glyphcount = r->u.regular.run.glyphCount - r->u.regular.clustermap[start]; - /* trim from the right */ - if (start + length < r->u.regular.descr.stringLength - 1) + if (start + length < r->u.regular.descr.stringLength) run->glyphcount -= r->u.regular.run.glyphCount - r->u.regular.clustermap[start + length]; } else diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index c097e20..daffd81 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -1626,7 +1626,7 @@ static void test_Draw(void) flush_sequence(sequences, RENDERER_ID); hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, 0.0, 0.0); ok(hr == S_OK, "got 0x%08x\n", hr); - ok_sequence(sequences, RENDERER_ID, draw_seq, "draw test", TRUE); + ok_sequence(sequences, RENDERER_ID, draw_seq, "draw test", FALSE); IDWriteTextLayout_Release(layout); /* with reduced width DrawGlyphRun() is called for every line */ @@ -4987,7 +4987,7 @@ todo_wine flush_sequence(sequences, RENDERER_ID); hr = IDWriteTextLayout_Draw(layout, NULL, &testrenderer, 0.0f, 0.0f); ok(hr == S_OK, "got 0x%08x\n", hr); - ok_sequence(sequences, RENDERER_ID, drawunderline4_seq, "draw underline test 4", TRUE); + ok_sequence(sequences, RENDERER_ID, drawunderline4_seq, "draw underline test 4", FALSE); IDWriteTextLayout_Release(layout);
1
0
0
0
Nikolay Sivov : dwrite/tests: Test glyph count for each DrawGlyphRun().
by Alexandre Julliard
30 Mar '17
30 Mar '17
Module: wine Branch: master Commit: 7371325c042f2b64a48066cf93ef07654316beea URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7371325c042f2b64a48066cf9…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Mar 30 15:07:01 2017 +0300 dwrite/tests: Test glyph count for each DrawGlyphRun(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/tests/layout.c | 99 +++++++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 37 deletions(-) diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index 0d73716..c097e20 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -310,6 +310,7 @@ struct drawcall_entry { enum drawcall_kind kind; WCHAR string[10]; /* only meaningful for DrawGlyphRun() */ WCHAR locale[LOCALE_NAME_MAX_LENGTH]; + UINT32 glyphcount; /* only meaningful for DrawGlyphRun() */ }; struct drawcall_sequence @@ -409,6 +410,28 @@ static void ok_sequence_(struct drawcall_sequence **seq, int sequence_index, else ok_(file, line) (cmp == 0, "%s: glyphrun string %s was expected, but got %s instead\n", context, wine_dbgstr_w(expected->string), wine_dbgstr_w(actual->string)); + + cmp = lstrcmpW(expected->locale, actual->locale); + if (cmp != 0 && todo) { + failcount++; + todo_wine + ok_(file, line) (0, "%s: glyph run locale %s was expected, but got %s instead\n", + context, wine_dbgstr_w(expected->locale), wine_dbgstr_w(actual->locale)); + } + else + ok_(file, line) (cmp == 0, "%s: glyph run locale %s was expected, but got %s instead\n", + context, wine_dbgstr_w(expected->locale), wine_dbgstr_w(actual->locale)); + + if (expected->glyphcount != actual->glyphcount && todo) { + failcount++; + todo_wine + ok_(file, line) (0, "%s: wrong glyph count, %u was expected, but got %u instead\n", + context, expected->glyphcount, actual->glyphcount); + } + else + ok_(file, line) (expected->glyphcount == actual->glyphcount, + "%s: wrong glyph count, %u was expected, but got %u instead\n", + context, expected->glyphcount, actual->glyphcount); } else if ((expected->kind & DRAW_KINDS_MASK) == DRAW_UNDERLINE) { int cmp = lstrcmpW(expected->locale, actual->locale); @@ -579,6 +602,8 @@ static HRESULT WINAPI testrenderer_DrawGlyphRun(IDWriteTextRenderer *iface, entry.kind = DRAW_GLYPHRUN; if (effect) entry.kind |= DRAW_EFFECT; + lstrcpyW(entry.locale, descr->localeName); + entry.glyphcount = run->glyphCount; add_call(sequences, RENDERER_ID, &entry); return S_OK; } @@ -1173,7 +1198,7 @@ static void test_GetLocaleName(void) } static const struct drawcall_entry drawellipsis_seq[] = { - { DRAW_GLYPHRUN, {0x2026, 0} }, + { DRAW_GLYPHRUN, {0x2026, 0}, {'e','n','-','u','s',0}, 1 }, { DRAW_LAST_KIND } }; @@ -1488,10 +1513,10 @@ static void test_SetInlineObject(void) /* drawing calls sequence doesn't depend on run order, instead all runs are drawn first, inline objects next and then underline/strikes */ static const struct drawcall_entry draw_seq[] = { - { DRAW_GLYPHRUN, {'s',0} }, - { DRAW_GLYPHRUN, {'r','i',0} }, - { DRAW_GLYPHRUN|DRAW_EFFECT, {'n',0} }, - { DRAW_GLYPHRUN, {'g',0} }, + { DRAW_GLYPHRUN, {'s',0}, {'r','u',0}, 1 }, + { DRAW_GLYPHRUN, {'r','i',0}, {'r','u',0}, 2 }, + { DRAW_GLYPHRUN|DRAW_EFFECT, {'n',0}, {'r','u',0}, 1 }, + { DRAW_GLYPHRUN, {'g',0}, {'r','u',0}, 1 }, { DRAW_INLINE }, { DRAW_UNDERLINE, {0}, {'r','u',0} }, { DRAW_STRIKETHROUGH }, @@ -1499,32 +1524,32 @@ static const struct drawcall_entry draw_seq[] = { }; static const struct drawcall_entry draw_seq2[] = { - { DRAW_GLYPHRUN, {'s',0} }, - { DRAW_GLYPHRUN, {'t',0} }, - { DRAW_GLYPHRUN, {'r',0} }, - { DRAW_GLYPHRUN, {'i',0} }, - { DRAW_GLYPHRUN, {'n',0} }, - { DRAW_GLYPHRUN, {'g',0} }, + { DRAW_GLYPHRUN, {'s',0}, {'r','u',0}, 1 }, + { DRAW_GLYPHRUN, {'t',0}, {'r','u',0}, 1 }, + { DRAW_GLYPHRUN, {'r',0}, {'r','u',0}, 1 }, + { DRAW_GLYPHRUN, {'i',0}, {'r','u',0}, 1 }, + { DRAW_GLYPHRUN, {'n',0}, {'r','u',0}, 1 }, + { DRAW_GLYPHRUN, {'g',0}, {'r','u',0}, 1 }, { DRAW_LAST_KIND } }; static const struct drawcall_entry draw_seq3[] = { - { DRAW_GLYPHRUN, {0x202a,0x202c,0} }, - { DRAW_GLYPHRUN, {'a','b',0} }, + { DRAW_GLYPHRUN, {0x202a,0x202c,0}, {'r','u',0}, 0 }, + { DRAW_GLYPHRUN, {'a','b',0}, {'r','u',0}, 2 }, { DRAW_LAST_KIND } }; static const struct drawcall_entry draw_seq4[] = { - { DRAW_GLYPHRUN, {'s','t','r',0} }, - { DRAW_GLYPHRUN, {'i','n','g',0} }, + { DRAW_GLYPHRUN, {'s','t','r',0}, {'r','u',0}, 3 }, + { DRAW_GLYPHRUN, {'i','n','g',0}, {'r','u',0}, 3 }, { DRAW_STRIKETHROUGH }, { DRAW_LAST_KIND } }; static const struct drawcall_entry draw_seq5[] = { - { DRAW_GLYPHRUN, {'s','t',0} }, - { DRAW_GLYPHRUN, {'r','i',0} }, - { DRAW_GLYPHRUN, {'n','g',0} }, + { DRAW_GLYPHRUN, {'s','t',0}, {'r','u',0}, 2 }, + { DRAW_GLYPHRUN, {'r','i',0}, {'r','u',0}, 2 }, + { DRAW_GLYPHRUN, {'n','g',0}, {'r','u',0}, 2 }, { DRAW_STRIKETHROUGH }, { DRAW_LAST_KIND } }; @@ -1534,15 +1559,15 @@ static const struct drawcall_entry empty_seq[] = { }; static const struct drawcall_entry draw_single_run_seq[] = { - { DRAW_GLYPHRUN, {'s','t','r','i','n','g',0} }, + { DRAW_GLYPHRUN, {'s','t','r','i','n','g',0}, {'r','u',0}, 6 }, { DRAW_LAST_KIND } }; static const struct drawcall_entry draw_reordered_run_seq[] = { - { DRAW_GLYPHRUN, {'1','2','3','-','5','2',0} }, - { DRAW_GLYPHRUN, {0x64a,0x64f,0x633,0x627,0x648,0x650,0x64a,0} }, - { DRAW_GLYPHRUN, {'7','1',0} }, - { DRAW_GLYPHRUN, {'.',0} }, + { DRAW_GLYPHRUN, {'1','2','3','-','5','2',0}, {'r','u',0}, 6 }, + { DRAW_GLYPHRUN, {0x64a,0x64f,0x633,0x627,0x648,0x650,0x64a,0}, {'r','u',0}, 7 }, + { DRAW_GLYPHRUN, {'7','1',0}, {'r','u',0}, 2 }, + { DRAW_GLYPHRUN, {'.',0}, {'r','u',0}, 1 }, { DRAW_LAST_KIND } }; @@ -1601,7 +1626,7 @@ static void test_Draw(void) flush_sequence(sequences, RENDERER_ID); hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, 0.0, 0.0); ok(hr == S_OK, "got 0x%08x\n", hr); - ok_sequence(sequences, RENDERER_ID, draw_seq, "draw test", FALSE); + ok_sequence(sequences, RENDERER_ID, draw_seq, "draw test", TRUE); IDWriteTextLayout_Release(layout); /* with reduced width DrawGlyphRun() is called for every line */ @@ -3185,14 +3210,14 @@ static void test_SetFlowDirection(void) } static const struct drawcall_entry draweffect_seq[] = { - { DRAW_GLYPHRUN|DRAW_EFFECT, {'a','e',0x0300,0} }, - { DRAW_GLYPHRUN, {'d',0} }, + { DRAW_GLYPHRUN|DRAW_EFFECT, {'a','e',0x0300,0}, {'e','n','-','u','s',0}, 2 }, + { DRAW_GLYPHRUN, {'d',0}, {'e','n','-','u','s',0}, 1 }, { DRAW_LAST_KIND } }; static const struct drawcall_entry draweffect2_seq[] = { - { DRAW_GLYPHRUN|DRAW_EFFECT, {'a','e',0} }, - { DRAW_GLYPHRUN, {'c','d',0} }, + { DRAW_GLYPHRUN|DRAW_EFFECT, {'a','e',0}, {'e','n','-','u','s',0}, 2 }, + { DRAW_GLYPHRUN, {'c','d',0}, {'e','n','-','u','s',0}, 2 }, { DRAW_LAST_KIND } }; @@ -4837,30 +4862,30 @@ static void test_SetOpticalAlignment(void) } static const struct drawcall_entry drawunderline_seq[] = { - { DRAW_GLYPHRUN, {'a','e',0x0300,0} }, /* reported runs can't mix different underline values */ - { DRAW_GLYPHRUN, {'d',0} }, + { DRAW_GLYPHRUN, {'a','e',0x0300,0}, {'e','n','-','u','s',0}, 2 }, /* reported runs can't mix different underline values */ + { DRAW_GLYPHRUN, {'d',0}, {'e','n','-','u','s',0}, 1 }, { DRAW_UNDERLINE, {0}, {'e','n','-','u','s',0} }, { DRAW_LAST_KIND } }; static const struct drawcall_entry drawunderline2_seq[] = { - { DRAW_GLYPHRUN, {'a',0} }, - { DRAW_GLYPHRUN, {'e',0} }, + { DRAW_GLYPHRUN, {'a',0}, {'e','n','-','u','s',0}, 1 }, + { DRAW_GLYPHRUN, {'e',0}, {'e','n','-','u','s',0}, 1 }, { DRAW_UNDERLINE, {0}, {'e','n','-','u','s',0} }, { DRAW_LAST_KIND } }; static const struct drawcall_entry drawunderline3_seq[] = { - { DRAW_GLYPHRUN, {'a',0} }, - { DRAW_GLYPHRUN, {'e',0} }, + { DRAW_GLYPHRUN, {'a',0}, {'e','n','-','c','a',0}, 1 }, + { DRAW_GLYPHRUN, {'e',0}, {'e','n','-','u','s',0}, 1 }, { DRAW_UNDERLINE, {0}, {'e','n','-','c','a',0} }, { DRAW_UNDERLINE, {0}, {'e','n','-','u','s',0} }, { DRAW_LAST_KIND } }; static const struct drawcall_entry drawunderline4_seq[] = { - { DRAW_GLYPHRUN, {'a',0} }, - { DRAW_GLYPHRUN, {'e',0} }, + { DRAW_GLYPHRUN, {'a',0}, {'e','n','-','u','s',0}, 1 }, + { DRAW_GLYPHRUN, {'e',0}, {'e','n','-','u','s',0}, 1 }, { DRAW_UNDERLINE, {0}, {'e','n','-','u','s',0} }, { DRAW_STRIKETHROUGH }, { DRAW_LAST_KIND } @@ -4962,7 +4987,7 @@ todo_wine flush_sequence(sequences, RENDERER_ID); hr = IDWriteTextLayout_Draw(layout, NULL, &testrenderer, 0.0f, 0.0f); ok(hr == S_OK, "got 0x%08x\n", hr); - ok_sequence(sequences, RENDERER_ID, drawunderline4_seq, "draw underline test 4", FALSE); + ok_sequence(sequences, RENDERER_ID, drawunderline4_seq, "draw underline test 4", TRUE); IDWriteTextLayout_Release(layout);
1
0
0
0
Nikolay Sivov : dwrite: Allocate glyph buffer once per run rendering pass.
by Alexandre Julliard
30 Mar '17
30 Mar '17
Module: wine Branch: master Commit: 89d074a3fc063722fe45a3148ee3b55cb473d11d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=89d074a3fc063722fe45a3148…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Mar 30 15:07:00 2017 +0300 dwrite: Allocate glyph buffer once per run rendering pass. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/font.c | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index e50eda8..e89d0a8 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -180,6 +180,7 @@ struct dwrite_glyphrunanalysis { UINT8 flags; RECT bounds; BYTE *bitmap; + UINT32 max_glyph_bitmap_size; }; struct dwrite_colorglyphenum { @@ -4797,6 +4798,12 @@ static BOOL is_natural_rendering_mode(DWRITE_RENDERING_MODE1 mode) } } +static UINT32 get_glyph_bitmap_pitch(DWRITE_TEXTURE_TYPE type, INT width) +{ + return type == DWRITE_TEXTURE_CLEARTYPE_3x1 ? (width + 3) / 4 * 4 : + ((width + 31) >> 5) << 2; +} + static void glyphrunanalysis_get_texturebounds(struct dwrite_glyphrunanalysis *analysis, RECT *bounds) { struct dwrite_glyphbitmap glyph_bitmap; @@ -4836,10 +4843,16 @@ static void glyphrunanalysis_get_texturebounds(struct dwrite_glyphrunanalysis *a const D2D_POINT_2F *ascenderoffset = analysis->ascenderoffsets ? analysis->ascenderoffsets + i : NULL; const D2D_POINT_2F *advance = analysis->advances + i; RECT *bbox = &glyph_bitmap.bbox; + UINT32 bitmap_size; glyph_bitmap.index = analysis->run.glyphIndices[i]; freetype_get_glyph_bbox(&glyph_bitmap); + bitmap_size = get_glyph_bitmap_pitch(analysis->texture_type, bbox->right - bbox->left) * + (bbox->bottom - bbox->top); + if (bitmap_size > analysis->max_glyph_bitmap_size) + analysis->max_glyph_bitmap_size = bitmap_size; + if (is_rtl) OffsetRect(bbox, origin.x + advance->x, origin.y + advance->y); else @@ -4899,7 +4912,7 @@ static inline BYTE *get_pixel_ptr(BYTE *ptr, DWRITE_TEXTURE_TYPE type, const REC runbounds->left - bounds->left; } -static HRESULT glyphrunanalysis_render(struct dwrite_glyphrunanalysis *analysis, DWRITE_TEXTURE_TYPE type) +static HRESULT glyphrunanalysis_render(struct dwrite_glyphrunanalysis *analysis) { static const BYTE masks[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; struct dwrite_glyphbitmap glyph_bitmap; @@ -4917,11 +4930,11 @@ static HRESULT glyphrunanalysis_render(struct dwrite_glyphrunanalysis *analysis, } size = (analysis->bounds.right - analysis->bounds.left)*(analysis->bounds.bottom - analysis->bounds.top); - if (type == DWRITE_TEXTURE_CLEARTYPE_3x1) + if (analysis->texture_type == DWRITE_TEXTURE_CLEARTYPE_3x1) size *= 3; if (!(analysis->bitmap = heap_alloc_zero(size))) { WARN("Failed to allocate run bitmap, %s, type %s.\n", wine_dbgstr_rect(&analysis->bounds), - type == DWRITE_TEXTURE_CLEARTYPE_3x1 ? "3x1" : "1x1"); + analysis->texture_type == DWRITE_TEXTURE_CLEARTYPE_3x1 ? "3x1" : "1x1"); IDWriteFontFace4_Release(fontface); return E_OUTOFMEMORY; } @@ -4933,17 +4946,22 @@ static HRESULT glyphrunanalysis_render(struct dwrite_glyphrunanalysis *analysis, glyph_bitmap.fontface = fontface; glyph_bitmap.emsize = analysis->run.fontEmSize * analysis->ppdip; glyph_bitmap.nohint = is_natural_rendering_mode(analysis->rendering_mode); - glyph_bitmap.type = type; + glyph_bitmap.type = analysis->texture_type; if (analysis->flags & RUNANALYSIS_USE_TRANSFORM) glyph_bitmap.m = &analysis->m; + if (!(glyph_bitmap.buf = heap_alloc(analysis->max_glyph_bitmap_size))) { + IDWriteFontFace4_Release(fontface); + return E_OUTOFMEMORY; + } + bbox = &glyph_bitmap.bbox; for (i = 0; i < analysis->run.glyphCount; i++) { const D2D_POINT_2F *advanceoffset = analysis->advanceoffsets ? analysis->advanceoffsets + i : NULL; const D2D_POINT_2F *ascenderoffset = analysis->ascenderoffsets ? analysis->ascenderoffsets + i : NULL; const D2D_POINT_2F *advance = analysis->advances + i; + BYTE *src = glyph_bitmap.buf, *dst; int x, y, width, height; - BYTE *src, *dst; BOOL is_1bpp; glyph_bitmap.index = analysis->run.glyphIndices[i]; @@ -4958,12 +4976,8 @@ static HRESULT glyphrunanalysis_render(struct dwrite_glyphrunanalysis *analysis, width = bbox->right - bbox->left; height = bbox->bottom - bbox->top; - if (type == DWRITE_TEXTURE_CLEARTYPE_3x1) - glyph_bitmap.pitch = (width + 3) / 4 * 4; - else - glyph_bitmap.pitch = ((width + 31) >> 5) << 2; - - glyph_bitmap.buf = src = heap_alloc_zero(height * glyph_bitmap.pitch); + glyph_bitmap.pitch = get_glyph_bitmap_pitch(analysis->texture_type, width); + memset(src, 0, height * glyph_bitmap.pitch); is_1bpp = freetype_get_glyph_bitmap(&glyph_bitmap); if (is_rtl) @@ -4979,11 +4993,11 @@ static HRESULT glyphrunanalysis_render(struct dwrite_glyphrunanalysis *analysis, OffsetRect(bbox, analysis->m.dx, analysis->m.dy); /* blit to analysis bitmap */ - dst = get_pixel_ptr(analysis->bitmap, type, bbox, &analysis->bounds); + dst = get_pixel_ptr(analysis->bitmap, analysis->texture_type, bbox, &analysis->bounds); if (is_1bpp) { /* convert 1bpp to 8bpp/24bpp */ - if (type == DWRITE_TEXTURE_CLEARTYPE_3x1) { + if (analysis->texture_type == DWRITE_TEXTURE_CLEARTYPE_3x1) { for (y = 0; y < height; y++) { for (x = 0; x < width; x++) if (src[x / 8] & masks[x % 8]) @@ -5012,11 +5026,10 @@ static HRESULT glyphrunanalysis_render(struct dwrite_glyphrunanalysis *analysis, } } - heap_free(glyph_bitmap.buf); - origin.x += advance->x; origin.y += advance->y; } + heap_free(glyph_bitmap.buf); IDWriteFontFace4_Release(fontface); @@ -5076,7 +5089,7 @@ static HRESULT WINAPI glyphrunanalysis_CreateAlphaTexture(IDWriteGlyphRunAnalysi if (!(This->flags & RUNANALYSIS_BITMAP_READY)) { HRESULT hr; - if (FAILED(hr = glyphrunanalysis_render(This, type))) + if (FAILED(hr = glyphrunanalysis_render(This))) return hr; }
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
72
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
Results per page:
10
25
50
100
200