Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b985fe63
Commit
b985fe63
authored
May 04, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows.gaming.input: Use a PROPVARIANT as async operation result.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d99ee027
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
15 deletions
+26
-15
async.c
dlls/windows.gaming.input/async.c
+15
-7
force_feedback.c
dlls/windows.gaming.input/force_feedback.c
+9
-6
private.h
dlls/windows.gaming.input/private.h
+2
-2
No files found.
dlls/windows.gaming.input/async.c
View file @
b985fe63
...
...
@@ -34,14 +34,13 @@ struct async_bool
IAsyncInfo
IAsyncInfo_iface
;
LONG
ref
;
BOOLEAN
result
;
async_operation_boolean_callback
callback
;
async_operation_callback
callback
;
TP_WORK
*
async_run_work
;
IInspectable
*
invoker
;
CRITICAL_SECTION
cs
;
IWineAsyncOperationCompletedHandler
*
handler
;
PROPVARIANT
result
;
AsyncStatus
status
;
HRESULT
hr
;
};
...
...
@@ -197,6 +196,7 @@ static ULONG WINAPI async_bool_Release( IAsyncOperation_boolean *iface )
{
IAsyncInfo_Close
(
&
impl
->
IAsyncInfo_iface
);
if
(
impl
->
handler
&&
impl
->
handler
!=
HANDLER_NOT_SET
)
IWineAsyncOperationCompletedHandler_Release
(
impl
->
handler
);
PropVariantClear
(
&
impl
->
result
);
IInspectable_Release
(
impl
->
invoker
);
DeleteCriticalSection
(
&
impl
->
cs
);
free
(
impl
);
...
...
@@ -276,19 +276,24 @@ static HRESULT WINAPI async_bool_get_Completed( IAsyncOperation_boolean *iface,
static
HRESULT
WINAPI
async_bool_GetResults
(
IAsyncOperation_boolean
*
iface
,
BOOLEAN
*
results
)
{
struct
async_bool
*
impl
=
impl_from_IAsyncOperation_boolean
(
iface
);
PROPVARIANT
result
=
{.
vt
=
VT_BOOL
};
HRESULT
hr
;
TRACE
(
"iface %p, results %p.
\n
"
,
iface
,
results
);
EnterCriticalSection
(
&
impl
->
cs
);
if
(
impl
->
status
!=
Completed
&&
impl
->
status
!=
Error
)
hr
=
E_ILLEGAL_METHOD_CALL
;
else
if
(
impl
->
result
.
vt
!=
result
.
vt
)
hr
=
E_UNEXPECTED
;
else
{
*
results
=
impl
->
result
;
PropVariantCopy
(
&
result
,
&
impl
->
result
);
if
(
impl
->
result
.
vt
==
VT_UNKNOWN
)
PropVariantClear
(
&
impl
->
result
);
hr
=
impl
->
hr
;
}
LeaveCriticalSection
(
&
impl
->
cs
);
*
results
=
result
.
boolVal
;
PropVariantClear
(
&
result
);
return
hr
;
}
...
...
@@ -312,14 +317,15 @@ static void CALLBACK async_run_cb( TP_CALLBACK_INSTANCE *instance, void *data, T
{
IAsyncOperation_boolean
*
operation
=
data
;
struct
async_bool
*
impl
=
impl_from_IAsyncOperation_boolean
(
operation
);
BOOLEAN
result
=
FALSE
;
PROPVARIANT
result
;
HRESULT
hr
;
PropVariantInit
(
&
result
);
hr
=
impl
->
callback
(
impl
->
invoker
,
&
result
);
EnterCriticalSection
(
&
impl
->
cs
);
if
(
impl
->
status
!=
Closed
)
impl
->
status
=
FAILED
(
hr
)
?
Error
:
Completed
;
impl
->
result
=
result
;
PropVariantCopy
(
&
impl
->
result
,
&
result
)
;
impl
->
hr
=
hr
;
if
(
impl
->
handler
!=
NULL
&&
impl
->
handler
!=
HANDLER_NOT_SET
)
...
...
@@ -335,9 +341,10 @@ static void CALLBACK async_run_cb( TP_CALLBACK_INSTANCE *instance, void *data, T
else
LeaveCriticalSection
(
&
impl
->
cs
);
IAsyncOperation_boolean_Release
(
operation
);
PropVariantClear
(
&
result
);
}
HRESULT
async_operation_boolean_create
(
IInspectable
*
invoker
,
async_operation_
boolean_
callback
callback
,
HRESULT
async_operation_boolean_create
(
IInspectable
*
invoker
,
async_operation_callback
callback
,
IAsyncOperation_boolean
**
out
)
{
struct
async_bool
*
impl
;
...
...
@@ -351,6 +358,7 @@ HRESULT async_operation_boolean_create( IInspectable *invoker, async_operation_b
impl
->
handler
=
HANDLER_NOT_SET
;
impl
->
callback
=
callback
;
impl
->
status
=
Started
;
impl
->
result
.
vt
=
VT_BOOL
;
if
(
!
(
impl
->
async_run_work
=
CreateThreadpoolWork
(
async_run_cb
,
&
impl
->
IAsyncOperation_boolean_iface
,
NULL
)))
{
...
...
dlls/windows.gaming.input/force_feedback.c
View file @
b985fe63
...
...
@@ -212,13 +212,14 @@ static HRESULT WINAPI motor_StopAllEffects( IForceFeedbackMotor *iface )
return
IDirectInputDevice8_SendForceFeedbackCommand
(
impl
->
device
,
DISFFC_STOPALL
);
}
static
HRESULT
WINAPI
motor_try_disable_async
(
IInspectable
*
iface
,
BOOLEAN
*
result
)
static
HRESULT
WINAPI
motor_try_disable_async
(
IInspectable
*
iface
,
PROPVARIANT
*
result
)
{
struct
motor
*
impl
=
impl_from_IForceFeedbackMotor
(
(
IForceFeedbackMotor
*
)
iface
);
HRESULT
hr
;
hr
=
IDirectInputDevice8_SendForceFeedbackCommand
(
impl
->
device
,
DISFFC_SETACTUATORSOFF
);
*
result
=
SUCCEEDED
(
hr
);
result
->
vt
=
VT_BOOL
;
result
->
boolVal
=
SUCCEEDED
(
hr
);
return
hr
;
}
...
...
@@ -229,13 +230,14 @@ static HRESULT WINAPI motor_TryDisableAsync( IForceFeedbackMotor *iface, IAsyncO
return
async_operation_boolean_create
(
(
IInspectable
*
)
iface
,
motor_try_disable_async
,
async_op
);
}
static
HRESULT
WINAPI
motor_try_enable_async
(
IInspectable
*
iface
,
BOOLEAN
*
result
)
static
HRESULT
WINAPI
motor_try_enable_async
(
IInspectable
*
iface
,
PROPVARIANT
*
result
)
{
struct
motor
*
impl
=
impl_from_IForceFeedbackMotor
(
(
IForceFeedbackMotor
*
)
iface
);
HRESULT
hr
;
hr
=
IDirectInputDevice8_SendForceFeedbackCommand
(
impl
->
device
,
DISFFC_SETACTUATORSON
);
*
result
=
SUCCEEDED
(
hr
);
result
->
vt
=
VT_BOOL
;
result
->
boolVal
=
SUCCEEDED
(
hr
);
return
hr
;
}
...
...
@@ -246,13 +248,14 @@ static HRESULT WINAPI motor_TryEnableAsync( IForceFeedbackMotor *iface, IAsyncOp
return
async_operation_boolean_create
(
(
IInspectable
*
)
iface
,
motor_try_enable_async
,
async_op
);
}
static
HRESULT
WINAPI
motor_try_reset_async
(
IInspectable
*
iface
,
BOOLEAN
*
result
)
static
HRESULT
WINAPI
motor_try_reset_async
(
IInspectable
*
iface
,
PROPVARIANT
*
result
)
{
struct
motor
*
impl
=
impl_from_IForceFeedbackMotor
(
(
IForceFeedbackMotor
*
)
iface
);
HRESULT
hr
;
hr
=
IDirectInputDevice8_SendForceFeedbackCommand
(
impl
->
device
,
DISFFC_RESET
);
*
result
=
SUCCEEDED
(
hr
);
result
->
vt
=
VT_BOOL
;
result
->
boolVal
=
SUCCEEDED
(
hr
);
return
hr
;
}
...
...
dlls/windows.gaming.input/private.h
View file @
b985fe63
...
...
@@ -67,8 +67,8 @@ extern void event_handlers_notify( struct list *list, IInspectable *element );
extern
HRESULT
force_feedback_motor_create
(
IDirectInputDevice8W
*
device
,
IForceFeedbackMotor
**
out
);
typedef
HRESULT
(
WINAPI
*
async_operation_
boolean_callback
)(
IInspectable
*
invoker
,
BOOLEAN
*
result
);
extern
HRESULT
async_operation_boolean_create
(
IInspectable
*
invoker
,
async_operation_
boolean_
callback
callback
,
typedef
HRESULT
(
WINAPI
*
async_operation_
callback
)(
IInspectable
*
invoker
,
PROPVARIANT
*
result
);
extern
HRESULT
async_operation_boolean_create
(
IInspectable
*
invoker
,
async_operation_callback
callback
,
IAsyncOperation_boolean
**
out
);
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment