[vlc-devel] [PATCH] vout: win32: assume DirectComposition is available to UWP apps
Steve Lhomme
robux4 at ycbcr.xyz
Sat May 30 08:30:46 CEST 2020
On 2020-05-29 18:19, Rémi Denis-Courmont wrote:
> Le perjantaina 29. toukokuuta 2020, 12.06.19 EEST Steve Lhomme a écrit :
>> ---
>> modules/video_output/win32/dcomp_wrapper.cpp | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/modules/video_output/win32/dcomp_wrapper.cpp
>> b/modules/video_output/win32/dcomp_wrapper.cpp index
>> 6b8072135397..a0f0ed7e256a 100644
>> --- a/modules/video_output/win32/dcomp_wrapper.cpp
>> +++ b/modules/video_output/win32/dcomp_wrapper.cpp
>> @@ -19,6 +19,9 @@
>> # include "config.h"
>> #endif
>>
>> +#undef WINAPI_FAMILY
>> +#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
>> +
>> #include "dcomp_wrapper.h"
>> #include <dcomp.h>
>
> Might this not wreck system headers not expecting the value to change mid-
> module?
It could, but this trick worked well so far. We do not include any
Windows API headers in config.h. So at this point all Windows API will
consider it's a desktop build.
That's a trick we already use to trigger some APIs not available in
lower Windows version and also some rare API hidden in Winstore builds
that can actually be used.
It's far from perfect especially dealing with WINAPI_FAMILY which,
nowadays, is also checked by the C runtime headers.
If we want to only change the WINAPI_FAMILY value for a particular API
it's not possible. It may be possible to do it for a single header by
including all the headers it includes, then modify the value, then
change it back if more includes are needed. In practice it's overkill
and this simple trick is good enough.
More information about the vlc-devel
mailing list