From: Biswapriyo Nath nathbappai@gmail.com
--- include/Makefile.in | 1 + include/xamlom.idl | 348 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 349 insertions(+) create mode 100644 include/xamlom.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 0dae4cab2bf..acbfeadf389 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -970,6 +970,7 @@ SOURCES = \ xact2wb.h \ xact3.h \ xact3wb.h \ + xamlom.idl \ xapo.idl \ xapofx.h \ xaudio2.idl \ diff --git a/include/xamlom.idl b/include/xamlom.idl new file mode 100644 index 00000000000..ddcdabecf01 --- /dev/null +++ b/include/xamlom.idl @@ -0,0 +1,348 @@ +/* + * Copyright (C) the Wine project + * + * 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 + */ + +import "oaidl.idl"; +import "ocidl.idl"; +import "inspectable.idl"; +import "dxgi1_2.idl"; + +cpp_quote("#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)") +cpp_quote("#define E_UNKNOWNTYPE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XAML, 40L)") +cpp_quote("HRESULT InitializeXamlDiagnostic(LPCWSTR endPointName, DWORD pid, LPCWSTR wszDllXamlDiagnostics, LPCWSTR wszTAPDllName, CLSID tapClsid);") +cpp_quote("HRESULT InitializeXamlDiagnosticsEx(LPCWSTR endPointName, DWORD pid, LPCWSTR wszDllXamlDiagnostics, LPCWSTR wszTAPDllName, CLSID tapClsid, LPCWSTR wszInitializationData);") + +typedef unsigned hyper InstanceHandle; + +typedef enum VisualMutationType { + Add = 0, + Remove +} VisualMutationType; + +typedef enum BaseValueSource { + BaseValueSourceUnknown = 0, + BaseValueSourceDefault, + BaseValueSourceBuiltInStyle, + BaseValueSourceStyle, + BaseValueSourceLocal, + Inherited, + DefaultStyleTrigger, + TemplateTrigger, + StyleTrigger, + ImplicitStyleReference, + ParentTemplate, + ParentTemplateTrigger, + Animation, + Coercion, + BaseValueSourceVisualState +} BaseValueSource; + +typedef struct SourceInfo { + BSTR FileName; + unsigned int LineNumber; + unsigned int ColumnNumber; + unsigned int CharPosition; + BSTR Hash; +} SourceInfo; + +typedef struct ParentChildRelation { + InstanceHandle Parent; + InstanceHandle Child; + unsigned int ChildIndex; +} ParentChildRelation; + +typedef struct VisualElement { + InstanceHandle Handle; + SourceInfo SrcInfo; + BSTR Type; + BSTR Name; + unsigned int NumChildren; +} VisualElement; + +typedef struct PropertyChainSource { + InstanceHandle Handle; + BSTR TargetType; + BSTR Name; + BaseValueSource Source; + SourceInfo SrcInfo; +} PropertyChainSource; + +typedef enum MetadataBit { + None = 0x0, + IsValueHandle = 0x1, + IsPropertyReadOnly = 0x2, + IsValueCollection = 0x4, + IsValueCollectionReadOnly = 0x8, + IsValueBindingExpression = 0x10, + IsValueNull = 0x20, + IsValueHandleAndEvaluatedValue=0x40 +} MetadataBit; + +typedef struct PropertyChainValue { + unsigned int Index; + BSTR Type; + BSTR DeclaringType; + BSTR ValueType; + BSTR ItemType; + BSTR Value; + BOOL Overridden; + hyper MetadataBits; + BSTR PropertyName; + unsigned int PropertyChainIndex; +} PropertyChainValue; + +typedef struct EnumType { + BSTR Name; + SAFEARRAY(int) ValueInts; + SAFEARRAY(BSTR) ValueStrings; +} EnumType; + +typedef struct CollectionElementValue { + unsigned int Index; + BSTR ValueType; + BSTR Value; + hyper MetadataBits; +} CollectionElementValue; + +typedef enum RenderTargetBitmapOptions { + RenderTarget = 0, + RenderTargetAndChildren +} RenderTargetBitmapOptions; + +typedef struct BitmapDescription { + unsigned int Width; + unsigned int Height; + DXGI_FORMAT Format; + DXGI_ALPHA_MODE AlphaMode; +} BitmapDescription; + +typedef enum ResourceType { + ResourceTypeStatic = 0, + ResourceTypeTheme +} ResourceType; + +typedef enum VisualElementState { + ErrorResolved = 0, + ErrorResourceNotFound, + ErrorInvalidResource, +} VisualElementState; + +[ + object, + uuid(aa7a8931-80e4-4fec-8f3b-553f87b4966e), + pointer_default(unique) +] +interface IVisualTreeServiceCallback : IUnknown +{ + HRESULT OnVisualTreeChange( + [in] ParentChildRelation relation, + [in] VisualElement element, + [in] VisualMutationType mutationType); +} + +[ + object, + uuid(bad9eb88-ae77-4397-b948-5fa2db0a19ea), + pointer_default(unique) +] +interface IVisualTreeServiceCallback2 : IVisualTreeServiceCallback +{ + HRESULT OnElementStateChanged( + [in] InstanceHandle element, + [in] VisualElementState elementState, + [in] LPCWSTR context); +} + +[ + object, + uuid(a593b11a-d17f-48bb-8f66-83910731c8a5), + pointer_default(unique) +] +interface IVisualTreeService : IUnknown +{ + HRESULT AdviseVisualTreeChange( + [in] IVisualTreeServiceCallback *pCallback); + + HRESULT UnadviseVisualTreeChange( + [in] IVisualTreeServiceCallback *pCallback); + + HRESULT GetEnums( + [out] unsigned int* pCount, + [out, size_is(, *pCount)] EnumType** ppEnums); + + HRESULT CreateInstance( + [in] BSTR typeName, + [in] BSTR value, + [out, retval] InstanceHandle* pInstanceHandle); + + HRESULT GetPropertyValuesChain( + [in] InstanceHandle instanceHandle, + [out] unsigned int* pSourceCount, + [out, size_is(, *pSourceCount)] PropertyChainSource** ppPropertySources, + [out] unsigned int* pPropertyCount, + [out, size_is(, *pPropertyCount)] PropertyChainValue** ppPropertyValues); + + HRESULT SetProperty( + [in] InstanceHandle instanceHandle, + [in] InstanceHandle value, + [in] unsigned int propertyIndex); + + HRESULT ClearProperty( + [in] InstanceHandle instanceHandle, + [in] unsigned int propertyIndex); + + HRESULT GetCollectionCount( + [in] InstanceHandle instanceHandle, + [out] unsigned int* pCollectionSize); + + HRESULT GetCollectionElements( + [in] InstanceHandle instanceHandle, + [in] unsigned int startIndex, + [in, out] unsigned int* pElementCount, + [out, size_is(, *pElementCount)] CollectionElementValue** ppElementValues); + + HRESULT AddChild( + [in] InstanceHandle parent, + [in] InstanceHandle child, + [in] unsigned int index); + + HRESULT RemoveChild( + [in] InstanceHandle parent, + [in] unsigned int index); + + HRESULT ClearChildren( + [in] InstanceHandle parent); +} + +[ + object, + uuid(18c9e2b6-3f43-4116-9f2b-ff935d7770d2), + pointer_default(unique) +] +interface IXamlDiagnostics : IUnknown +{ + HRESULT GetDispatcher( + [out, retval] IInspectable** ppDispatcher); + + HRESULT GetUiLayer( + [out, retval] IInspectable** ppLayer); + + HRESULT GetApplication( + [out, retval] IInspectable** ppApplication); + + HRESULT GetIInspectableFromHandle( + [in] InstanceHandle instanceHandle, + [out, retval] IInspectable** ppInstance); + + HRESULT GetHandleFromIInspectable( + [in] IInspectable* pInstance, + [out, retval] InstanceHandle* pHandle); + + HRESULT HitTest( + [in] RECT rect, + [out] unsigned int* pCount, + [out, size_is(, *pCount)] InstanceHandle** ppInstanceHandles); + + HRESULT RegisterInstance( + [in] IInspectable* pInstance, + [out, retval] InstanceHandle *pInstanceHandle); + + HRESULT GetInitializationData( + [out, retval] BSTR* pInitializationData); +} + +[ + object, + uuid(d1a34ef2-cad8-4635-a3d2-fcda8d3f3caf), + pointer_default(unique) +] +interface IBitmapData : IUnknown +{ + HRESULT CopyBytesTo( + [in] unsigned int sourceOffsetInBytes, + [in] unsigned int maxBytesToCopy, + [out, size_is(maxBytesToCopy)] byte* pvBytes, + [out] unsigned int* numberOfBytesCopied); + + HRESULT GetStride( + [out] unsigned int* pStride); + + HRESULT GetBitmapDescription( + [out] BitmapDescription* pBitmapDescription); + + HRESULT GetSourceBitmapDescription( + [out] BitmapDescription* pBitmapDescription); +} + +[ + object, + uuid(130f5136-ec43-4f61-89c7-9801a36d2e95), + pointer_default(unique) +] +interface IVisualTreeService2 : IVisualTreeService +{ + HRESULT GetPropertyIndex( + [in] InstanceHandle object, + [in] LPCWSTR propertyName, + [out] unsigned int* pPropertyIndex); + + HRESULT GetProperty( + [in] InstanceHandle object, + [in] unsigned int propertyIndex, + [out] InstanceHandle* pValue); + + HRESULT ReplaceResource( + [in] InstanceHandle resourceDictionary, + [in] InstanceHandle key, + [in] InstanceHandle newValue); + + HRESULT RenderTargetBitmap( + [in] InstanceHandle handle, + [in] RenderTargetBitmapOptions options, + [in] unsigned int maxPixelWidth, + [in] unsigned int maxPixelHeight, + [out] IBitmapData** ppBitmapData); +} + +[ + object, + uuid(0e79c6e0-85a0-4be8-b41a-655cf1fd19bd), + pointer_default(unique) +] +interface IVisualTreeService3 : IVisualTreeService2 +{ + HRESULT ResolveResource( + [in] InstanceHandle resourceContext, + [in] LPCWSTR resourceName, + [in] ResourceType resourceType, + [in] unsigned int propertyIndex); + + HRESULT GetDictionaryItem( + [in] InstanceHandle dictionaryHandle, + [in] LPCWSTR resourceName, + [in] BOOL resourceIsImplicitStyle, + [out] InstanceHandle* resourceHandle); + + HRESULT AddDictionaryItem( + [in] InstanceHandle dictionaryHandle, + [in] InstanceHandle resourceKey, + [in] InstanceHandle resourceHandle); + + HRESULT RemoveDictionaryItem( + [in] InstanceHandle dictionaryHandle, + [in] InstanceHandle resourceKey); +}
Zebediah Figura (@zfigura) commented about include/xamlom.idl:
+/*
- Copyright (C) the Wine project
I don't think "the Wine project" is a legal entity. This is also missing a year.
Zebediah Figura (@zfigura) commented about include/xamlom.idl:
- 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
- */
+import "oaidl.idl"; +import "ocidl.idl"; +import "inspectable.idl"; +import "dxgi1_2.idl";
+cpp_quote("#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)") +cpp_quote("#define E_UNKNOWNTYPE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XAML, 40L)") +cpp_quote("HRESULT InitializeXamlDiagnostic(LPCWSTR endPointName, DWORD pid, LPCWSTR wszDllXamlDiagnostics, LPCWSTR wszTAPDllName, CLSID tapClsid);") +cpp_quote("HRESULT InitializeXamlDiagnosticsEx(LPCWSTR endPointName, DWORD pid, LPCWSTR wszDllXamlDiagnostics, LPCWSTR wszTAPDllName, CLSID tapClsid, LPCWSTR wszInitializationData);")
These are missing calling conventions. Note that they could also be defined without cpp_quote.
I think we also frown on using LP* typedefs in new code. Those parameter names also look disturbingly like they were copied from the Microsoft headers.
Zebediah Figura (@zfigura) commented about include/xamlom.idl:
- 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
- */
+import "oaidl.idl"; +import "ocidl.idl"; +import "inspectable.idl"; +import "dxgi1_2.idl";
+cpp_quote("#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)") +cpp_quote("#define E_UNKNOWNTYPE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XAML, 40L)")
Can we define this as the expanded value instead? It makes it easier to search for.
Zebediah Figura (@zfigura) commented about include/xamlom.idl:
+import "oaidl.idl"; +import "ocidl.idl"; +import "inspectable.idl"; +import "dxgi1_2.idl";
+cpp_quote("#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)") +cpp_quote("#define E_UNKNOWNTYPE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XAML, 40L)") +cpp_quote("HRESULT InitializeXamlDiagnostic(LPCWSTR endPointName, DWORD pid, LPCWSTR wszDllXamlDiagnostics, LPCWSTR wszTAPDllName, CLSID tapClsid);") +cpp_quote("HRESULT InitializeXamlDiagnosticsEx(LPCWSTR endPointName, DWORD pid, LPCWSTR wszDllXamlDiagnostics, LPCWSTR wszTAPDllName, CLSID tapClsid, LPCWSTR wszInitializationData);")
+typedef unsigned hyper InstanceHandle;
+typedef enum VisualMutationType {
- Add = 0,
- Remove
+} VisualMutationType;
I think usual Wine style in new code is to put opening braces on their own line, to match the close braces.
Zebediah Figura (@zfigura) commented about include/xamlom.idl:
- InstanceHandle Handle;
- BSTR TargetType;
- BSTR Name;
- BaseValueSource Source;
- SourceInfo SrcInfo;
+} PropertyChainSource;
+typedef enum MetadataBit {
- None = 0x0,
- IsValueHandle = 0x1,
- IsPropertyReadOnly = 0x2,
- IsValueCollection = 0x4,
- IsValueCollectionReadOnly = 0x8,
- IsValueBindingExpression = 0x10,
- IsValueNull = 0x20,
- IsValueHandleAndEvaluatedValue=0x40
The formatting here is inconsistent, and more concerningly, seems to have been copy-pasted directly from the Microsoft headers. How did you write this header?
Zebediah Figura (@zfigura) commented about include/xamlom.idl:
- object,
- uuid(aa7a8931-80e4-4fec-8f3b-553f87b4966e),
- pointer_default(unique)
+] +interface IVisualTreeServiceCallback : IUnknown +{
- HRESULT OnVisualTreeChange(
[in] ParentChildRelation relation,
[in] VisualElement element,
[in] VisualMutationType mutationType);
+}
+[
- object,
- uuid(bad9eb88-ae77-4397-b948-5fa2db0a19ea),
- pointer_default(unique)
"pointer_default(unique)" is the default value and doesn't need to be specified. We do elsewhere, but rather unnecessarily.
Zebediah Figura (@zfigura) commented about include/xamlom.idl:
+{
- HRESULT OnElementStateChanged(
[in] InstanceHandle element,
[in] VisualElementState elementState,
[in] LPCWSTR context);
+}
+[
- object,
- uuid(a593b11a-d17f-48bb-8f66-83910731c8a5),
- pointer_default(unique)
+] +interface IVisualTreeService : IUnknown +{
- HRESULT AdviseVisualTreeChange(
[in] IVisualTreeServiceCallback *pCallback);
I don't think we need a line break here. I also don't think we want to be using this Hungarian notation or camel case for parameter names.
On Tue May 9 15:57:43 2023 +0000, Zebediah Figura wrote:
I don't think we need a line break here. I also don't think we want to be using this Hungarian notation or camel case for parameter names.
Do you mean in that specific line or in every method declaration?