Needed for PyWinRT.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed for PyWinRT. --- include/Makefile.in | 1 + include/windows.graphics.capture.interop.h | 39 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 include/windows.graphics.capture.interop.h
diff --git a/include/Makefile.in b/include/Makefile.in index 54d6dca234d..00fd03b53a6 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -817,6 +817,7 @@ SOURCES = \ windows.gaming.ui.idl \ windows.globalization.idl \ windows.graphics.capture.idl \ + windows.graphics.capture.interop.h \ windows.graphics.directx.direct3d11.idl \ windows.graphics.directx.idl \ windows.graphics.effects.idl \ diff --git a/include/windows.graphics.capture.interop.h b/include/windows.graphics.capture.interop.h new file mode 100644 index 00000000000..58a602ba3ff --- /dev/null +++ b/include/windows.graphics.capture.interop.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2023 Mohamad Al-Jaf + * + * 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 + */ + +#ifndef __WINDOWS_GRAPHICS_CAPTURE_INTEROP_H_ +#define __WINDOWS_GRAPHICS_CAPTURE_INTEROP_H_ + +#include <windows.ui.composition.h> +#include <windows.graphics.capture.h> +#include <sdkddkver.h> + +#undef INTERFACE +#define INTERFACE IGraphicsCaptureItemInterop +DECLARE_INTERFACE_IID_(IGraphicsCaptureItemInterop, IUnknown, "3628e81b-3cac-4c60-b7f4-23ce0e0c3356") +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **obj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IGraphicsCaptureItemInterop methods ***/ + STDMETHOD(CreateForWindow)(THIS_ HWND window, REFIID iid, void **result) PURE; + STDMETHOD(CreateForMonitor)(THIS_ HMONITOR monitor, REFIID iid, void **result) PURE; +}; + +#endif /* __WINDOWS_GRAPHICS_CAPTURE_INTEROP_H_ */
Thank you. Just for reference, the pywinrt project workarounds the absence of that header file in this https://github.com/pywinrt/pywinrt/commit/1c7d7118b3025c14e33fc7d01b8afa30c2... commit. Though adding this header file results the following compiler error, it seems related to that project.
``` cppwinrt/winrt/base.h:676:27: error: constexpr variable 'guid_v<IGraphicsCaptureItemInterop>' must be initialized by a constant expression ```
This isn't an IDL in the SDK, but is there any reason we can't make it an IDL anyway?
On Mon Apr 17 04:43:36 2023 +0000, Zebediah Figura wrote:
This isn't an IDL in the SDK, but is there any reason we can't make it an IDL anyway?
Yeah, I tried that but it results in this error
tools/widl/widl -o include/windows.graphics.capture.interop.h -m32 --nostdinc -Ldlls/* -Iinclude -Iinclude -D__WINESRC__ \ include/windows.graphics.capture.interop.idl include/windows.h:38:1: error: Unable to open include file stdarg.h make[1]: *** [Makefile:163589: include/windows.graphics.capture.interop.h] Error 1
It doesn't seem worth debugging given how small the file is.
On Mon Apr 17 04:44:59 2023 +0000, Biswapriyo Nath wrote:
No problem, yeah that looks like a C++ error related to the project. I added everything that was in the Windows SDK header so it doesn't seem like it's an issue on the Wine side.
On Mon Apr 17 04:43:36 2023 +0000, Mohamad Al-Jaf wrote:
I don't see the same error with an IDL file but there's a couple of problems with widl and HMONITOR / void** types. It could be worked around the same way as for HANDLE, but I don't know if it's worth it?
On Mon Apr 17 06:42:44 2023 +0000, Rémi Bernon wrote:
Actually only HMONITOR is an issue, and it could be added to the same widl case as HANDLE, then something like that would work:
```C #ifdef __WIDL__ #pragma winrt ns_prefix #endif
import "windows.ui.composition.idl"; import "windows.graphics.capture.idl"; import "sdkddkver.h";
cpp_quote("#if 0") typedef HANDLE HMONITOR; cpp_quote("#endif /* 0 */")
[ uuid(3628e81b-3cac-4c60-b7f4-23ce0e0c3356) ] interface IGraphicsCaptureItemInterop : IUnknown { HRESULT CreateForWindow([in] HWND window, [in] REFIID iid, [out, iid_is(iid)] void **result); HRESULT CreateForMonitor([in] HMONITOR monitor, [in] REFIID iid, [out, iid_is(iid)] void **result); } ```