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
April 2022
----- 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
1024 discussions
Start a n
N
ew thread
Biswapriyo Nath : include: Add Windows.Storage.Streams.Buffer runtimeclass declaration.
by Alexandre Julliard
28 Apr '22
28 Apr '22
Module: wine Branch: master Commit: 842115bbb874f7a2d3c8e8db2430fa3b1b8f16a1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=842115bbb874f7a2d3c8e8db…
Author: Biswapriyo Nath <nathbappai(a)gmail.com> Date: Thu Apr 28 14:20:35 2022 +0200 include: Add Windows.Storage.Streams.Buffer runtimeclass declaration. Signed-off-by: Biswapriyo Nath <nathbappai(a)gmail.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/windows.storage.streams.idl | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/include/windows.storage.streams.idl b/include/windows.storage.streams.idl index ba58e74687d..bb107b25976 100644 --- a/include/windows.storage.streams.idl +++ b/include/windows.storage.streams.idl @@ -25,11 +25,50 @@ import "eventtoken.idl"; import "windows.foundation.idl"; namespace Windows.Storage.Streams { + interface IBuffer; + interface IBufferFactory; + interface IBufferStatics; interface IContentTypeProvider; interface IInputStream; interface IOutputStream; interface IRandomAccessStream; interface IRandomAccessStreamWithContentType; + runtimeclass Buffer; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + uuid(905a0fe0-bc53-11df-8c49-001e4fc686da) + ] + interface IBuffer : IInspectable + { + [propget] HRESULT Capacity([out, retval] UINT32 *value); + [propget] HRESULT Length([out, retval] UINT32 *value); + [propput] HRESULT Length([in] UINT32 value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Storage.Streams.Buffer), + uuid(71af914d-c10f-484b-bc50-14bc623b3a27) + ] + interface IBufferFactory : IInspectable + { + HRESULT Create([in, range(0x00000000, 0x7fffffff)] UINT32 capacity, + [out, retval] Windows.Storage.Streams.Buffer **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Storage.Streams.Buffer), + uuid(e901e65b-d716-475a-a90a-af7229b1e741) + ] + interface IBufferStatics : IInspectable + { + HRESULT CreateCopyFromMemoryBuffer([in] Windows.Foundation.IMemoryBuffer *input, + [out, retval] Windows.Storage.Streams.Buffer **value); + HRESULT CreateMemoryBufferOverIBuffer([in] Windows.Storage.Streams.IBuffer *input, + [out, retval] Windows.Foundation.MemoryBuffer **value); + } [ uuid(cc254827-4b3d-438f-9232-10c76bc7e038), @@ -43,4 +82,16 @@ namespace Windows.Storage.Streams { Windows.Storage.Streams.IContentTypeProvider { } + + [ + activatable(Windows.Storage.Streams.IBufferFactory, Windows.Foundation.UniversalApiContract, 1.0), + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + static(Windows.Storage.Streams.IBufferStatics, Windows.Foundation.UniversalApiContract, 1.0), + threading(both) + ] + runtimeclass Buffer + { + [default] interface Windows.Storage.Streams.IBuffer; + } }
1
0
0
0
Rémi Bernon : include: Use nested namespaces in windows.storage.streams.idl.
by Alexandre Julliard
28 Apr '22
28 Apr '22
Module: wine Branch: master Commit: 007e51719bb539c511bae174451fd4bd1fcf57e0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=007e51719bb539c511bae174…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Apr 28 14:20:34 2022 +0200 include: Use nested namespaces in windows.storage.streams.idl. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/windows.storage.streams.idl | 56 +++++++++++-------------------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/include/windows.storage.streams.idl b/include/windows.storage.streams.idl index 59b15761af0..ba58e74687d 100644 --- a/include/windows.storage.streams.idl +++ b/include/windows.storage.streams.idl @@ -24,47 +24,23 @@ import "inspectable.idl"; import "eventtoken.idl"; import "windows.foundation.idl"; -namespace Windows -{ - namespace Foundation - { - interface IClosable; - } -} - -namespace Windows -{ - namespace Storage - { - namespace Streams - { - interface IContentTypeProvider; - interface IInputStream; - interface IOutputStream; - interface IRandomAccessStream; - interface IRandomAccessStreamWithContentType; - } - } -} +namespace Windows.Storage.Streams { + interface IContentTypeProvider; + interface IInputStream; + interface IOutputStream; + interface IRandomAccessStream; + interface IRandomAccessStreamWithContentType; -namespace Windows -{ - namespace Storage + [ + uuid(cc254827-4b3d-438f-9232-10c76bc7e038), + ] + interface IRandomAccessStreamWithContentType : IInspectable + requires + Windows.Storage.Streams.IRandomAccessStream, + Windows.Foundation.IClosable, + Windows.Storage.Streams.IInputStream, + Windows.Storage.Streams.IOutputStream, + Windows.Storage.Streams.IContentTypeProvider { - namespace Streams - { - [ - uuid(cc254827-4b3d-438f-9232-10c76bc7e038), - ] - interface IRandomAccessStreamWithContentType : IInspectable - requires - Windows.Storage.Streams.IRandomAccessStream, - Windows.Foundation.IClosable, - Windows.Storage.Streams.IInputStream, - Windows.Storage.Streams.IOutputStream, - Windows.Storage.Streams.IContentTypeProvider - { - } - } } }
1
0
0
0
Jacek Caban : winex11: Directly use ntdll for utf8 conversion.
by Alexandre Julliard
28 Apr '22
28 Apr '22
Module: wine Branch: master Commit: bd721f037144f8a9e31e841fd9c34c1662f5810b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bd721f037144f8a9e31e841f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Apr 28 12:26:04 2022 +0200 winex11: Directly use ntdll for utf8 conversion. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/clipboard.c | 11 +++++------ dlls/winex11.drv/window.c | 7 ++++--- dlls/winex11.drv/xrandr.c | 8 ++++++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 1dcd5362c8c..f9e6764fc0a 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -914,12 +914,11 @@ static void *import_text_html( Atom type, const void *data, size_t size, size_t /* Firefox uses UTF-16LE with byte order mark. Convert to UTF-8 without the BOM. */ if (size >= sizeof(WCHAR) && ((const WCHAR *)data)[0] == 0xfeff) { - len = WideCharToMultiByte( CP_UTF8, 0, (const WCHAR *)data + 1, size / sizeof(WCHAR) - 1, - NULL, 0, NULL, NULL ); - if (!(text = malloc( len ))) return 0; - WideCharToMultiByte( CP_UTF8, 0, (const WCHAR *)data + 1, size / sizeof(WCHAR) - 1, - text, len, NULL, NULL ); - size = len; + DWORD str_len; + RtlUnicodeToUTF8N( NULL, 0, &str_len, (const WCHAR *)data + 1, size - sizeof(WCHAR) ); + if (!(text = malloc( str_len ))) return NULL; + RtlUnicodeToUTF8N( text, str_len, &str_len, (const WCHAR *)data + 1, size - sizeof(WCHAR) ); + size = str_len; data = text; } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index d7027032465..3b0ccd8d22a 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -437,22 +437,23 @@ static void sync_window_opacity( Display *display, Window win, */ static void sync_window_text( Display *display, Window win, const WCHAR *text ) { - UINT count; + DWORD count, len; char *buffer, *utf8_buffer; XTextProperty prop; /* allocate new buffer for window text */ + len = lstrlenW( text ); count = WideCharToMultiByte(CP_UNIXCP, 0, text, -1, NULL, 0, NULL, NULL); if (!(buffer = malloc( count ))) return; WideCharToMultiByte(CP_UNIXCP, 0, text, -1, buffer, count, NULL, NULL); - count = WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), NULL, 0, NULL, NULL); + RtlUnicodeToUTF8N( NULL, 0, &count, text, len * sizeof(WCHAR) ); if (!(utf8_buffer = malloc( count ))) { free( buffer ); return; } - WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), utf8_buffer, count, NULL, NULL); + RtlUnicodeToUTF8N( utf8_buffer, count, &count, text, len * sizeof(WCHAR) ); if (XmbTextListToTextProperty( display, &buffer, 1, XStdICCTextStyle, &prop ) == Success) { diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index b0619c0abcd..6ede776d76b 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -652,6 +652,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid VkPhysicalDeviceIDProperties id; VkInstance vk_instance = NULL; VkDisplayKHR vk_display; + DWORD len; BOOL ret = FALSE; VkResult vr; @@ -723,7 +724,8 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid gpu->vendor_id = properties2.properties.vendorID; gpu->device_id = properties2.properties.deviceID; } - MultiByteToWideChar( CP_UTF8, 0, properties2.properties.deviceName, -1, gpu->name, ARRAY_SIZE(gpu->name) ); + RtlUTF8ToUnicodeN( gpu->name, sizeof(gpu->name), &len, properties2.properties.deviceName, + strlen( properties2.properties.deviceName ) + 1 ); ret = TRUE; goto done; } @@ -749,6 +751,7 @@ static BOOL xrandr14_get_gpus2( struct gdi_gpu **new_gpus, int *count, BOOL get_ INT primary_provider = -1; RECT primary_rect; BOOL ret = FALSE; + DWORD len; INT i, j; screen_resources = xrandr_get_screen_resources(); @@ -803,7 +806,8 @@ static BOOL xrandr14_get_gpus2( struct gdi_gpu **new_gpus, int *count, BOOL get_ if (get_properties) { if (!get_gpu_properties_from_vulkan( &gpus[i], provider_info )) - MultiByteToWideChar( CP_UTF8, 0, provider_info->name, -1, gpus[i].name, ARRAY_SIZE(gpus[i].name) ); + RtlUTF8ToUnicodeN( gpus[i].name, sizeof(gpus[i].name), &len, provider_info->name, + strlen( provider_info->name ) + 1 ); /* FIXME: Add an alternate method of getting PCI IDs, for systems that don't support Vulkan */ } pXRRFreeProviderInfo( provider_info );
1
0
0
0
Jacek Caban : winex11: Move Unicode conversion out of string_from_unicode_text.
by Alexandre Julliard
28 Apr '22
28 Apr '22
Module: wine Branch: master Commit: 6afcd71a82fdbbaf61f2e83ef1eeb9f50cc67642 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6afcd71a82fdbbaf61f2e83e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Apr 28 12:04:32 2022 +0200 winex11: Move Unicode conversion out of string_from_unicode_text. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/clipboard.c | 68 +++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index ce936f9012e..1dcd5362c8c 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -729,9 +729,11 @@ static void *import_utf8_string( Atom type, const void *data, size_t size, size_ DWORD str_size; WCHAR *ret; - if (!(ret = malloc( (size * 2 + 1) * sizeof(WCHAR) ))) return NULL; - RtlUTF8ToUnicodeN( ret + size, size * sizeof(WCHAR), &str_size, data, size ); - return unicode_text_from_string( ret, ret + size, str_size / sizeof(WCHAR), ret_size ); + RtlUTF8ToUnicodeN( NULL, 0, &str_size, data, size ); + if (!(ret = malloc( str_size * 2 + sizeof(WCHAR) ))) return NULL; + RtlUTF8ToUnicodeN( ret + str_size / sizeof(WCHAR), str_size, &str_size, data, size ); + return unicode_text_from_string( ret, ret + str_size / sizeof(WCHAR), + str_size / sizeof(WCHAR), ret_size ); } @@ -1198,31 +1200,19 @@ static BOOL export_data( Display *display, Window win, Atom prop, Atom target, v * * Convert CF_UNICODETEXT data to a string in the specified codepage. */ -static char *string_from_unicode_text( UINT codepage, const WCHAR *string, size_t string_size, size_t *size ) +static void string_from_unicode_text( char *str, size_t len, DWORD *size ) { - UINT i, j; - char *str; - UINT lenW = string_size / sizeof(WCHAR); - DWORD len; - - if (!string_size) return NULL; + DWORD i, j; - len = WideCharToMultiByte( codepage, 0, string, lenW, NULL, 0, NULL, NULL ); - if ((str = malloc( len ))) + /* remove carriage returns */ + for (i = j = 0; i < len; i++) { - WideCharToMultiByte( codepage, 0, string, lenW, str, len, NULL, NULL); - - /* remove carriage returns */ - for (i = j = 0; i < len; i++) - { - if (str[i] == '\r' && (i == len - 1 || str[i + 1] == '\n')) continue; - str[j++] = str[i]; - } - while (j && !str[j - 1]) j--; /* remove trailing nulls */ - *size = j; - TRACE( "returning %s\n", debugstr_an( str, j )); + if (str[i] == '\r' && (i == len - 1 || str[i + 1] == '\n')) continue; + str[j++] = str[i]; } - return str; + while (j && !str[j - 1]) j--; /* remove trailing nulls */ + TRACE( "returning %s\n", debugstr_an( str, j )); + *size = j; } @@ -1233,10 +1223,14 @@ static char *string_from_unicode_text( UINT codepage, const WCHAR *string, size_ */ static BOOL export_string( Display *display, Window win, Atom prop, Atom target, void *data, size_t size ) { - char *text = string_from_unicode_text( 28591, data, size, &size ); + DWORD len; + char *text; + + if (!(text = malloc( size ))) return FALSE; + len = WideCharToMultiByte( 28591, 0, data, size / sizeof(WCHAR), text, size, NULL, NULL ); + string_from_unicode_text( text, len, &len ); - if (!text) return FALSE; - put_property( display, win, prop, target, 8, text, size ); + put_property( display, win, prop, target, 8, text, len ); free( text ); return TRUE; } @@ -1250,10 +1244,14 @@ static BOOL export_string( Display *display, Window win, Atom prop, Atom target, static BOOL export_utf8_string( Display *display, Window win, Atom prop, Atom target, void *data, size_t size ) { - char *text = string_from_unicode_text( CP_UTF8, data, size, &size ); + DWORD len; + char *text; + + if (!(text = malloc( size / sizeof(WCHAR) * 3 ))) return FALSE; + RtlUnicodeToUTF8N( text, size / sizeof(WCHAR) * 3, &len, data, size ); + string_from_unicode_text( text, len, &len ); - if (!text) return FALSE; - put_property( display, win, prop, target, 8, text, size ); + put_property( display, win, prop, target, 8, text, len ); free( text ); return TRUE; } @@ -1280,9 +1278,15 @@ static BOOL export_compound_text( Display *display, Window win, Atom prop, Atom { XTextProperty textprop; XICCEncodingStyle style; - char *text = string_from_unicode_text( CP_UNIXCP, data, size, &size ); + DWORD len; + char *text; + + + if (!(text = malloc( size / sizeof(WCHAR) * 3 ))) return FALSE; + len = WideCharToMultiByte( CP_UNIXCP, 0, data, size / sizeof(WCHAR), + text, size / sizeof(WCHAR) * 3, NULL, NULL ); + string_from_unicode_text( text, len, &len ); - if (!text) return FALSE; if (target == x11drv_atom(COMPOUND_TEXT)) style = XCompoundTextStyle; else
1
0
0
0
Jacek Caban : winex11: Move Unicode conversion out of unicode_text_from_string.
by Alexandre Julliard
28 Apr '22
28 Apr '22
Module: wine Branch: master Commit: 56f1ed6a2a852376e0fbdecdbd7b332b26a6cf78 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=56f1ed6a2a852376e0fbdecd…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Apr 28 11:40:39 2022 +0200 winex11: Move Unicode conversion out of unicode_text_from_string. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/clipboard.c | 45 ++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 6baa87c5ce1..ce936f9012e 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -687,25 +687,19 @@ static WCHAR* uri_to_dos(char *encodedURI) * * Convert a string in the specified encoding to CF_UNICODETEXT format. */ -static WCHAR *unicode_text_from_string( UINT codepage, const void *data, size_t size, size_t *ret_size ) +static void *unicode_text_from_string( WCHAR *ret, const WCHAR *string, DWORD count, size_t *size ) { - DWORD i, j, count; - WCHAR *strW; + DWORD i, j; - count = MultiByteToWideChar( codepage, 0, data, size, NULL, 0); - - if (!(strW = malloc( (count * 2 + 1) * sizeof(WCHAR) ))) return 0; - - MultiByteToWideChar( codepage, 0, data, size, strW + count, count ); for (i = j = 0; i < count; i++) { - if (strW[i + count] == '\n' && (!i || strW[i + count - 1] != '\r')) strW[j++] = '\r'; - strW[j++] = strW[i + count]; + if (string[i] == '\n' && (!i || string[i - 1] != '\r')) ret[j++] = '\r'; + ret[j++] = string[i]; } - strW[j++] = 0; - *ret_size = j * sizeof(WCHAR); - TRACE( "returning %s\n", debugstr_wn( strW, j - 1 )); - return strW; + ret[j++] = 0; + *size = j * sizeof(WCHAR); + TRACE( "returning %s\n", debugstr_wn( ret, j - 1 )); + return ret; } @@ -716,7 +710,12 @@ static WCHAR *unicode_text_from_string( UINT codepage, const void *data, size_t */ static void *import_string( Atom type, const void *data, size_t size, size_t *ret_size ) { - return unicode_text_from_string( 28591, data, size, ret_size ); + DWORD str_size; + WCHAR *ret; + + if (!(ret = malloc( (size * 2 + 1) * sizeof(WCHAR) ))) return NULL; + str_size = MultiByteToWideChar( 28591, 0, data, size, ret + size, size ); + return unicode_text_from_string( ret, ret + size, str_size, ret_size ); } @@ -727,7 +726,12 @@ static void *import_string( Atom type, const void *data, size_t size, size_t *re */ static void *import_utf8_string( Atom type, const void *data, size_t size, size_t *ret_size ) { - return unicode_text_from_string( CP_UTF8, data, size, ret_size ); + DWORD str_size; + WCHAR *ret; + + if (!(ret = malloc( (size * 2 + 1) * sizeof(WCHAR) ))) return NULL; + RtlUTF8ToUnicodeN( ret + size, size * sizeof(WCHAR), &str_size, data, size ); + return unicode_text_from_string( ret, ret + size, str_size / sizeof(WCHAR), ret_size ); } @@ -741,7 +745,8 @@ static void *import_compound_text( Atom type, const void *data, size_t size, siz char** srcstr; int count; XTextProperty txtprop; - void *ret; + DWORD len; + WCHAR *ret; txtprop.value = (BYTE *)data; txtprop.nitems = size; @@ -750,7 +755,11 @@ static void *import_compound_text( Atom type, const void *data, size_t size, siz if (XmbTextPropertyToTextList( thread_display(), &txtprop, &srcstr, &count ) != Success) return 0; if (!count) return 0; - ret = unicode_text_from_string( CP_UNIXCP, srcstr[0], strlen(srcstr[0]) + 1, ret_size ); + len = strlen(srcstr[0]) + 1; + if (!(ret = malloc( (len * 2 + 1) * sizeof(WCHAR) ))) return NULL; + count = MultiByteToWideChar( CP_UNIXCP, 0, srcstr[0], len, ret + len, len ); + ret = unicode_text_from_string( ret, ret + len, count, ret_size ); + XFreeStringList(srcstr); return ret; }
1
0
0
0
Jacek Caban : winex11: Use inline intersect_rect helper instead of IntersectRect.
by Alexandre Julliard
28 Apr '22
28 Apr '22
Module: wine Branch: master Commit: aa9072998fa3be07494a763fafe6a98e24edc593 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=aa9072998fa3be07494a763f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sun Apr 17 21:52:34 2022 +0200 winex11: Use inline intersect_rect helper instead of IntersectRect. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/bitblt.c | 2 +- dlls/winex11.drv/display.c | 4 ++-- dlls/winex11.drv/init.c | 2 +- dlls/winex11.drv/settings.c | 2 +- dlls/winex11.drv/window.c | 4 ++-- dlls/winex11.drv/x11drv.h | 9 +++++++++ 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 550c5f06f37..e21f975ef4a 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1912,7 +1912,7 @@ static void x11drv_surface_flush( struct window_surface *window_surface ) coords.width = surface->header.rect.right - surface->header.rect.left; coords.height = surface->header.rect.bottom - surface->header.rect.top; SetRect( &coords.visrect, 0, 0, coords.width, coords.height ); - if (IntersectRect( &coords.visrect, &coords.visrect, &surface->bounds )) + if (intersect_rect( &coords.visrect, &coords.visrect, &surface->bounds )) { TRACE( "flushing %p %dx%d bounds %s bits %p\n", surface, coords.width, coords.height, diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index f90cc455c36..aef4ed0b5b0 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -124,7 +124,7 @@ RECT get_work_area(const RECT *monitor_rect) work_rect.right = work_rect.left + work_area[i * 4 + 2]; work_rect.bottom = work_rect.top + work_area[i * 4 + 3]; - if (IntersectRect(&work_rect, &work_rect, monitor_rect)) + if (intersect_rect( &work_rect, &work_rect, monitor_rect )) { TRACE("work_rect:%s.\n", wine_dbgstr_rect(&work_rect)); XFree(work_area); @@ -146,7 +146,7 @@ RECT get_work_area(const RECT *monitor_rect) SetRect(&work_rect, work_area[0], work_area[1], work_area[0] + work_area[2], work_area[1] + work_area[3]); - if (IntersectRect(&work_rect, &work_rect, monitor_rect)) + if (intersect_rect( &work_rect, &work_rect, monitor_rect )) { TRACE("work_rect:%s.\n", wine_dbgstr_rect(&work_rect)); XFree(work_area); diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 9c5c394581b..27e070ef9b4 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -147,7 +147,7 @@ void add_device_bounds( X11DRV_PDEVICE *dev, const RECT *rect ) if (!dev->bounds) return; if (dev->region && NtGdiGetRgnBox( dev->region, &rc )) { - if (IntersectRect( &rc, &rc, rect )) add_bounds_rect( dev->bounds, &rc ); + if (intersect_rect( &rc, &rc, rect )) add_bounds_rect( dev->bounds, &rc ); } else add_bounds_rect( dev->bounds, rect ); } diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c index 652dedce601..44c61776b4b 100644 --- a/dlls/winex11.drv/settings.c +++ b/dlls/winex11.drv/settings.c @@ -709,7 +709,7 @@ static BOOL overlap_placed_displays(const RECT *rect, const struct x11drv_displa for (display_idx = 0; display_idx < display_count; ++display_idx) { if (displays[display_idx].placed && - IntersectRect(&intersect, &displays[display_idx].new_rect, rect)) + intersect_rect(&intersect, &displays[display_idx].new_rect, rect)) return TRUE; } return FALSE; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 6771368671a..d7027032465 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2309,7 +2309,7 @@ static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rec { *surface_rect = NtUserGetVirtualScreenRect(); - if (!IntersectRect( surface_rect, surface_rect, visible_rect )) return FALSE; + if (!intersect_rect( surface_rect, surface_rect, visible_rect )) return FALSE; OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top ); surface_rect->left &= ~31; surface_rect->top &= ~31; @@ -2761,7 +2761,7 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, if (info->prcDirty) { - IntersectRect( &rect, &rect, info->prcDirty ); + intersect_rect( &rect, &rect, info->prcDirty ); memcpy( src_bits, dst_bits, bmi->bmiHeader.biSizeImage ); NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS ); } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 69aa69404f4..4576564fda3 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -885,6 +885,15 @@ static inline HWND get_active_window(void) return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) ? info.hwndActive : 0; } +static inline BOOL intersect_rect( RECT *dst, const RECT *src1, const RECT *src2 ) +{ + dst->left = max( src1->left, src2->left ); + dst->top = max( src1->top, src2->top ); + dst->right = min( src1->right, src2->right ); + dst->bottom = min( src1->bottom, src2->bottom ); + return !IsRectEmpty( dst ); +} + /* registry helpers */ extern HKEY open_hkcu_key( const char *name ) DECLSPEC_HIDDEN;
1
0
0
0
Jacek Caban : winex11: Move XdndLeave event handler to event.c.
by Alexandre Julliard
28 Apr '22
28 Apr '22
Module: wine Branch: master Commit: ace09cf315dba49913eb3e2eec12e4d7b482885b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ace09cf315dba49913eb3e2e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sun Apr 24 22:36:32 2022 +0200 winex11: Move XdndLeave event handler to event.c. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/event.c | 9 ++++++++- dlls/winex11.drv/unixlib.h | 1 + dlls/winex11.drv/x11drv.h | 1 - dlls/winex11.drv/xdnd.c | 6 +++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index a02f0340010..729a0a7eab6 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1920,6 +1920,13 @@ static void handle_xdnd_drop_event( HWND hwnd, XClientMessageEvent *event ) } +static void handle_xdnd_leave_event( HWND hwnd, XClientMessageEvent *event ) +{ + UINT type = DND_LEAVE_EVENT; + handle_dnd_event( &type ); +} + + struct client_message_handler { int atom; /* protocol atom */ @@ -1935,7 +1942,7 @@ static const struct client_message_handler client_messages[] = { XATOM_XdndEnter, handle_xdnd_enter_event }, { XATOM_XdndPosition, handle_xdnd_position_event }, { XATOM_XdndDrop, handle_xdnd_drop_event }, - { XATOM_XdndLeave, X11DRV_XDND_LeaveEvent } + { XATOM_XdndLeave, handle_xdnd_leave_event } }; diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 41120385e60..537a8e0326a 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -31,6 +31,7 @@ struct format_entry enum dnd_event_type { DND_DROP_EVENT, + DND_LEAVE_EVENT, DND_POSITION_EVENT, }; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index c17dc45594c..69aa69404f4 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -294,7 +294,6 @@ extern BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp, DWORD dwReadLen) DECLSPEC_HIDDEN; extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultlen) DECLSPEC_HIDDEN; -extern void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void handle_dnd_enter_event( struct format_entry *formats, ULONG size ) DECLSPEC_HIDDEN; extern UINT handle_dnd_event( void *params ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c index 9de0b60d0cd..8240bbbf5d6 100644 --- a/dlls/winex11.drv/xdnd.c +++ b/dlls/winex11.drv/xdnd.c @@ -342,7 +342,7 @@ static DWORD handle_drop_event( struct dnd_drop_event_params *params ) * * Handle an XdndLeave event. */ -void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) +static NTSTATUS handle_leave_event(void) { IDropTarget *dropTarget; @@ -362,6 +362,7 @@ void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) } X11DRV_XDND_FreeDragDropOp(); + return 0; } @@ -736,6 +737,9 @@ UINT handle_dnd_event( void *params ) case DND_DROP_EVENT: return handle_drop_event( params ); + case DND_LEAVE_EVENT: + return handle_leave_event(); + case DND_POSITION_EVENT: return handle_position_event( params );
1
0
0
0
Jacek Caban : winex11: Move XdndDrop event handler to event.c.
by Alexandre Julliard
28 Apr '22
28 Apr '22
Module: wine Branch: master Commit: e510f8650e843c7735675184f5b7a28be27dfc8a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e510f8650e843c7735675184…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sun Apr 24 22:33:34 2022 +0200 winex11: Move XdndDrop event handler to event.c. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/event.c | 26 +++++++++++++++++++++++++- dlls/winex11.drv/unixlib.h | 8 ++++++++ dlls/winex11.drv/x11drv.h | 1 - dlls/winex11.drv/xdnd.c | 42 ++++++------------------------------------ 4 files changed, 39 insertions(+), 38 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 2bfcd3211ae..a02f0340010 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1896,6 +1896,30 @@ static void handle_xdnd_position_event( HWND hwnd, XClientMessageEvent *event ) } +static void handle_xdnd_drop_event( HWND hwnd, XClientMessageEvent *event ) +{ + struct dnd_drop_event_params params; + XClientMessageEvent e; + DWORD effect; + + params.type = DND_DROP_EVENT; + params.hwnd = hwnd; + effect = handle_dnd_event( ¶ms ); + + /* Tell the target we are finished. */ + memset( &e, 0, sizeof(e) ); + e.type = ClientMessage; + e.display = event->display; + e.window = event->data.l[0]; + e.message_type = x11drv_atom(XdndFinished); + e.format = 32; + e.data.l[0] = event->window; + e.data.l[1] = !!effect; + e.data.l[2] = drop_effect_to_xdnd_action( effect ); + XSendEvent( event->display, event->data.l[0], False, NoEventMask, (XEvent *)&e ); +} + + struct client_message_handler { int atom; /* protocol atom */ @@ -1910,7 +1934,7 @@ static const struct client_message_handler client_messages[] = { XATOM_DndProtocol, handle_dnd_protocol }, { XATOM_XdndEnter, handle_xdnd_enter_event }, { XATOM_XdndPosition, handle_xdnd_position_event }, - { XATOM_XdndDrop, X11DRV_XDND_DropEvent }, + { XATOM_XdndDrop, handle_xdnd_drop_event }, { XATOM_XdndLeave, X11DRV_XDND_LeaveEvent } }; diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 7f8ec28b7cf..41120385e60 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -30,9 +30,17 @@ struct format_entry enum dnd_event_type { + DND_DROP_EVENT, DND_POSITION_EVENT, }; +/* DND_DROP_EVENT params */ +struct dnd_drop_event_params +{ + UINT type; + HWND hwnd; +}; + /* DND_POSITION_EVENT params */ struct dnd_position_event_params { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index d49643a890b..c17dc45594c 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -294,7 +294,6 @@ extern BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp, DWORD dwReadLen) DECLSPEC_HIDDEN; extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultlen) DECLSPEC_HIDDEN; -extern void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void handle_dnd_enter_event( struct format_entry *formats, ULONG size ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c index 7633738917f..9de0b60d0cd 100644 --- a/dlls/winex11.drv/xdnd.c +++ b/dlls/winex11.drv/xdnd.c @@ -142,20 +142,6 @@ static IDropTarget* get_droptarget_pointer(HWND hwnd) return droptarget; } -/************************************************************************** - * X11DRV_XDND_DROPEFFECTToXdndAction - */ -static long X11DRV_XDND_DROPEFFECTToXdndAction(DWORD effect) -{ - if (effect == DROPEFFECT_COPY) - return x11drv_atom(XdndActionCopy); - else if (effect == DROPEFFECT_MOVE) - return x11drv_atom(XdndActionMove); - else if (effect == DROPEFFECT_LINK) - return x11drv_atom(XdndActionLink); - FIXME("unknown drop effect %u, assuming XdndActionCopy\n", effect); - return x11drv_atom(XdndActionCopy); -} /* Recursively searches for a window on given coordinates in a drag&drop specific manner. * @@ -278,14 +264,8 @@ static BOOL handle_position_event( struct dnd_position_event_params *params ) return accept ? effect : 0; } -/************************************************************************** - * X11DRV_XDND_DropEvent - * - * Handle an XdndDrop event. - */ -void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event ) +static DWORD handle_drop_event( struct dnd_drop_event_params *params ) { - XClientMessageEvent e; IDropTarget *dropTarget; DWORD effect = XDNDDropEffect; int accept = 0; /* Assume we're not accepting */ @@ -338,7 +318,7 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event ) /* Only send WM_DROPFILES if Drop didn't succeed or DROPEFFECT_NONE was set. * Doing both causes winamp to duplicate the dropped files (#29081) */ - HWND hwnd_drop = window_accepting_files(window_from_point_dnd(hWnd, XDNDxy)); + HWND hwnd_drop = window_accepting_files(window_from_point_dnd( params->hwnd, XDNDxy )); if (hwnd_drop && X11DRV_XDND_HasHDROP()) { @@ -354,20 +334,7 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event ) TRACE("effectRequested(0x%x) accept(%d) performed(0x%x) at x(%d),y(%d)\n", XDNDDropEffect, accept, effect, XDNDxy.x, XDNDxy.y); - /* Tell the target we are finished. */ - memset(&e, 0, sizeof(e)); - e.type = ClientMessage; - e.display = event->display; - e.window = event->data.l[0]; - e.message_type = x11drv_atom(XdndFinished); - e.format = 32; - e.data.l[0] = event->window; - e.data.l[1] = accept; - if (accept) - e.data.l[2] = X11DRV_XDND_DROPEFFECTToXdndAction(effect); - else - e.data.l[2] = None; - XSendEvent(event->display, event->data.l[0], False, NoEventMask, (XEvent*)&e); + return accept ? effect : 0; } /************************************************************************** @@ -766,6 +733,9 @@ UINT handle_dnd_event( void *params ) switch (*(UINT *)params) { + case DND_DROP_EVENT: + return handle_drop_event( params ); + case DND_POSITION_EVENT: return handle_position_event( params );
1
0
0
0
Jacek Caban : winex11: Move XdndPosition event handler to event.c.
by Alexandre Julliard
28 Apr '22
28 Apr '22
Module: wine Branch: master Commit: 1d337249f16ed61163315019f5dbbe4db3386390 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1d337249f16ed61163315019…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Apr 28 00:23:32 2022 +0200 winex11: Move XdndPosition event handler to event.c. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/event.c | 72 +++++++++++++++++++++++++++++++++++++++++++++- dlls/winex11.drv/unixlib.h | 43 +++++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 10 ++----- dlls/winex11.drv/xdnd.c | 70 ++++++++++++-------------------------------- 4 files changed, 135 insertions(+), 60 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index c8cd3fd5ef1..2bfcd3211ae 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1826,6 +1826,76 @@ static void handle_xdnd_enter_event( HWND hWnd, XClientMessageEvent *event ) } +static DWORD xdnd_action_to_drop_effect( long action ) +{ + /* In Windows, nothing but the given effects is allowed. + * In X the given action is just a hint, and you can always + * XdndActionCopy and XdndActionPrivate, so be more permissive. */ + if (action == x11drv_atom(XdndActionCopy)) + return DROPEFFECT_COPY; + else if (action == x11drv_atom(XdndActionMove)) + return DROPEFFECT_MOVE | DROPEFFECT_COPY; + else if (action == x11drv_atom(XdndActionLink)) + return DROPEFFECT_LINK | DROPEFFECT_COPY; + else if (action == x11drv_atom(XdndActionAsk)) + /* FIXME: should we somehow ask the user what to do here? */ + return DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_LINK; + + FIXME( "unknown action %ld, assuming DROPEFFECT_COPY\n", action ); + return DROPEFFECT_COPY; +} + + +static long drop_effect_to_xdnd_action( DWORD effect ) +{ + if (effect == DROPEFFECT_COPY) + return x11drv_atom(XdndActionCopy); + else if (effect == DROPEFFECT_MOVE) + return x11drv_atom(XdndActionMove); + else if (effect == DROPEFFECT_LINK) + return x11drv_atom(XdndActionLink); + else if (effect == DROPEFFECT_NONE) + return None; + + FIXME( "unknown drop effect %u, assuming XdndActionCopy\n", effect ); + return x11drv_atom(XdndActionCopy); +} + + +static void handle_xdnd_position_event( HWND hwnd, XClientMessageEvent *event ) +{ + struct dnd_position_event_params params; + XClientMessageEvent e; + DWORD effect; + + params.type = DND_POSITION_EVENT; + params.hwnd = hwnd; + params.point = root_to_virtual_screen( event->data.l[2] >> 16, event->data.l[2] & 0xFFFF ); + params.effect = effect = xdnd_action_to_drop_effect( event->data.l[4] ); + + effect = handle_dnd_event( ¶ms ); + + TRACE( "actionRequested(%ld) chosen(0x%x) at x(%d),y(%d)\n", + event->data.l[4], effect, params.point.x, params.point.y ); + + /* + * Let source know if we're accepting the drop by + * sending a status message. + */ + e.type = ClientMessage; + e.display = event->display; + e.window = event->data.l[0]; + e.message_type = x11drv_atom(XdndStatus); + e.format = 32; + e.data.l[0] = event->window; + e.data.l[1] = !!effect; + e.data.l[2] = 0; /* Empty Rect */ + e.data.l[3] = 0; /* Empty Rect */ + e.data.l[4] = drop_effect_to_xdnd_action( effect ); + XSendEvent( event->display, event->data.l[0], False, NoEventMask, (XEvent *)&e ); +} + + struct client_message_handler { int atom; /* protocol atom */ @@ -1839,7 +1909,7 @@ static const struct client_message_handler client_messages[] = { XATOM__XEMBED, handle_xembed_protocol }, { XATOM_DndProtocol, handle_dnd_protocol }, { XATOM_XdndEnter, handle_xdnd_enter_event }, - { XATOM_XdndPosition, X11DRV_XDND_PositionEvent }, + { XATOM_XdndPosition, handle_xdnd_position_event }, { XATOM_XdndDrop, X11DRV_XDND_DropEvent }, { XATOM_XdndLeave, X11DRV_XDND_LeaveEvent } }; diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h new file mode 100644 index 00000000000..7f8ec28b7cf --- /dev/null +++ b/dlls/winex11.drv/unixlib.h @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "ntuser.h" +#include "wine/unixlib.h" + +/* DnD support */ + +struct format_entry +{ + UINT format; + UINT size; + char data[1]; +}; + +enum dnd_event_type +{ + DND_POSITION_EVENT, +}; + +/* DND_POSITION_EVENT params */ +struct dnd_position_event_params +{ + UINT type; + HWND hwnd; + POINT point; + DWORD effect; +}; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 9339c1c08e6..d49643a890b 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -61,6 +61,7 @@ typedef int Status; #include "winbase.h" #include "ntgdi.h" #include "wine/gdi_driver.h" +#include "unixlib.h" #include "wine/list.h" #define MAX_DASHLEN 16 @@ -293,18 +294,11 @@ extern BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp, DWORD dwReadLen) DECLSPEC_HIDDEN; extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultlen) DECLSPEC_HIDDEN; -extern void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; -struct format_entry -{ - UINT format; - UINT size; - char data[1]; -}; - extern void handle_dnd_enter_event( struct format_entry *formats, ULONG size ) DECLSPEC_HIDDEN; +extern UINT handle_dnd_event( void *params ) DECLSPEC_HIDDEN; extern struct format_entry *import_xdnd_selection( Display *display, Window win, Atom selection, Atom *targets, UINT count, diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c index e56fc964ada..7633738917f 100644 --- a/dlls/winex11.drv/xdnd.c +++ b/dlls/winex11.drv/xdnd.c @@ -142,27 +142,6 @@ static IDropTarget* get_droptarget_pointer(HWND hwnd) return droptarget; } -/************************************************************************** - * X11DRV_XDND_XdndActionToDROPEFFECT - */ -static DWORD X11DRV_XDND_XdndActionToDROPEFFECT(long action) -{ - /* In Windows, nothing but the given effects is allowed. - * In X the given action is just a hint, and you can always - * XdndActionCopy and XdndActionPrivate, so be more permissive. */ - if (action == x11drv_atom(XdndActionCopy)) - return DROPEFFECT_COPY; - else if (action == x11drv_atom(XdndActionMove)) - return DROPEFFECT_MOVE | DROPEFFECT_COPY; - else if (action == x11drv_atom(XdndActionLink)) - return DROPEFFECT_LINK | DROPEFFECT_COPY; - else if (action == x11drv_atom(XdndActionAsk)) - /* FIXME: should we somehow ask the user what to do here? */ - return DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_LINK; - FIXME("unknown action %ld, assuming DROPEFFECT_COPY\n", action); - return DROPEFFECT_COPY; -} - /************************************************************************** * X11DRV_XDND_DROPEFFECTToXdndAction */ @@ -215,22 +194,17 @@ static HWND window_accepting_files(HWND hwnd) * * Handle an XdndPosition event. */ -void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event ) +static BOOL handle_position_event( struct dnd_position_event_params *params ) { - XClientMessageEvent e; int accept = 0; /* Assume we're not accepting */ IDropTarget *dropTarget = NULL; - DWORD effect; + DWORD effect = params->effect; POINTL pointl; HWND targetWindow; HRESULT hr; - XDNDxy = root_to_virtual_screen( event->data.l[2] >> 16, event->data.l[2] & 0xFFFF ); - targetWindow = window_from_point_dnd(hWnd, XDNDxy); - - pointl.x = XDNDxy.x; - pointl.y = XDNDxy.y; - effect = X11DRV_XDND_XdndActionToDROPEFFECT(event->data.l[4]); + XDNDxy = params->point; + targetWindow = window_from_point_dnd( params->hwnd, XDNDxy ); if (!XDNDAccepted || XDNDLastTargetWnd != targetWindow) { @@ -301,27 +275,7 @@ void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event ) } } - TRACE("actionRequested(%ld) accept(%d) chosen(0x%x) at x(%d),y(%d)\n", - event->data.l[4], accept, effect, XDNDxy.x, XDNDxy.y); - - /* - * Let source know if we're accepting the drop by - * sending a status message. - */ - e.type = ClientMessage; - e.display = event->display; - e.window = event->data.l[0]; - e.message_type = x11drv_atom(XdndStatus); - e.format = 32; - e.data.l[0] = event->window; - e.data.l[1] = accept; - e.data.l[2] = 0; /* Empty Rect */ - e.data.l[3] = 0; /* Empty Rect */ - if (accept) - e.data.l[4] = X11DRV_XDND_DROPEFFECTToXdndAction(effect); - else - e.data.l[4] = None; - XSendEvent(event->display, event->data.l[0], False, NoEventMask, (XEvent*)&e); + return accept ? effect : 0; } /************************************************************************** @@ -806,3 +760,17 @@ static IDataObjectVtbl xdndDataObjectVtbl = }; static IDataObject XDNDDataObject = { &xdndDataObjectVtbl }; + +UINT handle_dnd_event( void *params ) +{ + + switch (*(UINT *)params) + { + case DND_POSITION_EVENT: + return handle_position_event( params ); + + default: + ERR( "invalid event\n" ); + return 0; + } +}
1
0
0
0
Jacek Caban : winex11: Move XdndEnter event handler to event.c.
by Alexandre Julliard
28 Apr '22
28 Apr '22
Module: wine Branch: master Commit: 3b06509f4697803e214d5c7ad11c56c1ec89adf9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3b06509f4697803e214d5c7a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Apr 27 23:07:55 2022 +0200 winex11: Move XdndEnter event handler to event.c. In preparation for xdnd.c being in PE file. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/event.c | 76 ++++++++++++++++++++++++++++++++++++++++- dlls/winex11.drv/x11drv.h | 3 +- dlls/winex11.drv/xdnd.c | 86 ++--------------------------------------------- 3 files changed, 80 insertions(+), 85 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index e1bcd70d35a..c8cd3fd5ef1 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -49,6 +49,7 @@ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(event); +WINE_DECLARE_DEBUG_CHANNEL(xdnd); extern BOOL ximInComposeMode; @@ -1752,6 +1753,79 @@ static void handle_dnd_protocol( HWND hwnd, XClientMessageEvent *event ) } +/************************************************************************** + * handle_xdnd_enter_event + * + * Handle an XdndEnter event. + */ +static void handle_xdnd_enter_event( HWND hWnd, XClientMessageEvent *event ) +{ + struct format_entry *data; + unsigned long count = 0; + Atom *xdndtypes; + size_t size; + int version; + + version = (event->data.l[1] & 0xFF000000) >> 24; + + TRACE( "ver(%d) check-XdndTypeList(%ld) data=%ld,%ld,%ld,%ld,%ld\n", + version, (event->data.l[1] & 1), + event->data.l[0], event->data.l[1], event->data.l[2], + event->data.l[3], event->data.l[4] ); + + if (version > WINE_XDND_VERSION) + { + ERR("ignoring unsupported XDND version %d\n", version); + return; + } + + /* If the source supports more than 3 data types we retrieve + * the entire list. */ + if (event->data.l[1] & 1) + { + Atom acttype; + int actfmt; + unsigned long bytesret; + + /* Request supported formats from source window */ + XGetWindowProperty( event->display, event->data.l[0], x11drv_atom(XdndTypeList), + 0, 65535, FALSE, AnyPropertyType, &acttype, &actfmt, &count, + &bytesret, (unsigned char **)&xdndtypes ); + } + else + { + count = 3; + xdndtypes = (Atom *)&event->data.l[2]; + } + + if (TRACE_ON(xdnd)) + { + unsigned int i; + + for (i = 0; i < count; i++) + { + if (xdndtypes[i] != 0) + { + char * pn = XGetAtomName( event->display, xdndtypes[i] ); + TRACE( "XDNDEnterAtom %ld: %s\n", xdndtypes[i], pn ); + XFree( pn ); + } + } + } + + data = import_xdnd_selection( event->display, event->window, x11drv_atom(XdndSelection), + xdndtypes, count, &size ); + if (data) + { + handle_dnd_enter_event( data, size ); + free( data ); + } + + if (event->data.l[1] & 1) + XFree(xdndtypes); +} + + struct client_message_handler { int atom; /* protocol atom */ @@ -1764,7 +1838,7 @@ static const struct client_message_handler client_messages[] = { XATOM_WM_PROTOCOLS, handle_wm_protocols }, { XATOM__XEMBED, handle_xembed_protocol }, { XATOM_DndProtocol, handle_dnd_protocol }, - { XATOM_XdndEnter, X11DRV_XDND_EnterEvent }, + { XATOM_XdndEnter, handle_xdnd_enter_event }, { XATOM_XdndPosition, X11DRV_XDND_PositionEvent }, { XATOM_XdndDrop, X11DRV_XDND_DropEvent }, { XATOM_XdndLeave, X11DRV_XDND_LeaveEvent } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index f6d28122fc3..9339c1c08e6 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -293,7 +293,6 @@ extern BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp, DWORD dwReadLen) DECLSPEC_HIDDEN; extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultlen) DECLSPEC_HIDDEN; -extern void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; @@ -305,6 +304,8 @@ struct format_entry char data[1]; }; +extern void handle_dnd_enter_event( struct format_entry *formats, ULONG size ) DECLSPEC_HIDDEN; + extern struct format_entry *import_xdnd_selection( Display *display, Window win, Atom selection, Atom *targets, UINT count, size_t *size ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c index 34cb2a47081..e56fc964ada 100644 --- a/dlls/winex11.drv/xdnd.c +++ b/dlls/winex11.drv/xdnd.c @@ -55,8 +55,6 @@ static HWND XDNDLastTargetWnd; /* might be an ancestor of XDNDLastTargetWnd */ static HWND XDNDLastDropTargetWnd; -static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, - Atom *types, unsigned long count); static BOOL X11DRV_XDND_HasHDROP(void); static HRESULT X11DRV_XDND_SendDropFiles(HWND hwnd); static void X11DRV_XDND_FreeDragDropOp(void); @@ -180,73 +178,6 @@ static long X11DRV_XDND_DROPEFFECTToXdndAction(DWORD effect) return x11drv_atom(XdndActionCopy); } -/************************************************************************** - * X11DRV_XDND_EnterEvent - * - * Handle an XdndEnter event. - */ -void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event ) -{ - int version; - Atom *xdndtypes; - unsigned long count = 0; - - version = (event->data.l[1] & 0xFF000000) >> 24; - TRACE("ver(%d) check-XdndTypeList(%ld) data=%ld,%ld,%ld,%ld,%ld\n", - version, (event->data.l[1] & 1), - event->data.l[0], event->data.l[1], event->data.l[2], - event->data.l[3], event->data.l[4]); - - if (version > WINE_XDND_VERSION) - { - ERR("ignoring unsupported XDND version %d\n", version); - return; - } - - XDNDAccepted = FALSE; - - /* If the source supports more than 3 data types we retrieve - * the entire list. */ - if (event->data.l[1] & 1) - { - Atom acttype; - int actfmt; - unsigned long bytesret; - - /* Request supported formats from source window */ - XGetWindowProperty(event->display, event->data.l[0], x11drv_atom(XdndTypeList), - 0, 65535, FALSE, AnyPropertyType, &acttype, &actfmt, &count, - &bytesret, (unsigned char**)&xdndtypes); - } - else - { - count = 3; - xdndtypes = (Atom*) &event->data.l[2]; - } - - if (TRACE_ON(xdnd)) - { - unsigned int i; - - for (i = 0; i < count; i++) - { - if (xdndtypes[i] != 0) - { - char * pn = XGetAtomName(event->display, xdndtypes[i]); - TRACE("XDNDEnterAtom %ld: %s\n", xdndtypes[i], pn); - XFree(pn); - } - } - } - - /* Do a one-time data read and cache results */ - X11DRV_XDND_ResolveProperty(event->display, event->window, - event->data.l[1], xdndtypes, count); - - if (event->data.l[1] & 1) - XFree(xdndtypes); -} - /* Recursively searches for a window on given coordinates in a drag&drop specific manner. * * Don't use WindowFromPoint instead, because it omits the STATIC and transparent @@ -514,29 +445,18 @@ void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) /************************************************************************** - * X11DRV_XDND_ResolveProperty - * - * Resolve all MIME types to windows clipboard formats. All data is cached. + * handle_dnd_enter_event */ -static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, - Atom *types, unsigned long count) +void handle_dnd_enter_event( struct format_entry *formats, ULONG size ) { - struct format_entry *formats; - size_t size; - - TRACE("count(%ld)\n", count); - + XDNDAccepted = FALSE; X11DRV_XDND_FreeDragDropOp(); /* Clear previously cached data */ - formats = import_xdnd_selection( display, xwin, x11drv_atom(XdndSelection), types, count, &size ); - if (!formats) return; - if ((xdnd_formats = HeapAlloc( GetProcessHeap(), 0, size ))) { memcpy( xdnd_formats, formats, size ); xdnd_formats_end = (struct format_entry *)((char *)xdnd_formats + size); } - free( formats ); }
1
0
0
0
← Newer
1
2
3
4
5
...
103
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Results per page:
10
25
50
100
200