Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
July 2019
- 65 participants
- 633 messages
[PATCH 3/5] strmbase: Remove several unused callbacks.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/qedit/nullrenderer.c | 26 +++++---------------------
dlls/quartz/dsoundrender.c | 36 ++++++++++++++----------------------
dlls/quartz/videorenderer.c | 32 ++++++++++----------------------
dlls/quartz/vmr9.c | 33 +++++++++++----------------------
dlls/strmbase/renderer.c | 23 ++---------------------
include/wine/strmbase.h | 34 ++++++++++++----------------------
6 files changed, 54 insertions(+), 130 deletions(-)
diff --git a/dlls/qedit/nullrenderer.c b/dlls/qedit/nullrenderer.c
index 82e6284bfe4..2c9aff8bc0f 100644
--- a/dlls/qedit/nullrenderer.c
+++ b/dlls/qedit/nullrenderer.c
@@ -55,27 +55,11 @@ static void null_renderer_destroy(BaseRenderer *iface)
CoTaskMemFree(filter);
}
-static const BaseRendererFuncTable RendererFuncTable = {
- NullRenderer_CheckMediaType,
- NullRenderer_DoRenderSample,
- /**/
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- /**/
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- null_renderer_destroy,
+static const BaseRendererFuncTable RendererFuncTable =
+{
+ .pfnCheckMediaType = NullRenderer_CheckMediaType,
+ .pfnDoRenderSample = NullRenderer_DoRenderSample,
+ .renderer_destroy = null_renderer_destroy,
};
static const IBaseFilterVtbl NullRenderer_Vtbl =
diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c
index 3f1e5429fc6..5cd5e11f9fe 100644
--- a/dlls/quartz/dsoundrender.c
+++ b/dlls/quartz/dsoundrender.c
@@ -601,28 +601,20 @@ static HRESULT dsound_render_query_interface(BaseRenderer *iface, REFIID iid, vo
return S_OK;
}
-static const BaseRendererFuncTable BaseFuncTable = {
- DSoundRender_CheckMediaType,
- DSoundRender_DoRenderSample,
- /**/
- NULL,
- NULL,
- NULL,
- DSoundRender_OnStartStreaming,
- DSoundRender_OnStopStreaming,
- NULL,
- NULL,
- NULL,
- DSoundRender_ShouldDrawSampleNow,
- DSoundRender_PrepareReceive,
- /**/
- DSoundRender_CompleteConnect,
- DSoundRender_BreakConnect,
- DSoundRender_EndOfStream,
- NULL,
- DSoundRender_EndFlush,
- dsound_render_destroy,
- dsound_render_query_interface,
+static const BaseRendererFuncTable BaseFuncTable =
+{
+ .pfnCheckMediaType = DSoundRender_CheckMediaType,
+ .pfnDoRenderSample = DSoundRender_DoRenderSample,
+ .pfnOnStartStreaming = DSoundRender_OnStartStreaming,
+ .pfnOnStopStreaming = DSoundRender_OnStopStreaming,
+ .pfnShouldDrawSampleNow = DSoundRender_ShouldDrawSampleNow,
+ .pfnPrepareReceive = DSoundRender_PrepareReceive,
+ .pfnCompleteConnect = DSoundRender_CompleteConnect,
+ .pfnBreakConnect = DSoundRender_BreakConnect,
+ .pfnEndOfStream = DSoundRender_EndOfStream,
+ .pfnEndFlush = DSoundRender_EndFlush,
+ .renderer_destroy = dsound_render_destroy,
+ .renderer_query_interface = dsound_render_query_interface,
};
HRESULT DSoundRender_create(IUnknown *outer, void **out)
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c
index 9a10fd275a0..ae866c8c62e 100644
--- a/dlls/quartz/videorenderer.c
+++ b/dlls/quartz/videorenderer.c
@@ -469,28 +469,16 @@ static BOOL WINAPI VideoRenderer_OnSize(BaseWindow *iface, LONG Width, LONG Heig
return BaseWindowImpl_OnSize(iface, Width, Height);
}
-static const BaseRendererFuncTable BaseFuncTable = {
- VideoRenderer_CheckMediaType,
- VideoRenderer_DoRenderSample,
- /**/
- NULL,
- NULL,
- NULL,
- VideoRenderer_OnStartStreaming,
- VideoRenderer_OnStopStreaming,
- NULL,
- NULL,
- NULL,
- VideoRenderer_ShouldDrawSampleNow,
- NULL,
- /**/
- NULL,
- NULL,
- NULL,
- NULL,
- VideoRenderer_EndFlush,
- video_renderer_destroy,
- video_renderer_query_interface,
+static const BaseRendererFuncTable BaseFuncTable =
+{
+ .pfnCheckMediaType = VideoRenderer_CheckMediaType,
+ .pfnDoRenderSample = VideoRenderer_DoRenderSample,
+ .pfnOnStartStreaming = VideoRenderer_OnStartStreaming,
+ .pfnOnStopStreaming = VideoRenderer_OnStopStreaming,
+ .pfnShouldDrawSampleNow = VideoRenderer_ShouldDrawSampleNow,
+ .pfnEndFlush = VideoRenderer_EndFlush,
+ .renderer_destroy = video_renderer_destroy,
+ .renderer_query_interface = video_renderer_query_interface,
};
static const BaseWindowFuncTable renderer_BaseWindowFuncTable = {
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c
index ee2d7a92956..bafe91da36a 100644
--- a/dlls/quartz/vmr9.c
+++ b/dlls/quartz/vmr9.c
@@ -558,28 +558,17 @@ static HRESULT vmr_query_interface(BaseRenderer *iface, REFIID iid, void **out)
return S_OK;
}
-static const BaseRendererFuncTable BaseFuncTable = {
- VMR9_CheckMediaType,
- VMR9_DoRenderSample,
- /**/
- NULL,
- NULL,
- NULL,
- VMR9_OnStartStreaming,
- VMR9_OnStopStreaming,
- NULL,
- NULL,
- NULL,
- VMR9_ShouldDrawSampleNow,
- NULL,
- /**/
- VMR9_CompleteConnect,
- VMR9_BreakConnect,
- NULL,
- NULL,
- NULL,
- vmr_destroy,
- vmr_query_interface,
+static const BaseRendererFuncTable BaseFuncTable =
+{
+ .pfnCheckMediaType = VMR9_CheckMediaType,
+ .pfnDoRenderSample = VMR9_DoRenderSample,
+ .pfnOnStartStreaming = VMR9_OnStartStreaming,
+ .pfnOnStopStreaming = VMR9_OnStopStreaming,
+ .pfnShouldDrawSampleNow = VMR9_ShouldDrawSampleNow,
+ .pfnCompleteConnect = VMR9_CompleteConnect,
+ .pfnBreakConnect = VMR9_BreakConnect,
+ .renderer_destroy = vmr_destroy,
+ .renderer_query_interface = vmr_query_interface,
};
static LPWSTR WINAPI VMR9_GetClassWindowStyles(BaseWindow *This, DWORD *pClassStyles, DWORD *pWindowStyles, DWORD *pWindowStylesEx)
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c
index 46f0da2fa5d..b73ce5469cd 100644
--- a/dlls/strmbase/renderer.c
+++ b/dlls/strmbase/renderer.c
@@ -117,12 +117,7 @@ static HRESULT WINAPI BaseRenderer_InputPin_BeginFlush(IPin * iface)
EnterCriticalSection(&pFilter->filter.csFilter);
hr = BaseInputPinImpl_BeginFlush(iface);
if (SUCCEEDED(hr))
- {
- if (pFilter->pFuncsTable->pfnBeginFlush)
- hr = pFilter->pFuncsTable->pfnBeginFlush(pFilter);
- else
- hr = BaseRendererImpl_BeginFlush(pFilter);
- }
+ hr = BaseRendererImpl_BeginFlush(pFilter);
LeaveCriticalSection(&pFilter->filter.csFilter);
LeaveCriticalSection(&pFilter->csRenderLock);
return hr;
@@ -334,17 +329,9 @@ HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSamp
return hr;
}
- if (This->pFuncsTable->pfnPrepareRender)
- This->pFuncsTable->pfnPrepareRender(This);
-
EnterCriticalSection(&This->csRenderLock);
- if ( This->filter.state == State_Paused )
- {
- if (This->pFuncsTable->pfnOnReceiveFirstSample)
- This->pFuncsTable->pfnOnReceiveFirstSample(This, pSample);
-
+ if (This->filter.state == State_Paused)
SetEvent(This->state_event);
- }
/* Wait for render Time */
if (This->filter.pClock && SUCCEEDED(IMediaSample_GetTime(pSample, &start, &stop)))
@@ -361,9 +348,6 @@ HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSamp
REFERENCE_TIME now;
DWORD_PTR cookie;
- if (This->pFuncsTable->pfnOnWaitStart)
- This->pFuncsTable->pfnOnWaitStart(This);
-
IReferenceClock_GetTime(This->filter.pClock, &now);
if (now - This->filter.rtStreamStart - start <= -10000)
@@ -380,9 +364,6 @@ HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSamp
EnterCriticalSection(&This->csRenderLock);
}
-
- if (This->pFuncsTable->pfnOnWaitEnd)
- This->pFuncsTable->pfnOnWaitEnd(This);
}
else
{
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index a499374fe40..6e369b872f9 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -576,28 +576,18 @@ typedef HRESULT (WINAPI *BaseRenderer_BreakConnect) (BaseRenderer *This);
typedef HRESULT (WINAPI *BaseRenderer_CompleteConnect) (BaseRenderer *This, IPin *pReceivePin);
typedef struct BaseRendererFuncTable {
- /* Required */
- BaseRenderer_CheckMediaType pfnCheckMediaType;
- BaseRenderer_DoRenderSample pfnDoRenderSample;
- /* Optional, Data Handlers */
- BaseRenderer_OnReceiveFirstSample pfnOnReceiveFirstSample;
- BaseRenderer_OnRenderEnd pfnOnRenderEnd;
- BaseRenderer_OnRenderStart pfnOnRenderStart;
- BaseRenderer_OnStartStreaming pfnOnStartStreaming;
- BaseRenderer_OnStopStreaming pfnOnStopStreaming;
- BaseRenderer_OnWaitEnd pfnOnWaitEnd;
- BaseRenderer_OnWaitStart pfnOnWaitStart;
- BaseRenderer_PrepareRender pfnPrepareRender;
- BaseRenderer_ShouldDrawSampleNow pfnShouldDrawSampleNow;
- BaseRenderer_PrepareReceive pfnPrepareReceive;
- /* Optional, Input Pin */
- BaseRenderer_CompleteConnect pfnCompleteConnect;
- BaseRenderer_BreakConnect pfnBreakConnect;
- BaseRenderer_EndOfStream pfnEndOfStream;
- BaseRenderer_BeginFlush pfnBeginFlush;
- BaseRenderer_EndFlush pfnEndFlush;
- void (*renderer_destroy)(BaseRenderer *iface);
- HRESULT (*renderer_query_interface)(BaseRenderer *iface, REFIID iid, void **out);
+ BaseRenderer_CheckMediaType pfnCheckMediaType;
+ BaseRenderer_DoRenderSample pfnDoRenderSample;
+ BaseRenderer_OnStartStreaming pfnOnStartStreaming;
+ BaseRenderer_OnStopStreaming pfnOnStopStreaming;
+ BaseRenderer_ShouldDrawSampleNow pfnShouldDrawSampleNow;
+ BaseRenderer_PrepareReceive pfnPrepareReceive;
+ BaseRenderer_CompleteConnect pfnCompleteConnect;
+ BaseRenderer_BreakConnect pfnBreakConnect;
+ BaseRenderer_EndOfStream pfnEndOfStream;
+ BaseRenderer_EndFlush pfnEndFlush;
+ void (*renderer_destroy)(BaseRenderer *iface);
+ HRESULT (*renderer_query_interface)(BaseRenderer *iface, REFIID iid, void **out);
} BaseRendererFuncTable;
HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSample);
--
2.22.0
July 3, 2019
[PATCH 2/5] quartz/dsoundrender: Use BaseRendererImpl_Pause().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/dsoundrender.c | 30 +-----------------------------
1 file changed, 1 insertion(+), 29 deletions(-)
diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c
index 8afb094af82..3f1e5429fc6 100644
--- a/dlls/quartz/dsoundrender.c
+++ b/dlls/quartz/dsoundrender.c
@@ -681,34 +681,6 @@ HRESULT DSoundRender_create(IUnknown *outer, void **out)
return hr;
}
-static HRESULT WINAPI DSoundRender_Pause(IBaseFilter * iface)
-{
- DSoundRenderImpl *This = impl_from_IBaseFilter(iface);
- HRESULT hr = S_OK;
-
- TRACE("(%p/%p)->()\n", This, iface);
-
- EnterCriticalSection(&This->renderer.csRenderLock);
- if (This->renderer.filter.state != State_Paused)
- {
- if (This->renderer.filter.state == State_Stopped)
- {
- if (This->renderer.sink.pin.pConnectedTo)
- ResetEvent(This->renderer.state_event);
- This->renderer.sink.end_of_stream = 0;
- }
-
- hr = IDirectSoundBuffer_Stop(This->dsbuffer);
- if (SUCCEEDED(hr))
- This->renderer.filter.state = State_Paused;
-
- ResetEvent(This->renderer.flush_event);
- }
- LeaveCriticalSection(&This->renderer.csRenderLock);
-
- return hr;
-}
-
static const IBaseFilterVtbl DSoundRender_Vtbl =
{
BaseFilterImpl_QueryInterface,
@@ -716,7 +688,7 @@ static const IBaseFilterVtbl DSoundRender_Vtbl =
BaseFilterImpl_Release,
BaseFilterImpl_GetClassID,
BaseRendererImpl_Stop,
- DSoundRender_Pause,
+ BaseRendererImpl_Pause,
BaseRendererImpl_Run,
BaseRendererImpl_GetState,
BaseRendererImpl_SetSyncSource,
--
2.22.0
July 3, 2019
[PATCH 1/5] quartz/dsoundrender: Use flush_event instead of reimplementing it.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/dsoundrender.c | 39 +++-----------------------------------
1 file changed, 3 insertions(+), 36 deletions(-)
diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c
index f9fef51b562..8afb094af82 100644
--- a/dlls/quartz/dsoundrender.c
+++ b/dlls/quartz/dsoundrender.c
@@ -64,8 +64,6 @@ typedef struct DSoundRenderImpl
REFERENCE_TIME play_time;
- HANDLE blocked;
-
LONG volume;
LONG pan;
@@ -245,7 +243,7 @@ static HRESULT DSoundRender_HandleEndOfStream(DSoundRenderImpl *This)
This->in_loop = 1;
LeaveCriticalSection(&This->renderer.filter.csFilter);
LeaveCriticalSection(&This->renderer.csRenderLock);
- WaitForSingleObject(This->blocked, 10);
+ WaitForSingleObject(This->renderer.flush_event, 10);
EnterCriticalSection(&This->renderer.csRenderLock);
EnterCriticalSection(&This->renderer.filter.csFilter);
This->in_loop = 0;
@@ -270,7 +268,7 @@ static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, REFERENCE_TIM
if (hr != S_OK) {
This->in_loop = 1;
LeaveCriticalSection(&This->renderer.csRenderLock);
- ret = WaitForSingleObject(This->blocked, 10);
+ ret = WaitForSingleObject(This->renderer.flush_event, 10);
EnterCriticalSection(&This->renderer.csRenderLock);
This->in_loop = 0;
if (This->renderer.sink.flushing || This->renderer.filter.state == State_Stopped)
@@ -434,7 +432,6 @@ static VOID WINAPI DSoundRender_OnStopStreaming(BaseRenderer * iface)
IDirectSoundBuffer_Stop(This->dsbuffer);
This->writepos = This->buf_size;
- SetEvent(This->blocked);
}
static VOID WINAPI DSoundRender_OnStartStreaming(BaseRenderer * iface)
@@ -445,13 +442,7 @@ static VOID WINAPI DSoundRender_OnStartStreaming(BaseRenderer * iface)
if (This->renderer.sink.pin.pConnectedTo)
{
- if (This->renderer.filter.state == State_Paused)
- {
- /* Unblock our thread, state changing from paused to running doesn't need a reset for state change */
- SetEvent(This->blocked);
- }
IDirectSoundBuffer_Play(This->dsbuffer, 0, 0, DSBPLAY_LOOPING);
- ResetEvent(This->blocked);
}
}
@@ -548,17 +539,6 @@ static HRESULT WINAPI DSoundRender_EndOfStream(BaseRenderer* iface)
return hr;
}
-static HRESULT WINAPI DSoundRender_BeginFlush(BaseRenderer* iface)
-{
- DSoundRenderImpl *This = impl_from_BaseRenderer(iface);
-
- TRACE("\n");
- BaseRendererImpl_BeginFlush(iface);
- SetEvent(This->blocked);
-
- return S_OK;
-}
-
static HRESULT WINAPI DSoundRender_EndFlush(BaseRenderer* iface)
{
DSoundRenderImpl *This = impl_from_BaseRenderer(iface);
@@ -566,8 +546,6 @@ static HRESULT WINAPI DSoundRender_EndFlush(BaseRenderer* iface)
TRACE("\n");
BaseRendererImpl_EndFlush(iface);
- if (This->renderer.filter.state != State_Stopped)
- ResetEvent(This->blocked);
if (This->dsbuffer)
{
@@ -602,8 +580,6 @@ static void dsound_render_destroy(BaseRenderer *iface)
IDirectSound8_Release(filter->dsound);
filter->dsound = NULL;
- CloseHandle(filter->blocked);
-
strmbase_renderer_cleanup(&filter->renderer);
CoTaskMemFree(filter);
}
@@ -643,7 +619,7 @@ static const BaseRendererFuncTable BaseFuncTable = {
DSoundRender_CompleteConnect,
DSoundRender_BreakConnect,
DSoundRender_EndOfStream,
- DSoundRender_BeginFlush,
+ NULL,
DSoundRender_EndFlush,
dsound_render_destroy,
dsound_render_query_interface,
@@ -694,14 +670,6 @@ HRESULT DSoundRender_create(IUnknown *outer, void **out)
if (SUCCEEDED(hr))
{
- pDSoundRender->blocked = CreateEventW(NULL, TRUE, TRUE, NULL);
-
- if (!pDSoundRender->blocked || FAILED(hr))
- {
- IBaseFilter_Release(&pDSoundRender->renderer.filter.IBaseFilter_iface);
- return HRESULT_FROM_WIN32(GetLastError());
- }
-
*out = &pDSoundRender->renderer.filter.IUnknown_inner;
}
else
@@ -734,7 +702,6 @@ static HRESULT WINAPI DSoundRender_Pause(IBaseFilter * iface)
if (SUCCEEDED(hr))
This->renderer.filter.state = State_Paused;
- ResetEvent(This->blocked);
ResetEvent(This->renderer.flush_event);
}
LeaveCriticalSection(&This->renderer.csRenderLock);
--
2.22.0
July 3, 2019
Re: [PATCH v3 6/6] winex11.drv: Implement native mouse-movement raw-input using RawMotion.
by Derek Lesho
I needed to add the default values for input.u.mi.d* to replace the
XI_ButtonPress workaround, as that workaround broke native rawinput.
On Tue, Jul 2, 2019 at 8:48 PM Derek Lesho <dereklesho52(a)gmail.com> wrote:
> Signed-off-by: Derek Lesho <dereklesho52(a)Gmail.com>
> ---
> dlls/winex11.drv/mouse.c | 101 ++++++++++++++++++++++++++-------
> dlls/winex11.drv/x11drv.h | 6 +-
> dlls/winex11.drv/x11drv_main.c | 10 ++++
> 3 files changed, 94 insertions(+), 23 deletions(-)
>
> diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
> index f737a306a5..8110bafb44 100644
> --- a/dlls/winex11.drv/mouse.c
> +++ b/dlls/winex11.drv/mouse.c
> @@ -284,11 +284,26 @@ static void update_relative_valuators(XIAnyClassInfo
> **valuators, int n_valuator
> }
> #endif
>
> +/***********************************************************************
> + * inform_wineserver
> + */
> +static void inform_wineserver(void)
> +{
> + static int once = 0;
> + if (!once)
> + {
> + RAWINPUT raw_input;
> + raw_input.header.dwType = RIM_ENABLE_NATIVE_MOUSE_MOVE;
> + __wine_send_raw_input(&raw_input);
> + once = 1;
> + }
> +}
> +
>
> /***********************************************************************
> - * enable_xinput2
> + * X11DRV_XInput2_Enable
> */
> -static void enable_xinput2(void)
> +void X11DRV_XInput2_Enable(void)
> {
> #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
> struct x11drv_thread_data *data = x11drv_thread_data();
> @@ -318,7 +333,6 @@ static void enable_xinput2(void)
> memset( mask_bits, 0, sizeof(mask_bits) );
> XISetMask( mask_bits, XI_DeviceChanged );
> XISetMask( mask_bits, XI_RawMotion );
> - XISetMask( mask_bits, XI_ButtonPress );
>
> pXISelectEvents( data->display, DefaultRootWindow( data->display ),
> &mask, 1 );
>
> @@ -337,19 +351,21 @@ static void enable_xinput2(void)
> data->xi2_current_slave = 0;
>
> data->xi2_state = xi_enabled;
> +
> + inform_wineserver();
> #endif
> }
>
> /***********************************************************************
> - * disable_xinput2
> + * X11DRV_XInput2_Disable
> */
> -static void disable_xinput2(void)
> +void X11DRV_XInput2_Disable(void)
> {
> #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
> struct x11drv_thread_data *data = x11drv_thread_data();
> XIEventMask mask;
>
> - if (data->xi2_state != xi_enabled) return;
> + if (data->xi2_state < xi_enabled) return;
>
> TRACE( "disabling\n" );
> data->xi2_state = xi_disabled;
> @@ -368,6 +384,21 @@ static void disable_xinput2(void)
> #endif
> }
>
> +static void use_xinput2_path(void)
> +{
> + struct x11drv_thread_data *thread_data = x11drv_thread_data();
> +
> + if (thread_data->xi2_state == xi_enabled)
> + thread_data->xi2_state = xi_extra;
> +}
> +
> +static void disable_xinput2_path(void)
> +{
> + struct x11drv_thread_data *thread_data = x11drv_thread_data();
> +
> + if (thread_data->xi2_state == xi_extra)
> + thread_data->xi2_state = xi_enabled;
> +}
>
> /***********************************************************************
> * grab_clipping_window
> @@ -393,9 +424,9 @@ static BOOL grab_clipping_window( const RECT *clip )
> return TRUE;
>
> /* enable XInput2 unless we are already clipping */
> - if (!data->clip_hwnd) enable_xinput2();
> + if (!data->clip_hwnd) use_xinput2_path();
>
> - if (data->xi2_state != xi_enabled)
> + if (data->xi2_state < xi_extra)
> {
> WARN( "XInput2 not supported, refusing to clip to %s\n",
> wine_dbgstr_rect(clip) );
> DestroyWindow( msg_hwnd );
> @@ -423,7 +454,7 @@ static BOOL grab_clipping_window( const RECT *clip )
>
> if (!clipping_cursor)
> {
> - disable_xinput2();
> + disable_xinput2_path();
> DestroyWindow( msg_hwnd );
> return FALSE;
> }
> @@ -489,7 +520,7 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND
> new_clip_hwnd )
> TRACE( "clip hwnd reset from %p\n", hwnd );
> data->clip_hwnd = 0;
> data->clip_reset = GetTickCount();
> - disable_xinput2();
> + disable_xinput2_path();
> DestroyWindow( hwnd );
> }
> else if (hwnd == GetForegroundWindow()) /* request to clip */
> @@ -1724,16 +1755,18 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie
> *xev )
> {
> XIRawEvent *event = xev->data;
> const double *values = event->valuators.values;
> + const double *raw_values = event->raw_values;
> RECT virtual_rect;
> INPUT input;
> + RAWINPUT raw_input;
> int i;
> - double dx = 0, dy = 0, val;
> + double dx = 0, dy = 0, raw_dx = 0, raw_dy = 0, val, raw_val;
> struct x11drv_thread_data *thread_data = x11drv_thread_data();
> struct x11drv_valuator_data *x_rel, *y_rel;
>
> if (thread_data->x_rel_valuator.number < 0 ||
> thread_data->y_rel_valuator.number < 0) return FALSE;
> if (!event->valuators.mask_len) return FALSE;
> - if (thread_data->xi2_state != xi_enabled) return FALSE;
> + if (thread_data->xi2_state < xi_enabled) return FALSE;
>
> /* If there is no slave currently detected, no previous motion nor
> device
> * change events were received. Look it up now on the device list in
> this
> @@ -1758,25 +1791,25 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie
> *xev )
> x_rel = &thread_data->x_rel_valuator;
> y_rel = &thread_data->y_rel_valuator;
>
> - input.u.mi.mouseData = 0;
> - input.u.mi.dwFlags = MOUSEEVENTF_MOVE;
> - input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
> - input.u.mi.dwExtraInfo = 0;
> - input.u.mi.dx = 0;
> - input.u.mi.dy = 0;
> -
> virtual_rect = get_virtual_screen_rect();
>
> + /* sometimes we don't get X and Y valuators */
> + input.u.mi.dx = 0;
> + input.u.mi.dy = 0;
> +
> for (i = 0; i <= max ( x_rel->number, y_rel->number ); i++)
> {
> if (!XIMaskIsSet( event->valuators.mask, i )) continue;
> val = *values++;
> + raw_val = *raw_values++;
> if (i == x_rel->number)
> {
> input.u.mi.dx = dx = val;
> if (x_rel->min < x_rel->max)
> input.u.mi.dx = val * (virtual_rect.right -
> virtual_rect.left)
> / (x_rel->max - x_rel->min);
> +
> + raw_dx = raw_val;
> }
> if (i == y_rel->number)
> {
> @@ -1784,6 +1817,8 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie
> *xev )
> if (y_rel->min < y_rel->max)
> input.u.mi.dy = val * (virtual_rect.bottom -
> virtual_rect.top)
> / (y_rel->max - y_rel->min);
> +
> + raw_dy = raw_val;
> }
> }
>
> @@ -1793,10 +1828,32 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie
> *xev )
> return FALSE;
> }
>
> - TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx,
> dy );
> + raw_input.data.mouse.lLastX = raw_dx;
> + raw_input.data.mouse.lLastY = raw_dy;
> + raw_input.data.mouse.u.usButtonFlags = 0;
> + raw_input.data.mouse.u.usButtonData = 0;
> + raw_input.data.mouse.ulExtraInformation = 0;
> +
> + TRACE("raw event %f,%f\n", raw_dx, raw_dy);
> +
> + raw_input.header.dwType = RIM_TYPEMOUSE;
> +
> + if ( LIST_ENTRY((&g_x11_threads)->next, struct x11drv_thread_data,
> entry) == thread_data )
> + __wine_send_raw_input( &raw_input );
> +
> + if (thread_data->xi2_state == xi_extra)
> + {
> + input.u.mi.mouseData = 0;
> + input.u.mi.dwFlags = MOUSEEVENTF_MOVE;
> + input.u.mi.time = EVENT_x11_time_to_win32_time(
> event->time );
> + input.u.mi.dwExtraInfo = 0;
> +
> + TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy,
> dx, dy );
> +
> + input.type = INPUT_MOUSE;
> + __wine_send_input( 0, &input );
> + }
>
> - input.type = INPUT_MOUSE;
> - __wine_send_input( 0, &input );
> return TRUE;
> }
>
> diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
> index a0308b0675..378c1d7508 100644
> --- a/dlls/winex11.drv/x11drv.h
> +++ b/dlls/winex11.drv/x11drv.h
> @@ -194,6 +194,8 @@ extern BOOL X11DRV_UnrealizePalette( HPALETTE hpal )
> DECLSPEC_HIDDEN;
>
> extern void X11DRV_Xcursor_Init(void) DECLSPEC_HIDDEN;
> extern void X11DRV_XInput2_Init(void) DECLSPEC_HIDDEN;
> +extern void X11DRV_XInput2_Enable(void) DECLSPEC_HIDDEN;
> +extern void X11DRV_XInput2_Disable(void) DECLSPEC_HIDDEN;
>
> extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage
> *image,
> const struct gdi_image_bits *src_bits,
> struct gdi_image_bits *dst_bits,
> @@ -335,14 +337,16 @@ struct x11drv_thread_data
> HWND clip_hwnd; /* message window stored in desktop
> while clipping is active */
> DWORD clip_reset; /* time when clipping was last reset */
> HKL kbd_layout; /* active keyboard layout */
> - enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled }
> xi2_state; /* XInput2 state */
> + enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled,
> xi_extra } xi2_state; /* XInput2 state */
> void *xi2_devices; /* list of XInput2 devices (valid when
> state is enabled) */
> int xi2_device_count;
> struct x11drv_valuator_data x_rel_valuator;
> struct x11drv_valuator_data y_rel_valuator;
> int xi2_core_pointer; /* XInput2 core pointer id */
> int xi2_current_slave; /* Current slave driving the Core
> pointer */
> + struct list entry; /* Entry in global list of setup X11
> threads */
> };
> +extern struct list g_x11_threads DECLSPEC_HIDDEN; /* Global list of setup
> X11 threads */
>
> extern struct x11drv_thread_data *x11drv_init_thread_data(void)
> DECLSPEC_HIDDEN;
> extern DWORD thread_data_tls_index DECLSPEC_HIDDEN;
> diff --git a/dlls/winex11.drv/x11drv_main.c
> b/dlls/winex11.drv/x11drv_main.c
> index e67a3c05a9..685b3dd0f4 100644
> --- a/dlls/winex11.drv/x11drv_main.c
> +++ b/dlls/winex11.drv/x11drv_main.c
> @@ -601,6 +601,9 @@ static BOOL process_attach(void)
> }
>
>
> +struct list g_x11_threads = LIST_INIT( g_x11_threads );
> +
> +
> /***********************************************************************
> * ThreadDetach (X11DRV.@)
> */
> @@ -610,6 +613,9 @@ void CDECL X11DRV_ThreadDetach(void)
>
> if (data)
> {
> + list_remove( &data->entry );
> + X11DRV_XInput2_Disable();
> +
> if (data->xim) XCloseIM( data->xim );
> if (data->font_set) XFreeFontSet( data->display, data->font_set );
> XCloseDisplay( data->display );
> @@ -680,6 +686,10 @@ struct x11drv_thread_data
> *x11drv_init_thread_data(void)
>
> if (use_xim) X11DRV_SetupXIM();
>
> + X11DRV_XInput2_Enable();
> +
> + list_add_tail( &g_x11_threads, &data->entry );
> +
> return data;
> }
>
> --
> 2.21.0
>
>
July 3, 2019
[PATCH v3 6/6] winex11.drv: Implement native mouse-movement raw-input using RawMotion.
by Derek Lesho
Signed-off-by: Derek Lesho <dereklesho52(a)Gmail.com>
---
dlls/winex11.drv/mouse.c | 101 ++++++++++++++++++++++++++-------
dlls/winex11.drv/x11drv.h | 6 +-
dlls/winex11.drv/x11drv_main.c | 10 ++++
3 files changed, 94 insertions(+), 23 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index f737a306a5..8110bafb44 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -284,11 +284,26 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
}
#endif
+/***********************************************************************
+ * inform_wineserver
+ */
+static void inform_wineserver(void)
+{
+ static int once = 0;
+ if (!once)
+ {
+ RAWINPUT raw_input;
+ raw_input.header.dwType = RIM_ENABLE_NATIVE_MOUSE_MOVE;
+ __wine_send_raw_input(&raw_input);
+ once = 1;
+ }
+}
+
/***********************************************************************
- * enable_xinput2
+ * X11DRV_XInput2_Enable
*/
-static void enable_xinput2(void)
+void X11DRV_XInput2_Enable(void)
{
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
struct x11drv_thread_data *data = x11drv_thread_data();
@@ -318,7 +333,6 @@ static void enable_xinput2(void)
memset( mask_bits, 0, sizeof(mask_bits) );
XISetMask( mask_bits, XI_DeviceChanged );
XISetMask( mask_bits, XI_RawMotion );
- XISetMask( mask_bits, XI_ButtonPress );
pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 );
@@ -337,19 +351,21 @@ static void enable_xinput2(void)
data->xi2_current_slave = 0;
data->xi2_state = xi_enabled;
+
+ inform_wineserver();
#endif
}
/***********************************************************************
- * disable_xinput2
+ * X11DRV_XInput2_Disable
*/
-static void disable_xinput2(void)
+void X11DRV_XInput2_Disable(void)
{
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
struct x11drv_thread_data *data = x11drv_thread_data();
XIEventMask mask;
- if (data->xi2_state != xi_enabled) return;
+ if (data->xi2_state < xi_enabled) return;
TRACE( "disabling\n" );
data->xi2_state = xi_disabled;
@@ -368,6 +384,21 @@ static void disable_xinput2(void)
#endif
}
+static void use_xinput2_path(void)
+{
+ struct x11drv_thread_data *thread_data = x11drv_thread_data();
+
+ if (thread_data->xi2_state == xi_enabled)
+ thread_data->xi2_state = xi_extra;
+}
+
+static void disable_xinput2_path(void)
+{
+ struct x11drv_thread_data *thread_data = x11drv_thread_data();
+
+ if (thread_data->xi2_state == xi_extra)
+ thread_data->xi2_state = xi_enabled;
+}
/***********************************************************************
* grab_clipping_window
@@ -393,9 +424,9 @@ static BOOL grab_clipping_window( const RECT *clip )
return TRUE;
/* enable XInput2 unless we are already clipping */
- if (!data->clip_hwnd) enable_xinput2();
+ if (!data->clip_hwnd) use_xinput2_path();
- if (data->xi2_state != xi_enabled)
+ if (data->xi2_state < xi_extra)
{
WARN( "XInput2 not supported, refusing to clip to %s\n", wine_dbgstr_rect(clip) );
DestroyWindow( msg_hwnd );
@@ -423,7 +454,7 @@ static BOOL grab_clipping_window( const RECT *clip )
if (!clipping_cursor)
{
- disable_xinput2();
+ disable_xinput2_path();
DestroyWindow( msg_hwnd );
return FALSE;
}
@@ -489,7 +520,7 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd )
TRACE( "clip hwnd reset from %p\n", hwnd );
data->clip_hwnd = 0;
data->clip_reset = GetTickCount();
- disable_xinput2();
+ disable_xinput2_path();
DestroyWindow( hwnd );
}
else if (hwnd == GetForegroundWindow()) /* request to clip */
@@ -1724,16 +1755,18 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
{
XIRawEvent *event = xev->data;
const double *values = event->valuators.values;
+ const double *raw_values = event->raw_values;
RECT virtual_rect;
INPUT input;
+ RAWINPUT raw_input;
int i;
- double dx = 0, dy = 0, val;
+ double dx = 0, dy = 0, raw_dx = 0, raw_dy = 0, val, raw_val;
struct x11drv_thread_data *thread_data = x11drv_thread_data();
struct x11drv_valuator_data *x_rel, *y_rel;
if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) return FALSE;
if (!event->valuators.mask_len) return FALSE;
- if (thread_data->xi2_state != xi_enabled) return FALSE;
+ if (thread_data->xi2_state < xi_enabled) return FALSE;
/* If there is no slave currently detected, no previous motion nor device
* change events were received. Look it up now on the device list in this
@@ -1758,25 +1791,25 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
x_rel = &thread_data->x_rel_valuator;
y_rel = &thread_data->y_rel_valuator;
- input.u.mi.mouseData = 0;
- input.u.mi.dwFlags = MOUSEEVENTF_MOVE;
- input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
- input.u.mi.dwExtraInfo = 0;
- input.u.mi.dx = 0;
- input.u.mi.dy = 0;
-
virtual_rect = get_virtual_screen_rect();
+ /* sometimes we don't get X and Y valuators */
+ input.u.mi.dx = 0;
+ input.u.mi.dy = 0;
+
for (i = 0; i <= max ( x_rel->number, y_rel->number ); i++)
{
if (!XIMaskIsSet( event->valuators.mask, i )) continue;
val = *values++;
+ raw_val = *raw_values++;
if (i == x_rel->number)
{
input.u.mi.dx = dx = val;
if (x_rel->min < x_rel->max)
input.u.mi.dx = val * (virtual_rect.right - virtual_rect.left)
/ (x_rel->max - x_rel->min);
+
+ raw_dx = raw_val;
}
if (i == y_rel->number)
{
@@ -1784,6 +1817,8 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
if (y_rel->min < y_rel->max)
input.u.mi.dy = val * (virtual_rect.bottom - virtual_rect.top)
/ (y_rel->max - y_rel->min);
+
+ raw_dy = raw_val;
}
}
@@ -1793,10 +1828,32 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
return FALSE;
}
- TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
+ raw_input.data.mouse.lLastX = raw_dx;
+ raw_input.data.mouse.lLastY = raw_dy;
+ raw_input.data.mouse.u.usButtonFlags = 0;
+ raw_input.data.mouse.u.usButtonData = 0;
+ raw_input.data.mouse.ulExtraInformation = 0;
+
+ TRACE("raw event %f,%f\n", raw_dx, raw_dy);
+
+ raw_input.header.dwType = RIM_TYPEMOUSE;
+
+ if ( LIST_ENTRY((&g_x11_threads)->next, struct x11drv_thread_data, entry) == thread_data )
+ __wine_send_raw_input( &raw_input );
+
+ if (thread_data->xi2_state == xi_extra)
+ {
+ input.u.mi.mouseData = 0;
+ input.u.mi.dwFlags = MOUSEEVENTF_MOVE;
+ input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
+ input.u.mi.dwExtraInfo = 0;
+
+ TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
+
+ input.type = INPUT_MOUSE;
+ __wine_send_input( 0, &input );
+ }
- input.type = INPUT_MOUSE;
- __wine_send_input( 0, &input );
return TRUE;
}
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index a0308b0675..378c1d7508 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -194,6 +194,8 @@ extern BOOL X11DRV_UnrealizePalette( HPALETTE hpal ) DECLSPEC_HIDDEN;
extern void X11DRV_Xcursor_Init(void) DECLSPEC_HIDDEN;
extern void X11DRV_XInput2_Init(void) DECLSPEC_HIDDEN;
+extern void X11DRV_XInput2_Enable(void) DECLSPEC_HIDDEN;
+extern void X11DRV_XInput2_Disable(void) DECLSPEC_HIDDEN;
extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image,
const struct gdi_image_bits *src_bits, struct gdi_image_bits *dst_bits,
@@ -335,14 +337,16 @@ struct x11drv_thread_data
HWND clip_hwnd; /* message window stored in desktop while clipping is active */
DWORD clip_reset; /* time when clipping was last reset */
HKL kbd_layout; /* active keyboard layout */
- enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */
+ enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled, xi_extra } xi2_state; /* XInput2 state */
void *xi2_devices; /* list of XInput2 devices (valid when state is enabled) */
int xi2_device_count;
struct x11drv_valuator_data x_rel_valuator;
struct x11drv_valuator_data y_rel_valuator;
int xi2_core_pointer; /* XInput2 core pointer id */
int xi2_current_slave; /* Current slave driving the Core pointer */
+ struct list entry; /* Entry in global list of setup X11 threads */
};
+extern struct list g_x11_threads DECLSPEC_HIDDEN; /* Global list of setup X11 threads */
extern struct x11drv_thread_data *x11drv_init_thread_data(void) DECLSPEC_HIDDEN;
extern DWORD thread_data_tls_index DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index e67a3c05a9..685b3dd0f4 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -601,6 +601,9 @@ static BOOL process_attach(void)
}
+struct list g_x11_threads = LIST_INIT( g_x11_threads );
+
+
/***********************************************************************
* ThreadDetach (X11DRV.@)
*/
@@ -610,6 +613,9 @@ void CDECL X11DRV_ThreadDetach(void)
if (data)
{
+ list_remove( &data->entry );
+ X11DRV_XInput2_Disable();
+
if (data->xim) XCloseIM( data->xim );
if (data->font_set) XFreeFontSet( data->display, data->font_set );
XCloseDisplay( data->display );
@@ -680,6 +686,10 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
if (use_xim) X11DRV_SetupXIM();
+ X11DRV_XInput2_Enable();
+
+ list_add_tail( &g_x11_threads, &data->entry );
+
return data;
}
--
2.21.0
July 3, 2019
Re: [PATCH 8/8] user32: Also scan for mouse devices in GetRawInputDeviceList().
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=54378
Your paranoid android.
=== wxppro (32 bit report) ===
user32:
input.c:1671: Test failed: Failed to open L"\\??\\Root#RDP_KBD#0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\ACPI#PNP0303#4&2c5a7332&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\Root#RDP_MOU#0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\HID#Vid_0627&Pid_0001#6&2e2010ad&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\ACPI#PNP0F13#4&2c5a7332&0#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
=== w2003std (32 bit report) ===
user32:
input.c:1671: Test failed: Failed to open L"\\??\\Root#RDP_KBD#0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\ACPI#PNP0303#4&2c5a7332&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\Root#RDP_MOU#0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\HID#Vid_0627&Pid_0001#6&2e2010ad&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\ACPI#PNP0F13#4&2c5a7332&0#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
July 3, 2019
Re: [PATCH 6/8] user32: Introduce and use an array_reserve() helper.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=54376
Your paranoid android.
=== debian9 (32 bit report) ===
user32:
input.c:2218: Test failed: expected WM_NCHITTEST message
July 3, 2019
Re: [PATCH 1/8] user32/tests: Test opening raw input devices.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=54372
Your paranoid android.
=== wxppro (32 bit report) ===
user32:
input.c:1671: Test failed: Failed to open L"\\??\\Root#RDP_KBD#0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\ACPI#PNP0303#4&2c5a7332&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\Root#RDP_MOU#0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\HID#Vid_0627&Pid_0001#6&2e2010ad&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\ACPI#PNP0F13#4&2c5a7332&0#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
=== w2003std (32 bit report) ===
user32:
input.c:1671: Test failed: Failed to open L"\\??\\Root#RDP_KBD#0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\ACPI#PNP0303#4&2c5a7332&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\Root#RDP_MOU#0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\HID#Vid_0627&Pid_0001#6&2e2010ad&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
input.c:1671: Test failed: Failed to open L"\\??\\ACPI#PNP0F13#4&2c5a7332&0#{378de44c-56ef-11d1-bc8c-00a0c91405dd}", error 123
July 2, 2019
[PATCH 8/8] user32: Also scan for mouse devices in GetRawInputDeviceList().
by Zebediah Figura
Halo: Spartan Strike attempts to discover mice using rawinput. It expects to
be able to open the mouse device file with a zero access mask. It does not
perform any other operations on the file.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/user32/rawinput.c | 124 ++++++++++++++++++++++----------------
dlls/user32/tests/input.c | 2 +-
2 files changed, 74 insertions(+), 52 deletions(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 49cf9f73a0d..e83da29009b 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -36,27 +36,30 @@
#include "user_private.h"
+#include "initguid.h"
+#include "ntddmou.h"
+
WINE_DEFAULT_DEBUG_CHANNEL(rawinput);
-struct hid_device
+struct device
{
WCHAR *path;
HANDLE file;
- RID_DEVICE_INFO_HID info;
+ RID_DEVICE_INFO info;
PHIDP_PREPARSED_DATA data;
};
-static struct hid_device *hid_devices;
-static unsigned int hid_devices_count, hid_devices_max;
+static struct device *rawinput_devices;
+static unsigned int rawinput_devices_count, rawinput_devices_max;
-static CRITICAL_SECTION hid_devices_cs;
-static CRITICAL_SECTION_DEBUG hid_devices_cs_debug =
+static CRITICAL_SECTION rawinput_devices_cs;
+static CRITICAL_SECTION_DEBUG rawinput_devices_cs_debug =
{
- 0, 0, &hid_devices_cs,
- { &hid_devices_cs_debug.ProcessLocksList, &hid_devices_cs_debug.ProcessLocksList },
- 0, 0, { (DWORD_PTR)(__FILE__ ": hid_devices_cs") }
+ 0, 0, &rawinput_devices_cs,
+ { &rawinput_devices_cs_debug.ProcessLocksList, &rawinput_devices_cs_debug.ProcessLocksList },
+ 0, 0, { (DWORD_PTR)(__FILE__ ": rawinput_devices_cs") }
};
-static CRITICAL_SECTION hid_devices_cs = { &hid_devices_cs_debug, -1, 0, 0, 0, 0 };
+static CRITICAL_SECTION rawinput_devices_cs = { &rawinput_devices_cs_debug, -1, 0, 0, 0, 0 };
static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int count, unsigned int size)
{
@@ -85,10 +88,10 @@ static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int
return TRUE;
}
-static struct hid_device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
+static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
{
SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail;
- struct hid_device *device;
+ struct device *device;
HANDLE file;
WCHAR *path;
DWORD size;
@@ -126,7 +129,8 @@ static struct hid_device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *ifa
return NULL;
}
- if (!array_reserve((void **)&hid_devices, &hid_devices_max, hid_devices_count + 1, sizeof(*hid_devices)))
+ if (!array_reserve((void **)&rawinput_devices, &rawinput_devices_max,
+ rawinput_devices_count + 1, sizeof(*rawinput_devices)))
{
ERR("Failed to allocate memory.\n");
CloseHandle(file);
@@ -134,19 +138,20 @@ static struct hid_device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *ifa
return NULL;
}
- device = &hid_devices[hid_devices_count++];
+ device = &rawinput_devices[rawinput_devices_count++];
device->path = path;
device->file = file;
+ device->info.cbSize = sizeof(RID_DEVICE_INFO);
return device;
}
-static void find_hid_devices(void)
+static void find_devices(void)
{
static ULONGLONG last_check;
SP_DEVICE_INTERFACE_DATA iface = { sizeof(iface) };
- struct hid_device *device;
+ struct device *device;
HIDD_ATTRIBUTES attr;
HIDP_CAPS caps;
GUID hid_guid;
@@ -159,18 +164,18 @@ static void find_hid_devices(void)
HidD_GetHidGuid(&hid_guid);
- set = SetupDiGetClassDevsW(&hid_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
-
- EnterCriticalSection(&hid_devices_cs);
+ EnterCriticalSection(&rawinput_devices_cs);
/* destroy previous list */
- for (idx = 0; idx < hid_devices_count; ++idx)
+ for (idx = 0; idx < rawinput_devices_count; ++idx)
{
- CloseHandle(hid_devices[idx].file);
- heap_free(hid_devices[idx].path);
+ CloseHandle(rawinput_devices[idx].file);
+ heap_free(rawinput_devices[idx].path);
}
+ rawinput_devices_count = 0;
+
+ set = SetupDiGetClassDevsW(&hid_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
- hid_devices_count = 0;
for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &hid_guid, idx, &iface); ++idx)
{
if (!(device = add_device(set, &iface)))
@@ -179,9 +184,11 @@ static void find_hid_devices(void)
attr.Size = sizeof(HIDD_ATTRIBUTES);
if (!HidD_GetAttributes(device->file, &attr))
WARN("Failed to get attributes.\n");
- device->info.dwVendorId = attr.VendorID;
- device->info.dwProductId = attr.ProductID;
- device->info.dwVersionNumber = attr.VersionNumber;
+
+ device->info.dwType = RIM_TYPEHID;
+ device->info.u.hid.dwVendorId = attr.VendorID;
+ device->info.u.hid.dwProductId = attr.ProductID;
+ device->info.u.hid.dwVersionNumber = attr.VersionNumber;
if (!HidD_GetPreparsedData(device->file, &device->data))
WARN("Failed to get preparsed data.\n");
@@ -189,12 +196,28 @@ static void find_hid_devices(void)
if (!HidP_GetCaps(device->data, &caps))
WARN("Failed to get caps.\n");
- device->info.usUsagePage = caps.UsagePage;
- device->info.usUsage = caps.Usage;
+ device->info.u.hid.usUsagePage = caps.UsagePage;
+ device->info.u.hid.usUsage = caps.Usage;
}
- LeaveCriticalSection(&hid_devices_cs);
SetupDiDestroyDeviceInfoList(set);
+
+ set = SetupDiGetClassDevsW(&GUID_DEVINTERFACE_MOUSE, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
+
+ for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &GUID_DEVINTERFACE_MOUSE, idx, &iface); ++idx)
+ {
+ static const RID_DEVICE_INFO_MOUSE mouse_info = {1, 5, 0, FALSE};
+
+ if (!(device = add_device(set, &iface)))
+ continue;
+
+ device->info.dwType = RIM_TYPEMOUSE;
+ device->info.u.mouse = mouse_info;
+ }
+
+ SetupDiDestroyDeviceInfoList(set);
+
+ LeaveCriticalSection(&rawinput_devices_cs);
}
/***********************************************************************
@@ -218,18 +241,18 @@ UINT WINAPI GetRawInputDeviceList(RAWINPUTDEVICELIST *devices, UINT *device_coun
return ~0U;
}
- find_hid_devices();
+ find_devices();
if (!devices)
{
- *device_count = 2 + hid_devices_count;
+ *device_count = 2 + rawinput_devices_count;
return 0;
}
- if (*device_count < 2 + hid_devices_count)
+ if (*device_count < 2 + rawinput_devices_count)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
- *device_count = 2 + hid_devices_count;
+ *device_count = 2 + rawinput_devices_count;
return ~0U;
}
@@ -238,13 +261,13 @@ UINT WINAPI GetRawInputDeviceList(RAWINPUTDEVICELIST *devices, UINT *device_coun
devices[1].hDevice = WINE_KEYBOARD_HANDLE;
devices[1].dwType = RIM_TYPEKEYBOARD;
- for (i = 0; i < hid_devices_count; ++i)
+ for (i = 0; i < rawinput_devices_count; ++i)
{
- devices[2 + i].hDevice = &hid_devices[i];
- devices[2 + i].dwType = RIM_TYPEHID;
+ devices[2 + i].hDevice = &rawinput_devices[i];
+ devices[2 + i].dwType = rawinput_devices[i].info.dwType;
}
- return 2 + hid_devices_count;
+ return 2 + rawinput_devices_count;
}
/***********************************************************************
@@ -386,41 +409,41 @@ UINT WINAPI GetRawInputDeviceInfoA(HANDLE device, UINT command, void *data, UINT
/***********************************************************************
* GetRawInputDeviceInfoW (USER32.@)
*/
-UINT WINAPI GetRawInputDeviceInfoW(HANDLE device, UINT command, void *data, UINT *data_size)
+UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT *data_size)
{
/* FIXME: Most of this is made up. */
static const WCHAR keyboard_name[] = {'\\','\\','?','\\','W','I','N','E','_','K','E','Y','B','O','A','R','D',0};
static const WCHAR mouse_name[] = {'\\','\\','?','\\','W','I','N','E','_','M','O','U','S','E',0};
static const RID_DEVICE_INFO_KEYBOARD keyboard_info = {0, 0, 1, 12, 3, 101};
static const RID_DEVICE_INFO_MOUSE mouse_info = {1, 5, 0, FALSE};
- struct hid_device *hid_device;
const WCHAR *name = NULL;
RID_DEVICE_INFO *info;
+ struct device *device;
UINT s;
- TRACE("device %p, command %#x, data %p, data_size %p.\n",
- device, command, data, data_size);
+ TRACE("handle %p, command %#x, data %p, data_size %p.\n",
+ handle, command, data, data_size);
if (!data_size) return ~0U;
switch (command)
{
case RIDI_DEVICENAME:
- if (device == WINE_MOUSE_HANDLE)
+ if (handle == WINE_MOUSE_HANDLE)
{
s = ARRAY_SIZE(mouse_name);
name = mouse_name;
}
- else if (device == WINE_KEYBOARD_HANDLE)
+ else if (handle == WINE_KEYBOARD_HANDLE)
{
s = ARRAY_SIZE(keyboard_name);
name = keyboard_name;
}
else
{
- hid_device = device;
- s = strlenW(hid_device->path) + 1;
- name = hid_device->path;
+ device = handle;
+ s = strlenW(device->path) + 1;
+ name = device->path;
}
break;
case RIDI_DEVICEINFO:
@@ -450,21 +473,20 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE device, UINT command, void *data, UINT
info = data;
info->cbSize = sizeof(*info);
- if (device == WINE_MOUSE_HANDLE)
+ if (handle == WINE_MOUSE_HANDLE)
{
info->dwType = RIM_TYPEMOUSE;
info->u.mouse = mouse_info;
}
- else if (device == WINE_KEYBOARD_HANDLE)
+ else if (handle == WINE_KEYBOARD_HANDLE)
{
info->dwType = RIM_TYPEKEYBOARD;
info->u.keyboard = keyboard_info;
}
else
{
- hid_device = device;
- info->dwType = RIM_TYPEHID;
- info->u.hid = hid_device->info;
+ device = handle;
+ *info = device->info;
}
return s;
}
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 998fcdd1943..fd18743d659 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1641,7 +1641,7 @@ static void test_GetRawInputDeviceList(void)
ok(info.dwType == devices[i].dwType, "GetRawInputDeviceInfo set wrong type: 0x%x\n", info.dwType);
file = CreateFileW(name, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
- todo_wine_if(info.dwType != RIM_TYPEHID)
+ todo_wine_if(i == 0 || i == 1)
ok(file != INVALID_HANDLE_VALUE, "Failed to open %s, error %u\n", wine_dbgstr_w(name), GetLastError());
CloseHandle(file);
}
--
2.20.1
July 2, 2019
[PATCH 7/8] user32: Factor out add_device().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/user32/rawinput.c | 142 +++++++++++++++++++++--------------------
1 file changed, 74 insertions(+), 68 deletions(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 294926400fd..49cf9f73a0d 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -85,20 +85,73 @@ static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int
return TRUE;
}
+static struct hid_device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
+{
+ SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail;
+ struct hid_device *device;
+ HANDLE file;
+ WCHAR *path;
+ DWORD size;
+
+ SetupDiGetDeviceInterfaceDetailW(set, iface, NULL, 0, &size, NULL);
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
+ {
+ ERR("Failed to get device path, error %#x.\n", GetLastError());
+ return FALSE;
+ }
+ if (!(detail = heap_alloc(size)))
+ {
+ ERR("Failed to allocate memory.\n");
+ return FALSE;
+ }
+ detail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);
+ SetupDiGetDeviceInterfaceDetailW(set, iface, detail, size, NULL, NULL);
+
+ TRACE("Found HID device %s.\n", debugstr_w(detail->DevicePath));
+
+ if (!(path = heap_strdupW(detail->DevicePath)))
+ {
+ ERR("Failed to allocate memory.\n");
+ heap_free(detail);
+ return NULL;
+ }
+ heap_free(detail);
+
+ file = CreateFileW(path, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
+ if (file == INVALID_HANDLE_VALUE)
+ {
+ ERR("Failed to open device file %s, error %u.\n", debugstr_w(path), GetLastError());
+ heap_free(path);
+ return NULL;
+ }
+
+ if (!array_reserve((void **)&hid_devices, &hid_devices_max, hid_devices_count + 1, sizeof(*hid_devices)))
+ {
+ ERR("Failed to allocate memory.\n");
+ CloseHandle(file);
+ heap_free(path);
+ return NULL;
+ }
+
+ device = &hid_devices[hid_devices_count++];
+ device->path = path;
+ device->file = file;
+
+ return device;
+}
+
static void find_hid_devices(void)
{
static ULONGLONG last_check;
SP_DEVICE_INTERFACE_DATA iface = { sizeof(iface) };
- SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail;
- DWORD detail_size, needed;
+ struct hid_device *device;
HIDD_ATTRIBUTES attr;
- DWORD idx, didx;
HIDP_CAPS caps;
GUID hid_guid;
HDEVINFO set;
- HANDLE file;
- WCHAR *path;
+ DWORD idx;
if (GetTickCount64() - last_check < 2000)
return;
@@ -108,87 +161,40 @@ static void find_hid_devices(void)
set = SetupDiGetClassDevsW(&hid_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
- detail_size = sizeof(*detail) + (MAX_PATH * sizeof(WCHAR));
- if (!(detail = heap_alloc(detail_size)))
- return;
- detail->cbSize = sizeof(*detail);
-
EnterCriticalSection(&hid_devices_cs);
/* destroy previous list */
- for (didx = 0; didx < hid_devices_count; ++didx)
+ for (idx = 0; idx < hid_devices_count; ++idx)
{
- CloseHandle(hid_devices[didx].file);
- heap_free(hid_devices[didx].path);
+ CloseHandle(hid_devices[idx].file);
+ heap_free(hid_devices[idx].path);
}
- didx = 0;
+ hid_devices_count = 0;
for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &hid_guid, idx, &iface); ++idx)
{
- if (!SetupDiGetDeviceInterfaceDetailW(set, &iface, detail, detail_size, &needed, NULL))
- {
- if (!(detail = heap_realloc(detail, needed)))
- {
- ERR("Failed to allocate memory.\n");
- goto done;
- }
- detail_size = needed;
-
- SetupDiGetDeviceInterfaceDetailW(set, &iface, detail, detail_size, NULL, NULL);
- }
-
- if (!(path = heap_strdupW(detail->DevicePath)))
- {
- ERR("Failed to allocate memory.\n");
- goto done;
- }
-
- file = CreateFileW(path, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
- if (file == INVALID_HANDLE_VALUE)
- {
- ERR("Failed to open device file %s, error %u.\n", debugstr_w(path), GetLastError());
- heap_free(path);
+ if (!(device = add_device(set, &iface)))
continue;
- }
-
- if (!array_reserve((void **)&hid_devices, &hid_devices_max, didx + 1, sizeof(*hid_devices)))
- {
- ERR("Failed to allocate memory.\n");
- CloseHandle(file);
- heap_free(path);
- goto done;
- }
-
- TRACE("Found HID device %s.\n", debugstr_w(path));
-
- hid_devices[didx].path = path;
- hid_devices[didx].file = file;
attr.Size = sizeof(HIDD_ATTRIBUTES);
- if (!HidD_GetAttributes(file, &attr))
- WARN_(rawinput)("Failed to get attributes.\n");
- hid_devices[didx].info.dwVendorId = attr.VendorID;
- hid_devices[didx].info.dwProductId = attr.ProductID;
- hid_devices[didx].info.dwVersionNumber = attr.VersionNumber;
+ if (!HidD_GetAttributes(device->file, &attr))
+ WARN("Failed to get attributes.\n");
+ device->info.dwVendorId = attr.VendorID;
+ device->info.dwProductId = attr.ProductID;
+ device->info.dwVersionNumber = attr.VersionNumber;
- if (!HidD_GetPreparsedData(file, &hid_devices[didx].data))
- WARN_(rawinput)("Failed to get preparsed data.\n");
+ if (!HidD_GetPreparsedData(device->file, &device->data))
+ WARN("Failed to get preparsed data.\n");
- if (!HidP_GetCaps(hid_devices[didx].data, &caps))
- WARN_(rawinput)("Failed to get caps.\n");
+ if (!HidP_GetCaps(device->data, &caps))
+ WARN("Failed to get caps.\n");
- hid_devices[didx].info.usUsagePage = caps.UsagePage;
- hid_devices[didx].info.usUsage = caps.Usage;
-
- didx++;
+ device->info.usUsagePage = caps.UsagePage;
+ device->info.usUsage = caps.Usage;
}
- hid_devices_count = didx;
-done:
LeaveCriticalSection(&hid_devices_cs);
SetupDiDestroyDeviceInfoList(set);
- heap_free(detail);
}
/***********************************************************************
--
2.20.1
July 2, 2019