Using the namespace A.B.C {} syntax, used in a few some places in WinRT IDLs.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- tools/widl/parser.y | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 9b71cbedf6d..93f7b0f52b9 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -70,8 +70,8 @@ static struct namespace *find_namespace_or_error(struct namespace *namespace, co
static var_t *reg_const(var_t *var);
-static void push_namespace(const char *name); -static void pop_namespace(const char *name); +static void push_namespaces(str_list_t *names); +static void pop_namespaces(str_list_t *names); static void push_parameters_namespace(const char *name); static void pop_parameters_namespace(const char *name);
@@ -293,7 +293,7 @@ static typelib_t *current_typelib; %type <type> dispinterfaceref %type <type> dispinterface dispinterfacedef %type <type> module moduledef -%type <str> namespacedef +%type <str_list> namespacedef %type <type> base_type int_std %type <type> enumdef structdef uniondef typedecl %type <type> type unqualified_type qualified_type @@ -385,8 +385,8 @@ imp_decl_statements: { $$ = NULL; } imp_decl_block: tDECLARE '{' imp_decl_statements '}' { $$ = $3; }
gbl_statements: { $$ = NULL; } - | gbl_statements namespacedef '{' { push_namespace($2); } gbl_statements '}' - { pop_namespace($2); $$ = append_statements($1, $5); } + | gbl_statements namespacedef '{' { push_namespaces($2); } gbl_statements '}' + { pop_namespaces($2); $$ = append_statements($1, $5); } | gbl_statements interface ';' { $$ = append_statement($1, make_statement_reference($2)); } | gbl_statements dispinterface ';' { $$ = append_statement($1, make_statement_reference($2)); } | gbl_statements interfacedef { $$ = append_statement($1, make_statement_type_decl($2)); } @@ -412,8 +412,8 @@ gbl_statements: { $$ = NULL; } imp_statements: { $$ = NULL; } | imp_statements interface ';' { $$ = append_statement($1, make_statement_reference($2)); } | imp_statements dispinterface ';' { $$ = append_statement($1, make_statement_reference($2)); } - | imp_statements namespacedef '{' { push_namespace($2); } imp_statements '}' - { pop_namespace($2); $$ = append_statements($1, $5); } + | imp_statements namespacedef '{' { push_namespaces($2); } imp_statements '}' + { pop_namespaces($2); $$ = append_statements($1, $5); } | imp_statements interfacedef { $$ = append_statement($1, make_statement_type_decl($2)); } | imp_statements delegatedef { $$ = append_statement($1, make_statement_type_decl($2)); } | imp_statements coclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); } @@ -992,7 +992,8 @@ apicontract_def: attributes apicontract '{' '}' semicolon_opt { $$ = type_apicontract_define($2, $1); } ;
-namespacedef: tNAMESPACE aIDENTIFIER { $$ = $2; } +namespacedef: tNAMESPACE aIDENTIFIER { $$ = append_str( NULL, $2 ); } + | namespacedef '.' aIDENTIFIER { $$ = append_str( $1, $3 ); } ;
class_interfaces: { $$ = NULL; } @@ -2041,6 +2042,20 @@ static void pop_namespace(const char *name) current_namespace = current_namespace->parent; }
+static void push_namespaces(str_list_t *names) +{ + const struct str_list_entry_t *name; + LIST_FOR_EACH_ENTRY(name, names, const struct str_list_entry_t, entry) + push_namespace(name->str); +} + +static void pop_namespaces(str_list_t *names) +{ + const struct str_list_entry_t *name; + LIST_FOR_EACH_ENTRY_REV(name, names, const struct str_list_entry_t, entry) + pop_namespace(name->str); +} + static void push_parameters_namespace(const char *name) { struct namespace *namespace;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- include/windows.gaming.input.idl | 636 +++++++++++++++---------------- 1 file changed, 310 insertions(+), 326 deletions(-)
diff --git a/include/windows.gaming.input.idl b/include/windows.gaming.input.idl index 0f9dd37acd8..ccc29922eb8 100644 --- a/include/windows.gaming.input.idl +++ b/include/windows.gaming.input.idl @@ -28,331 +28,315 @@ import "windows.foundation.idl"; import "windows.gaming.input.forcefeedback.idl"; import "windows.system.idl";
-namespace Windows { - namespace Gaming { - namespace Input { - typedef enum GamepadButtons GamepadButtons; - typedef enum GameControllerButtonLabel GameControllerButtonLabel; - typedef enum GameControllerSwitchKind GameControllerSwitchKind; - typedef enum GameControllerSwitchPosition GameControllerSwitchPosition; - typedef struct GamepadReading GamepadReading; - typedef struct GamepadVibration GamepadVibration; - interface IGameController; - interface IGameControllerBatteryInfo; - interface IGamepad; - interface IGamepad2; - interface IGamepadStatics; - interface IGamepadStatics2; - interface IRawGameController; - interface IRawGameController2; - runtimeclass Gamepad; - runtimeclass Headset; - runtimeclass RawGameController; - } - } -} - -namespace Windows { - namespace Gaming { - namespace Input { - declare { - interface Windows.Foundation.EventHandler<Windows.Gaming.Input.Gamepad*>; - interface Windows.Foundation.EventHandler<Windows.Gaming.Input.RawGameController*>; - interface Windows.Foundation.TypedEventHandler<Windows.Gaming.Input.IGameController*, Windows.Gaming.Input.Headset*>; - interface Windows.Foundation.TypedEventHandler<Windows.Gaming.Input.IGameController*, Windows.System.UserChangedEventArgs*>; - interface Windows.Foundation.Collections.IVectorView<Gamepad*>; - interface Windows.Foundation.Collections.IVectorView<Windows.Gaming.Input.RawGameController*>; - } - } - } -} - -namespace Windows { - namespace Gaming { - namespace Input { - [ - contract(Windows.Foundation.UniversalApiContract, 1.0), - flags - ] - enum GamepadButtons - { - None = 0x0, - Menu = 0x1, - View = 0x2, - A = 0x4, - B = 0x8, - X = 0x10, - Y = 0x20, - DPadUp = 0x40, - DPadDown = 0x80, - DPadLeft = 0x100, - DPadRight = 0x200, - LeftShoulder = 0x400, - RightShoulder = 0x800, - LeftThumbstick = 0x1000, - RightThumbstick = 0x2000, - [contract(Windows.Foundation.UniversalApiContract, 3.0)] - Paddle1 = 0x4000, - [contract(Windows.Foundation.UniversalApiContract, 3.0)] - Paddle2 = 0x8000, - [contract(Windows.Foundation.UniversalApiContract, 3.0)] - Paddle3 = 0x10000, - [contract(Windows.Foundation.UniversalApiContract, 3.0)] - Paddle4 = 0x20000 - }; - - [contract(Windows.Foundation.UniversalApiContract, 3.0)] - enum GameControllerButtonLabel - { - None = 0, - XboxBack = 1, - XboxStart = 2, - XboxMenu = 3, - XboxView = 4, - XboxUp = 5, - XboxDown = 6, - XboxLeft = 7, - XboxRight = 8, - XboxA = 9, - XboxB = 10, - XboxX = 11, - XboxY = 12, - XboxLeftBumper = 13, - XboxLeftTrigger = 14, - XboxLeftStickButton = 15, - XboxRightBumper = 16, - XboxRightTrigger = 17, - XboxRightStickButton = 18, - XboxPaddle1 = 19, - XboxPaddle2 = 20, - XboxPaddle3 = 21, - XboxPaddle4 = 22, - Mode = 23, - Select = 24, - Menu = 25, - View = 26, - Back = 27, - Start = 28, - Options = 29, - Share = 30, - Up = 31, - Down = 32, - Left = 33, - Right = 34, - LetterA = 35, - LetterB = 36, - LetterC = 37, - LetterL = 38, - LetterR = 39, - LetterX = 40, - LetterY = 41, - LetterZ = 42, - Cross = 43, - Circle = 44, - Square = 45, - Triangle = 46, - LeftBumper = 47, - LeftTrigger = 48, - LeftStickButton = 49, - Left1 = 50, - Left2 = 51, - Left3 = 52, - RightBumper = 53, - RightTrigger = 54, - RightStickButton = 55, - Right1 = 56, - Right2 = 57, - Right3 = 58, - Paddle1 = 59, - Paddle2 = 60, - Paddle3 = 61, - Paddle4 = 62, - Plus = 63, - Minus = 64, - DownLeftArrow = 65, - DialLeft = 66, - DialRight = 67, - Suspension = 68 - }; - - [contract(Windows.Foundation.UniversalApiContract, 4.0)] - enum GameControllerSwitchKind - { - TwoWay = 0, - FourWay = 1, - EightWay = 2 - }; - - [contract(Windows.Foundation.UniversalApiContract, 4.0)] - enum GameControllerSwitchPosition - { - Center = 0, - Up = 1, - UpRight = 2, - Right = 3, - DownRight = 4, - Down = 5, - DownLeft = 6, - Left = 7, - UpLeft = 8 - }; - - [contract(Windows.Foundation.UniversalApiContract, 1.0)] - struct GamepadReading - { - UINT64 Timestamp; - Windows.Gaming.Input.GamepadButtons Buttons; - DOUBLE LeftTrigger; - DOUBLE RightTrigger; - DOUBLE LeftThumbstickX; - DOUBLE LeftThumbstickY; - DOUBLE RightThumbstickX; - DOUBLE RightThumbstickY; - }; - - [contract(Windows.Foundation.UniversalApiContract, 1.0)] - struct GamepadVibration - { - DOUBLE LeftMotor; - DOUBLE RightMotor; - DOUBLE LeftTrigger; - DOUBLE RightTrigger; - }; - - [ - contract(Windows.Foundation.UniversalApiContract, 1.0), - uuid(1baf6522-5f64-42c5-8267-b9fe2215bfbd) - ] - interface IGameController : IInspectable - { - [eventadd] HRESULT HeadsetConnected([in] Windows.Foundation.TypedEventHandler<Windows.Gaming.Input.IGameController*, Windows.Gaming.Input.Headset*>* handler, - [out, retval] EventRegistrationToken* token); - [eventremove] HRESULT HeadsetConnected([in] EventRegistrationToken token); - [eventadd] HRESULT HeadsetDisconnected([in] Windows.Foundation.TypedEventHandler<Windows.Gaming.Input.IGameController*, Windows.Gaming.Input.Headset*>* handler, - [out, retval] EventRegistrationToken* token); - [eventremove] HRESULT HeadsetDisconnected([in] EventRegistrationToken token); - [eventadd] HRESULT UserChanged([in] Windows.Foundation.TypedEventHandler<Windows.Gaming.Input.IGameController*, Windows.System.UserChangedEventArgs*>* handler, - [out, retval] EventRegistrationToken* token); - [eventremove] HRESULT UserChanged([in] EventRegistrationToken token); - [propget] HRESULT Headset([out, retval] Windows.Gaming.Input.Headset** value); - [propget] HRESULT IsWireless([out, retval] boolean* value); - [propget] HRESULT User([out, retval] Windows.System.User** value); - } - - [ - contract(Windows.Foundation.UniversalApiContract, 1.0), - exclusiveto(Windows.Gaming.Input.Gamepad), - uuid(bc7bb43c-0a69-3903-9e9d-a50f86a45de5) - ] - interface IGamepad : IInspectable - requires Windows.Gaming.Input.IGameController - { - [propget] HRESULT Vibration([out, retval] Windows.Gaming.Input.GamepadVibration* value); - [propput] HRESULT Vibration([in] Windows.Gaming.Input.GamepadVibration value); - HRESULT GetCurrentReading([out, retval] Windows.Gaming.Input.GamepadReading* value); - } - - [ - contract(Windows.Foundation.UniversalApiContract, 4.0), - exclusiveto(Windows.Gaming.Input.RawGameController), - uuid(7cad6d91-a7e1-4f71-9a78-33e9c5dfea62) - ] - interface IRawGameController : IInspectable - requires Windows.Gaming.Input.IGameController - { - [propget] HRESULT AxisCount([out, retval] INT32* value); - [propget] HRESULT ButtonCount([out, retval] INT32* value); - [propget] HRESULT ForceFeedbackMotors([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Gaming.Input.ForceFeedback.ForceFeedbackMotor*>** value); - [propget] HRESULT HardwareProductId([out, retval] UINT16* value); - [propget] HRESULT HardwareVendorId([out, retval] UINT16* value); - [propget] HRESULT SwitchCount([out, retval] INT32* value); - HRESULT GetButtonLabel([in] INT32 index, [out, retval] Windows.Gaming.Input.GameControllerButtonLabel* value); - HRESULT GetCurrentReading([in] UINT32 buttons_size, [out, size_is(buttons_size)] boolean* buttons, - [in] UINT32 switches_size, [out, size_is(switches_size)] Windows.Gaming.Input.GameControllerSwitchPosition* switches, - [in] UINT32 axes_size, [out, size_is(axes_size)] DOUBLE* axes, - [out, retval] UINT64* timestamp); - HRESULT GetSwitchKind([in] INT32 index, [out, retval] Windows.Gaming.Input.GameControllerSwitchKind* value); - } - - [ - object, - uuid(8bbce529-d49c-39e9-9560-e47dde96b7c8) - ] - interface IGamepadStatics : IInspectable - { - [eventadd] HRESULT GamepadAdded([in] Windows.Foundation.EventHandler<Gamepad*> *value, [out, retval] EventRegistrationToken* token); - [eventremove] HRESULT GamepadAdded([in] EventRegistrationToken token); - [eventadd] HRESULT GamepadRemoved([in] Windows.Foundation.EventHandler<Gamepad*> *value, [out, retval] EventRegistrationToken* token); - [eventremove] HRESULT GamepadRemoved([in] EventRegistrationToken token); - [propget] HRESULT Gamepads([out, retval] Windows.Foundation.Collections.IVectorView<Gamepad*> **value); - } - - [ - contract(Windows.Foundation.UniversalApiContract, 1.0), - exclusiveto(Windows.Gaming.Input.Headset), - uuid(3fd156ef-6925-3fa8-9181-029c5223ae3b) - ] - interface IHeadset : IInspectable - { - [propget] HRESULT CaptureDeviceId([out, retval] HSTRING* value); - [propget] HRESULT RenderDeviceId([out, retval] HSTRING* value); - } - - [ - object, - uuid(eb8d0792-e95a-4b19-afc7-0a59f8bf759e) - ] - interface IRawGameControllerStatics : IInspectable - { - [eventadd] HRESULT RawGameControllerAdded([in] Windows.Foundation.EventHandler<Windows.Gaming.Input.RawGameController*> *handler, - [out, retval] EventRegistrationToken* token); - [eventremove] HRESULT RawGameControllerAdded([in] EventRegistrationToken token); - [eventadd] HRESULT RawGameControllerRemoved([in] Windows.Foundation.EventHandler<Windows.Gaming.Input.RawGameController*> *handler, - [out, retval] EventRegistrationToken* token); - [eventremove] HRESULT RawGameControllerRemoved([in] EventRegistrationToken token); - [propget] HRESULT RawGameControllers([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Gaming.Input.RawGameController*> **value); - HRESULT FromGameController([in] Windows.Gaming.Input.IGameController *game_controller, [out, retval] Windows.Gaming.Input.RawGameController **value); - } - - [ - contract(Windows.Foundation.UniversalApiContract, 1.0), - marshaling_behavior(agile), - static(Windows.Gaming.Input.IGamepadStatics, Windows.Foundation.UniversalApiContract, 1.0), - static(Windows.Gaming.Input.IGamepadStatics2, Windows.Foundation.UniversalApiContract, 4.0), - threading(both) - ] - runtimeclass Gamepad - { - [default] interface Windows.Gaming.Input.IGamepad; - interface Windows.Gaming.Input.IGameController; - [contract(Windows.Foundation.UniversalApiContract, 3.0)] interface Windows.Gaming.Input.IGamepad2; - [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Gaming.Input.IGameControllerBatteryInfo; - } - - [ - contract(Windows.Foundation.UniversalApiContract, 1.0), - marshaling_behavior(agile), - threading(both) - ] - runtimeclass Headset - { - [default] interface Windows.Gaming.Input.IHeadset; - [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Gaming.Input.IGameControllerBatteryInfo; - } - - [ - contract(Windows.Foundation.UniversalApiContract, 4.0), - marshaling_behavior(agile), - static(Windows.Gaming.Input.IRawGameControllerStatics, Windows.Foundation.UniversalApiContract, 4.0), - threading(both) - ] - runtimeclass RawGameController - { - [default] interface Windows.Gaming.Input.IRawGameController; - interface Windows.Gaming.Input.IGameController; - interface Windows.Gaming.Input.IGameControllerBatteryInfo; - [contract(Windows.Foundation.UniversalApiContract, 5.0)] interface Windows.Gaming.Input.IRawGameController2; - } - } +namespace Windows.Gaming.Input { + typedef enum GamepadButtons GamepadButtons; + typedef enum GameControllerButtonLabel GameControllerButtonLabel; + typedef enum GameControllerSwitchKind GameControllerSwitchKind; + typedef enum GameControllerSwitchPosition GameControllerSwitchPosition; + typedef struct GamepadReading GamepadReading; + typedef struct GamepadVibration GamepadVibration; + interface IGameController; + interface IGameControllerBatteryInfo; + interface IGamepad; + interface IGamepad2; + interface IGamepadStatics; + interface IGamepadStatics2; + interface IRawGameController; + interface IRawGameController2; + runtimeclass Gamepad; + runtimeclass Headset; + runtimeclass RawGameController; + + declare { + interface Windows.Foundation.EventHandler<Windows.Gaming.Input.Gamepad *>; + interface Windows.Foundation.EventHandler<Windows.Gaming.Input.RawGameController *>; + interface Windows.Foundation.TypedEventHandler<Windows.Gaming.Input.IGameController *, Windows.Gaming.Input.Headset *>; + interface Windows.Foundation.TypedEventHandler<Windows.Gaming.Input.IGameController *, Windows.System.UserChangedEventArgs *>; + interface Windows.Foundation.Collections.IVectorView<Gamepad *>; + interface Windows.Foundation.Collections.IVectorView<Windows.Gaming.Input.RawGameController *>; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + flags + ] + enum GamepadButtons + { + None = 0x0, + Menu = 0x1, + View = 0x2, + A = 0x4, + B = 0x8, + X = 0x10, + Y = 0x20, + DPadUp = 0x40, + DPadDown = 0x80, + DPadLeft = 0x100, + DPadRight = 0x200, + LeftShoulder = 0x400, + RightShoulder = 0x800, + LeftThumbstick = 0x1000, + RightThumbstick = 0x2000, + [contract(Windows.Foundation.UniversalApiContract, 3.0)] + Paddle1 = 0x4000, + [contract(Windows.Foundation.UniversalApiContract, 3.0)] + Paddle2 = 0x8000, + [contract(Windows.Foundation.UniversalApiContract, 3.0)] + Paddle3 = 0x10000, + [contract(Windows.Foundation.UniversalApiContract, 3.0)] + Paddle4 = 0x20000 + }; + + [contract(Windows.Foundation.UniversalApiContract, 3.0)] + enum GameControllerButtonLabel + { + None = 0, + XboxBack = 1, + XboxStart = 2, + XboxMenu = 3, + XboxView = 4, + XboxUp = 5, + XboxDown = 6, + XboxLeft = 7, + XboxRight = 8, + XboxA = 9, + XboxB = 10, + XboxX = 11, + XboxY = 12, + XboxLeftBumper = 13, + XboxLeftTrigger = 14, + XboxLeftStickButton = 15, + XboxRightBumper = 16, + XboxRightTrigger = 17, + XboxRightStickButton = 18, + XboxPaddle1 = 19, + XboxPaddle2 = 20, + XboxPaddle3 = 21, + XboxPaddle4 = 22, + Mode = 23, + Select = 24, + Menu = 25, + View = 26, + Back = 27, + Start = 28, + Options = 29, + Share = 30, + Up = 31, + Down = 32, + Left = 33, + Right = 34, + LetterA = 35, + LetterB = 36, + LetterC = 37, + LetterL = 38, + LetterR = 39, + LetterX = 40, + LetterY = 41, + LetterZ = 42, + Cross = 43, + Circle = 44, + Square = 45, + Triangle = 46, + LeftBumper = 47, + LeftTrigger = 48, + LeftStickButton = 49, + Left1 = 50, + Left2 = 51, + Left3 = 52, + RightBumper = 53, + RightTrigger = 54, + RightStickButton = 55, + Right1 = 56, + Right2 = 57, + Right3 = 58, + Paddle1 = 59, + Paddle2 = 60, + Paddle3 = 61, + Paddle4 = 62, + Plus = 63, + Minus = 64, + DownLeftArrow = 65, + DialLeft = 66, + DialRight = 67, + Suspension = 68 + }; + + [contract(Windows.Foundation.UniversalApiContract, 4.0)] + enum GameControllerSwitchKind + { + TwoWay = 0, + FourWay = 1, + EightWay = 2 + }; + + [contract(Windows.Foundation.UniversalApiContract, 4.0)] + enum GameControllerSwitchPosition + { + Center = 0, + Up = 1, + UpRight = 2, + Right = 3, + DownRight = 4, + Down = 5, + DownLeft = 6, + Left = 7, + UpLeft = 8 + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + struct GamepadReading + { + UINT64 Timestamp; + Windows.Gaming.Input.GamepadButtons Buttons; + DOUBLE LeftTrigger; + DOUBLE RightTrigger; + DOUBLE LeftThumbstickX; + DOUBLE LeftThumbstickY; + DOUBLE RightThumbstickX; + DOUBLE RightThumbstickY; + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + struct GamepadVibration + { + DOUBLE LeftMotor; + DOUBLE RightMotor; + DOUBLE LeftTrigger; + DOUBLE RightTrigger; + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + uuid(1baf6522-5f64-42c5-8267-b9fe2215bfbd) + ] + interface IGameController : IInspectable + { + [eventadd] HRESULT HeadsetConnected([in] Windows.Foundation.TypedEventHandler<Windows.Gaming.Input.IGameController *, Windows.Gaming.Input.Headset *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT HeadsetConnected([in] EventRegistrationToken token); + [eventadd] HRESULT HeadsetDisconnected([in] Windows.Foundation.TypedEventHandler<Windows.Gaming.Input.IGameController *, Windows.Gaming.Input.Headset *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT HeadsetDisconnected([in] EventRegistrationToken token); + [eventadd] HRESULT UserChanged([in] Windows.Foundation.TypedEventHandler<Windows.Gaming.Input.IGameController *, Windows.System.UserChangedEventArgs *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT UserChanged([in] EventRegistrationToken token); + [propget] HRESULT Headset([out, retval] Windows.Gaming.Input.Headset **value); + [propget] HRESULT IsWireless([out, retval] boolean *value); + [propget] HRESULT User([out, retval] Windows.System.User **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Gaming.Input.Gamepad), + uuid(bc7bb43c-0a69-3903-9e9d-a50f86a45de5) + ] + interface IGamepad : IInspectable + requires Windows.Gaming.Input.IGameController + { + [propget] HRESULT Vibration([out, retval] Windows.Gaming.Input.GamepadVibration *value); + [propput] HRESULT Vibration([in] Windows.Gaming.Input.GamepadVibration value); + HRESULT GetCurrentReading([out, retval] Windows.Gaming.Input.GamepadReading *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Gaming.Input.RawGameController), + uuid(7cad6d91-a7e1-4f71-9a78-33e9c5dfea62) + ] + interface IRawGameController : IInspectable + requires Windows.Gaming.Input.IGameController + { + [propget] HRESULT AxisCount([out, retval] INT32 *value); + [propget] HRESULT ButtonCount([out, retval] INT32 *value); + [propget] HRESULT ForceFeedbackMotors([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Gaming.Input.ForceFeedback.ForceFeedbackMotor *> **value); + [propget] HRESULT HardwareProductId([out, retval] UINT16 *value); + [propget] HRESULT HardwareVendorId([out, retval] UINT16 *value); + [propget] HRESULT SwitchCount([out, retval] INT32 *value); + HRESULT GetButtonLabel([in] INT32 index, [out, retval] Windows.Gaming.Input.GameControllerButtonLabel *value); + HRESULT GetCurrentReading([in] UINT32 buttons_size, [out, size_is(buttons_size)] boolean *buttons, + [in] UINT32 switches_size, [out, size_is(switches_size)] Windows.Gaming.Input.GameControllerSwitchPosition *switches, + [in] UINT32 axes_size, [out, size_is(axes_size)] DOUBLE *axes, + [out, retval] UINT64 *timestamp); + HRESULT GetSwitchKind([in] INT32 index, [out, retval] Windows.Gaming.Input.GameControllerSwitchKind *value); + } + + [ + object, + uuid(8bbce529-d49c-39e9-9560-e47dde96b7c8) + ] + interface IGamepadStatics : IInspectable + { + [eventadd] HRESULT GamepadAdded([in] Windows.Foundation.EventHandler<Gamepad *> *value, [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT GamepadAdded([in] EventRegistrationToken token); + [eventadd] HRESULT GamepadRemoved([in] Windows.Foundation.EventHandler<Gamepad *> *value, [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT GamepadRemoved([in] EventRegistrationToken token); + [propget] HRESULT Gamepads([out, retval] Windows.Foundation.Collections.IVectorView<Gamepad *> **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Gaming.Input.Headset), + uuid(3fd156ef-6925-3fa8-9181-029c5223ae3b) + ] + interface IHeadset : IInspectable + { + [propget] HRESULT CaptureDeviceId([out, retval] HSTRING *value); + [propget] HRESULT RenderDeviceId([out, retval] HSTRING *value); + } + + [ + object, + uuid(eb8d0792-e95a-4b19-afc7-0a59f8bf759e) + ] + interface IRawGameControllerStatics : IInspectable + { + [eventadd] HRESULT RawGameControllerAdded([in] Windows.Foundation.EventHandler<Windows.Gaming.Input.RawGameController *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT RawGameControllerAdded([in] EventRegistrationToken token); + [eventadd] HRESULT RawGameControllerRemoved([in] Windows.Foundation.EventHandler<Windows.Gaming.Input.RawGameController *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT RawGameControllerRemoved([in] EventRegistrationToken token); + [propget] HRESULT RawGameControllers([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Gaming.Input.RawGameController *> **value); + HRESULT FromGameController([in] Windows.Gaming.Input.IGameController *game_controller, [out, retval] Windows.Gaming.Input.RawGameController **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + static(Windows.Gaming.Input.IGamepadStatics, Windows.Foundation.UniversalApiContract, 1.0), + static(Windows.Gaming.Input.IGamepadStatics2, Windows.Foundation.UniversalApiContract, 4.0), + threading(both) + ] + runtimeclass Gamepad + { + [default] interface Windows.Gaming.Input.IGamepad; + interface Windows.Gaming.Input.IGameController; + [contract(Windows.Foundation.UniversalApiContract, 3.0)] interface Windows.Gaming.Input.IGamepad2; + [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Gaming.Input.IGameControllerBatteryInfo; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass Headset + { + [default] interface Windows.Gaming.Input.IHeadset; + [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Gaming.Input.IGameControllerBatteryInfo; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile), + static(Windows.Gaming.Input.IRawGameControllerStatics, Windows.Foundation.UniversalApiContract, 4.0), + threading(both) + ] + runtimeclass RawGameController + { + [default] interface Windows.Gaming.Input.IRawGameController; + interface Windows.Gaming.Input.IGameController; + interface Windows.Gaming.Input.IGameControllerBatteryInfo; + [contract(Windows.Foundation.UniversalApiContract, 5.0)] interface Windows.Gaming.Input.IRawGameController2; } }
In windows.devices.haptics.idl.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- include/Makefile.in | 1 + include/windows.devices.haptics.idl | 91 +++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 include/windows.devices.haptics.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 04537ea72ef..8a8fddddada 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -776,6 +776,7 @@ SOURCES = \ windns.h \ windot11.h \ windows.devices.enumeration.idl \ + windows.devices.haptics.idl \ windows.foundation.collections.idl \ windows.foundation.idl \ windows.gaming.input.forcefeedback.idl \ diff --git a/include/windows.devices.haptics.idl b/include/windows.devices.haptics.idl new file mode 100644 index 00000000000..c056ab4941c --- /dev/null +++ b/include/windows.devices.haptics.idl @@ -0,0 +1,91 @@ +/* + * Copyright 2022 Rémi Bernon 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 + */ + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "inspectable.idl"; +import "windows.foundation.idl"; + +namespace Windows.Devices.Haptics { + interface ISimpleHapticsControllerFeedback; + interface ISimpleHapticsController; + runtimeclass SimpleHapticsControllerFeedback; + runtimeclass SimpleHapticsController; + + declare { + interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Haptics.SimpleHapticsController *>; + interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Haptics.SimpleHapticsControllerFeedback *>; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Haptics.SimpleHapticsControllerFeedback), + uuid(3d577ef8-4cee-11e6-b535-001bdc06ab3b) + ] + interface ISimpleHapticsControllerFeedback : IInspectable + { + [propget] HRESULT Waveform([out, retval] UINT16 *value); + [propget] HRESULT Duration([out, retval] Windows.Foundation.TimeSpan *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Haptics.SimpleHapticsController), + uuid(3d577ef9-4cee-11e6-b535-001bdc06ab3b) + ] + interface ISimpleHapticsController : IInspectable + { + [propget] HRESULT Id([out, retval] HSTRING *value); + [propget] HRESULT SupportedFeedback([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Haptics.SimpleHapticsControllerFeedback *> **value); + [propget] HRESULT IsIntensitySupported([out, retval] boolean *value); + [propget] HRESULT IsPlayCountSupported([out, retval] boolean *value); + [propget] HRESULT IsPlayDurationSupported([out, retval] boolean *value); + [propget] HRESULT IsReplayPauseIntervalSupported([out, retval] boolean *value); + HRESULT StopFeedback(); + [overload("SendHapticFeedback")] + HRESULT SendHapticFeedback([in] Windows.Devices.Haptics.SimpleHapticsControllerFeedback *feedback); + [overload("SendHapticFeedback")] + HRESULT SendHapticFeedbackWithIntensity([in] Windows.Devices.Haptics.SimpleHapticsControllerFeedback *feedback, + [in] DOUBLE intensity); + HRESULT SendHapticFeedbackForDuration([in] Windows.Devices.Haptics.SimpleHapticsControllerFeedback *feedback, + [in] DOUBLE intensity, [in] Windows.Foundation.TimeSpan duration); + HRESULT SendHapticFeedbackForPlayCount([in] Windows.Devices.Haptics.SimpleHapticsControllerFeedback *feedback, + [in] DOUBLE intensity, [in] INT32 count, + [in] Windows.Foundation.TimeSpan interval); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile) + ] + runtimeclass SimpleHapticsControllerFeedback + { + [default] interface Windows.Devices.Haptics.ISimpleHapticsControllerFeedback; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile) + ] + runtimeclass SimpleHapticsController + { + [default] interface Windows.Devices.Haptics.ISimpleHapticsController; + } +}
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- include/windows.gaming.input.idl | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/include/windows.gaming.input.idl b/include/windows.gaming.input.idl index ccc29922eb8..82b810ddbdd 100644 --- a/include/windows.gaming.input.idl +++ b/include/windows.gaming.input.idl @@ -25,6 +25,7 @@ import "asyncinfo.idl"; import "eventtoken.idl"; import "windowscontracts.idl"; import "windows.foundation.idl"; +import "windows.devices.haptics.idl"; import "windows.gaming.input.forcefeedback.idl"; import "windows.system.idl";
@@ -260,6 +261,20 @@ namespace Windows.Gaming.Input { HRESULT GetSwitchKind([in] INT32 index, [out, retval] Windows.Gaming.Input.GameControllerSwitchKind *value); }
+ [ + contract(Windows.Foundation.UniversalApiContract, 5.0), + exclusiveto(Windows.Gaming.Input.RawGameController), + uuid(43c0c035-bb73-4756-a787-3ed6bea617bd) + ] + interface IRawGameController2 : IInspectable + requires Windows.Gaming.Input.IRawGameController, + Windows.Gaming.Input.IGameController + { + [propget] HRESULT SimpleHapticsControllers([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Haptics.SimpleHapticsController *> **value); + [propget] HRESULT NonRoamableId([out, retval] HSTRING *value); + [propget] HRESULT DisplayName([out, retval] HSTRING *value); + } + [ object, uuid(8bbce529-d49c-39e9-9560-e47dde96b7c8)