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
Re: [PATCH v8 3/7] server: Add request for sending native raw-input messages.
by Derek Lesho
v8 of this patch incorporates Remi's recommendations to use the
hw_rawinput_t union for hardware_msg_data and send the rawinput messages to
the relevant thread only.
On Fri, Jul 26, 2019 at 3:30 PM Derek Lesho <dereklesho52(a)gmail.com> wrote:
> Signed-off-by: Derek Lesho <dereklesho52(a)Gmail.com>
> ---
> server/protocol.def | 52 ++++++++++++++++++++++++++++-----------------
> server/queue.c | 52 +++++++++++++++++++++++++++++++++++++++++++++
> server/trace.c | 21 ++++++++++++++++++
> tools/make_requests | 1 +
> 4 files changed, 107 insertions(+), 19 deletions(-)
>
> diff --git a/server/protocol.def b/server/protocol.def
> index 8b8a8a1512..b5368c71f6 100644
> --- a/server/protocol.def
> +++ b/server/protocol.def
> @@ -286,31 +286,40 @@ struct hw_msg_source
> unsigned int origin; /* source origin (IMO_* values) */
> };
>
> +typedef union
> +{
> + int type;
> + struct
> + {
> + int type; /* RIM_TYPEKEYBOARD */
> + unsigned int message; /* message generated by this rawinput
> event */
> + unsigned short vkey; /* virtual key code */
> + unsigned short scan; /* scan code */
> + } kbd;
> + struct
> + {
> + int type; /* RIM_TYPEMOUSE */
> + int x; /* x coordinate */
> + int y; /* y coordinate */
> + unsigned short button_flags; /* mouse button */
> + unsigned short button_data; /* event details */
> + } mouse;
> + struct
> + {
> + int type; /* RIM_TYPEHID */
> + /* TODO: fill this in if/when necessary */
> + } hid;
> +} hw_rawinput_t;
> +#define RIM_ENABLE_NATIVE_MOUSE_MOVE 0x0800
> +#define RIM_ENABLE_NATIVE_MOUSE_PRESS 0x1000
> +
> struct hardware_msg_data
> {
> lparam_t info; /* extra info */
> unsigned int hw_id; /* unique id */
> unsigned int flags; /* hook flags */
> struct hw_msg_source source; /* message source */
> - union
> - {
> - int type;
> - struct
> - {
> - int type; /* RIM_TYPEKEYBOARD */
> - unsigned int message; /* message generated by this rawinput
> event */
> - unsigned short vkey; /* virtual key code */
> - unsigned short scan; /* scan code */
> - } kbd;
> - struct
> - {
> - int type; /* RIM_TYPEMOUSE */
> - int x; /* x coordinate */
> - int y; /* y coordinate */
> - unsigned short button_flags; /* mouse button */
> - unsigned short button_data; /* event details */
> - } mouse;
> - } rawinput;
> + hw_rawinput_t rawinput;
> };
>
> struct callback_msg_data
> @@ -2294,6 +2303,11 @@ enum message_type
> #define SEND_HWMSG_INJECTED 0x01
>
>
> +(a)REQ(send_rawinput_message)
> + hw_rawinput_t input;
> +(a)END
> +
> +
> /* Get a message from the current queue */
> @REQ(get_message)
> unsigned int flags; /* PM_* flags */
> diff --git a/server/queue.c b/server/queue.c
> index d12db927b9..03e64341c1 100644
> --- a/server/queue.c
> +++ b/server/queue.c
> @@ -2421,6 +2421,58 @@ DECL_HANDLER(send_hardware_message)
> release_object( desktop );
> }
>
> +/* send a hardware rawinput message to the queue thread */
> +DECL_HANDLER(send_rawinput_message)
> +{
> + const struct rawinput_device *device;
> + struct hardware_msg_data *msg_data;
> + struct message *msg;
> + struct desktop *desktop;
> + struct hw_msg_source source = { IMDT_MOUSE, IMO_HARDWARE };
> +
> + desktop = get_thread_desktop( current, 0 );
> +
> + switch (req->input.type)
> + {
> + case RIM_TYPEMOUSE:
> + if ((device = current->process->rawinput_mouse))
> + {
> + struct thread *thread = device->target ? get_window_thread(
> device->target ) : NULL;
> + if (device->target ? (thread != current) :
> (current->queue->input != desktop->foreground_input))
> + {
> + if ( thread )
> + release_object( thread );
> + release_object( desktop );
> + return;
> + }
> + if (thread)
> + release_object( thread );
> +
> + if (!(msg = alloc_hardware_message( 0, source, 0 ))) return;
> + msg_data = msg->data;
> +
> + msg->win = device->target;
> + msg->msg = WM_INPUT;
> + msg->wparam = RIM_INPUT;
> + msg->lparam = 0;
> +
> + msg_data->flags = 0;
> + msg_data->rawinput.type = RIM_TYPEMOUSE;
> + msg_data->rawinput.mouse.x = req->input.mouse.x;
> + msg_data->rawinput.mouse.y = req->input.mouse.y;
> + msg_data->rawinput.mouse.button_flags =
> req->input.mouse.button_flags;
> + msg_data->rawinput.mouse.button_data =
> req->input.mouse.button_data;
> +
> + queue_hardware_message( desktop, msg, 0 );
> + }
> + break;
> + default:
> + set_error( STATUS_INVALID_PARAMETER );
> + }
> +
> + release_object(desktop);
> +}
> +
> /* post a quit message to the current queue */
> DECL_HANDLER(post_quit_message)
> {
> diff --git a/server/trace.c b/server/trace.c
> index 3562823659..bccab449cf 100644
> --- a/server/trace.c
> +++ b/server/trace.c
> @@ -390,6 +390,27 @@ static void dump_hw_input( const char *prefix, const
> hw_input_t *input )
> }
> }
>
> +static void dump_hw_rawinput( const char *prefix, const hw_rawinput_t
> *rawinput )
> +{
> + switch (rawinput->type)
> + {
> + case RIM_TYPEMOUSE:
> + fprintf( stderr,
> "%s{type=MOUSE,x=%d,y=%d,button_flags=%04hx,button_data=%04hx}",
> + prefix, rawinput->mouse.x, rawinput->mouse.y,
> rawinput->mouse.button_flags,
> + rawinput->mouse.button_data);
> + break;
> + case RIM_TYPEKEYBOARD:
> + fprintf( stderr, "%s{type=KEYBOARD}\n", prefix);
> + break;
> + case RIM_TYPEHID:
> + fprintf( stderr, "%s{type=HID}\n", prefix);
> + break;
> + default:
> + fprintf( stderr, "%s{type=%04x}", prefix, rawinput->type);
> + break;
> + }
> +}
> +
> static void dump_luid( const char *prefix, const luid_t *luid )
> {
> fprintf( stderr, "%s%d.%u", prefix, luid->high_part, luid->low_part );
> diff --git a/tools/make_requests b/tools/make_requests
> index 367f245653..cf631923a7 100755
> --- a/tools/make_requests
> +++ b/tools/make_requests
> @@ -53,6 +53,7 @@ my %formats =
> "ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ],
> "cpu_type_t" => [ 4, 4, "&dump_cpu_type" ],
> "hw_input_t" => [ 32, 8, "&dump_hw_input" ],
> + "hw_rawinput_t" => [ 16, 8, "&dump_hw_rawinput" ]
> );
>
> my @requests = ();
> --
> 2.22.0
>
>
July 26, 2019
[PATCH v8 7/7] winex11.drv: Don't react to small slow mouse movements.
by Derek Lesho
From: Jordan Galby <gravemind2a+wine(a)gmail.com>
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42631
From: Jordan Galby <gravemind2a+wine(a)gmail.com>
Signed-off-by: Derek Lesho <dereklesho52(a)Gmail.com>
---
dlls/winex11.drv/mouse.c | 63 +++++++++++++++++++++++++++++----------
dlls/winex11.drv/x11drv.h | 1 +
2 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index f328eb369c..77054618de 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -257,6 +257,8 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
thread_data->x_rel_valuator.number = -1;
thread_data->y_rel_valuator.number = -1;
+ thread_data->x_rel_valuator.accum = 0;
+ thread_data->y_rel_valuator.accum = 0;
for (i = 0; i < n_valuators; i++)
{
@@ -1733,6 +1735,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
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;
+ static double raw_accum_x = 0, raw_accum_y = 0;
if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) return FALSE;
if (!event->valuators.mask_len) return FALSE;
@@ -1746,15 +1749,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
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;
raw_input.header.dwType = RIM_TYPEMOUSE;
raw_input.data.mouse.u.usButtonFlags = 0;
raw_input.data.mouse.u.usButtonData = 0;
raw_input.data.mouse.ulExtraInformation = 0;
- raw_input.data.mouse.lLastX = 0;
- raw_input.data.mouse.lLastY = 0;
virtual_rect = get_virtual_screen_rect();
@@ -1765,38 +1764,70 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
raw_val = *raw_values++;
if (i == x_rel->number)
{
- input.u.mi.dx = dx = val;
+ dx = val;
if (x_rel->min < x_rel->max)
- input.u.mi.dx = val * (virtual_rect.right - virtual_rect.left)
+ dx = val * (virtual_rect.right - virtual_rect.left)
/ (x_rel->max - x_rel->min);
- raw_input.data.mouse.lLastX = raw_dx = raw_val;
+ raw_dx = raw_val;
}
if (i == y_rel->number)
{
- input.u.mi.dy = dy = val;
+ dy = val;
if (y_rel->min < y_rel->max)
- input.u.mi.dy = val * (virtual_rect.bottom - virtual_rect.top)
+ dy = val * (virtual_rect.bottom - virtual_rect.top)
/ (y_rel->max - y_rel->min);
- raw_input.data.mouse.lLastY = raw_dy = raw_val;
+ raw_dy = raw_val;
}
}
if (broken_rawevents && is_old_motion_event( xev->serial ))
{
- TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, xev->serial );
+ TRACE( "pos %d,%d old serial %lu, ignoring\n", (LONG) dx, (LONG) dy, xev->serial );
return FALSE;
}
- if (thread_data->xi2_state == xi_extra)
+ /* Accumulate the *double* motions so sub-pixel motions
+ * wont be lost when sent/cast to *LONG* target fields.
+ */
+
+ x_rel->accum += dx;
+ y_rel->accum += dy;
+ if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0)
{
- TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
- __wine_send_input( 0, &input );
+ TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", dx, dy, x_rel->accum, y_rel->accum );
}
+ else
+ {
+ input.u.mi.dx = x_rel->accum;
+ input.u.mi.dy = y_rel->accum;
+ x_rel->accum -= input.u.mi.dx;
+ y_rel->accum -= input.u.mi.dy;
- TRACE("raw event %f,%f\n", raw_dx, raw_dy);
- __wine_send_raw_input( &raw_input );
+ if (thread_data->xi2_state == xi_extra)
+ {
+ TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
+ __wine_send_input( 0, &input );
+ }
+ }
+
+ raw_accum_x += raw_dx;
+ raw_accum_y += raw_dy;
+ if (fabs(raw_accum_x) < 1.0 && fabs(raw_accum_y) < 1.0)
+ {
+ TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", raw_dx, raw_dy, raw_accum_x, raw_accum_y );
+ }
+ else
+ {
+ raw_input.data.mouse.lLastX = raw_accum_x;
+ raw_input.data.mouse.lLastY = raw_accum_y;
+ raw_accum_x -= raw_input.data.mouse.lLastX;
+ raw_accum_y -= raw_input.data.mouse.lLastY;
+
+ TRACE("raw event %d,%d(event %f,%f)\n", raw_input.data.mouse.lLastX, raw_input.data.mouse.lLastY, raw_dx, raw_dy);
+ __wine_send_raw_input( &raw_input );
+ }
return TRUE;
}
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index a6d64f4383..7dfc06bcd2 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -320,6 +320,7 @@ struct x11drv_valuator_data
double min;
double max;
int number;
+ double accum;
};
struct x11drv_thread_data
--
2.22.0
July 26, 2019
[PATCH v8 6/7] 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 | 150 ++++++++++++++++-----------------
dlls/winex11.drv/x11drv.h | 8 +-
dlls/winex11.drv/x11drv_main.c | 4 +
3 files changed, 81 insertions(+), 81 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index f737a306a5..f328eb369c 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -284,15 +284,31 @@ 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();
XIEventMask mask;
+ int core_pointer;
XIDeviceInfo *pointer_info;
unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)];
int count;
@@ -301,7 +317,7 @@ static void enable_xinput2(void)
if (data->xi2_state == xi_unknown)
{
- int major = 2, minor = 0;
+ int major = 2, minor = 1;
if (!pXIQueryVersion( data->display, &major, &minor )) data->xi2_state = xi_disabled;
else
{
@@ -310,64 +326,65 @@ static void enable_xinput2(void)
}
}
if (data->xi2_state == xi_unavailable) return;
- if (!pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) return;
+ if (!pXIGetClientPointer( data->display, None, &core_pointer )) return;
mask.mask = mask_bits;
mask.mask_len = sizeof(mask_bits);
- mask.deviceid = XIAllDevices;
+ mask.deviceid = XIAllMasterDevices;
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 );
- pointer_info = pXIQueryDevice( data->display, data->xi2_core_pointer, &count );
+ pointer_info = pXIQueryDevice( data->display, core_pointer, &count );
update_relative_valuators( pointer_info->classes, pointer_info->num_classes );
pXIFreeDeviceInfo( pointer_info );
- /* This device info list is only used to find the initial current slave if
- * no XI_DeviceChanged events happened. If any hierarchy change occurred that
- * might be relevant here (eg. user switching mice after (un)plugging), a
- * XI_DeviceChanged event will point us to the right slave. So this list is
- * safe to be obtained statically at enable_xinput2() time.
- */
- if (data->xi2_devices) pXIFreeDeviceInfo( data->xi2_devices );
- data->xi2_devices = pXIQueryDevice( data->display, XIAllDevices, &data->xi2_device_count );
- 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;
mask.mask = NULL;
mask.mask_len = 0;
- mask.deviceid = XIAllDevices;
+ mask.deviceid = XIAllMasterDevices;
pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 );
- pXIFreeDeviceInfo( data->xi2_devices );
data->x_rel_valuator.number = -1;
data->y_rel_valuator.number = -1;
- data->xi2_devices = NULL;
- data->xi2_core_pointer = 0;
- data->xi2_current_slave = 0;
#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 +410,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 +440,7 @@ static BOOL grab_clipping_window( const RECT *clip )
if (!clipping_cursor)
{
- disable_xinput2();
+ disable_xinput2_path();
DestroyWindow( msg_hwnd );
return FALSE;
}
@@ -489,7 +506,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 */
@@ -1701,22 +1718,6 @@ BOOL X11DRV_EnterNotify( HWND hwnd, XEvent *xev )
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
-/***********************************************************************
- * X11DRV_DeviceChanged
- */
-static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
-{
- XIDeviceChangedEvent *event = xev->data;
- struct x11drv_thread_data *data = x11drv_thread_data();
-
- if (event->deviceid != data->xi2_core_pointer) return FALSE;
- if (event->reason != XISlaveSwitch) return FALSE;
-
- update_relative_valuators( event->classes, event->num_classes );
- data->xi2_current_slave = event->sourceid;
- return TRUE;
-}
-
/***********************************************************************
* X11DRV_RawMotion
*/
@@ -1724,46 +1725,36 @@ 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 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
- * case.
- */
- if (!thread_data->xi2_current_slave)
- {
- XIDeviceInfo *devices = thread_data->xi2_devices;
-
- for (i = 0; i < thread_data->xi2_device_count; i++)
- {
- if (devices[i].use != XISlavePointer) continue;
- if (devices[i].deviceid != event->deviceid) continue;
- if (devices[i].attachment != thread_data->xi2_core_pointer) continue;
- thread_data->xi2_current_slave = event->deviceid;
- break;
- }
- }
-
- if (event->deviceid != thread_data->xi2_current_slave) return FALSE;
+ if (thread_data->xi2_state < xi_enabled) return FALSE;
x_rel = &thread_data->x_rel_valuator;
y_rel = &thread_data->y_rel_valuator;
+ input.type = INPUT_MOUSE;
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;
+ input.u.mi.dx = 0;
+ input.u.mi.dy = 0;
+
+ raw_input.header.dwType = RIM_TYPEMOUSE;
+ raw_input.data.mouse.u.usButtonFlags = 0;
+ raw_input.data.mouse.u.usButtonData = 0;
+ raw_input.data.mouse.ulExtraInformation = 0;
+ raw_input.data.mouse.lLastX = 0;
+ raw_input.data.mouse.lLastY = 0;
virtual_rect = get_virtual_screen_rect();
@@ -1771,12 +1762,15 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
{
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_input.data.mouse.lLastX = raw_dx = raw_val;
}
if (i == y_rel->number)
{
@@ -1784,6 +1778,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_input.data.mouse.lLastY = raw_dy = raw_val;
}
}
@@ -1793,10 +1789,15 @@ 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 );
+ if (thread_data->xi2_state == xi_extra)
+ {
+ TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
+ __wine_send_input( 0, &input );
+ }
+
+ TRACE("raw event %f,%f\n", raw_dx, raw_dy);
+ __wine_send_raw_input( &raw_input );
- input.type = INPUT_MOUSE;
- __wine_send_input( 0, &input );
return TRUE;
}
@@ -1858,9 +1859,6 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev )
switch (event->evtype)
{
- case XI_DeviceChanged:
- ret = X11DRV_DeviceChanged( event );
- break;
case XI_RawMotion:
ret = X11DRV_RawMotion( event );
break;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index a0308b0675..a6d64f4383 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,13 +337,9 @@ 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 */
- void *xi2_devices; /* list of XInput2 devices (valid when state is enabled) */
- int xi2_device_count;
+ enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled, xi_extra } xi2_state; /* XInput2 state */
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 */
};
extern struct x11drv_thread_data *x11drv_init_thread_data(void) DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index e67a3c05a9..351ab89781 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -610,6 +610,8 @@ void CDECL X11DRV_ThreadDetach(void)
if (data)
{
+ X11DRV_XInput2_Disable();
+
if (data->xim) XCloseIM( data->xim );
if (data->font_set) XFreeFontSet( data->display, data->font_set );
XCloseDisplay( data->display );
@@ -680,6 +682,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
if (use_xim) X11DRV_SetupXIM();
+ X11DRV_XInput2_Enable();
+
return data;
}
--
2.22.0
July 26, 2019
[PATCH v8 3/7] server: Add request for sending native raw-input messages.
by Derek Lesho
Signed-off-by: Derek Lesho <dereklesho52(a)Gmail.com>
---
server/protocol.def | 52 ++++++++++++++++++++++++++++-----------------
server/queue.c | 52 +++++++++++++++++++++++++++++++++++++++++++++
server/trace.c | 21 ++++++++++++++++++
tools/make_requests | 1 +
4 files changed, 107 insertions(+), 19 deletions(-)
diff --git a/server/protocol.def b/server/protocol.def
index 8b8a8a1512..b5368c71f6 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -286,31 +286,40 @@ struct hw_msg_source
unsigned int origin; /* source origin (IMO_* values) */
};
+typedef union
+{
+ int type;
+ struct
+ {
+ int type; /* RIM_TYPEKEYBOARD */
+ unsigned int message; /* message generated by this rawinput event */
+ unsigned short vkey; /* virtual key code */
+ unsigned short scan; /* scan code */
+ } kbd;
+ struct
+ {
+ int type; /* RIM_TYPEMOUSE */
+ int x; /* x coordinate */
+ int y; /* y coordinate */
+ unsigned short button_flags; /* mouse button */
+ unsigned short button_data; /* event details */
+ } mouse;
+ struct
+ {
+ int type; /* RIM_TYPEHID */
+ /* TODO: fill this in if/when necessary */
+ } hid;
+} hw_rawinput_t;
+#define RIM_ENABLE_NATIVE_MOUSE_MOVE 0x0800
+#define RIM_ENABLE_NATIVE_MOUSE_PRESS 0x1000
+
struct hardware_msg_data
{
lparam_t info; /* extra info */
unsigned int hw_id; /* unique id */
unsigned int flags; /* hook flags */
struct hw_msg_source source; /* message source */
- union
- {
- int type;
- struct
- {
- int type; /* RIM_TYPEKEYBOARD */
- unsigned int message; /* message generated by this rawinput event */
- unsigned short vkey; /* virtual key code */
- unsigned short scan; /* scan code */
- } kbd;
- struct
- {
- int type; /* RIM_TYPEMOUSE */
- int x; /* x coordinate */
- int y; /* y coordinate */
- unsigned short button_flags; /* mouse button */
- unsigned short button_data; /* event details */
- } mouse;
- } rawinput;
+ hw_rawinput_t rawinput;
};
struct callback_msg_data
@@ -2294,6 +2303,11 @@ enum message_type
#define SEND_HWMSG_INJECTED 0x01
+(a)REQ(send_rawinput_message)
+ hw_rawinput_t input;
+(a)END
+
+
/* Get a message from the current queue */
@REQ(get_message)
unsigned int flags; /* PM_* flags */
diff --git a/server/queue.c b/server/queue.c
index d12db927b9..03e64341c1 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -2421,6 +2421,58 @@ DECL_HANDLER(send_hardware_message)
release_object( desktop );
}
+/* send a hardware rawinput message to the queue thread */
+DECL_HANDLER(send_rawinput_message)
+{
+ const struct rawinput_device *device;
+ struct hardware_msg_data *msg_data;
+ struct message *msg;
+ struct desktop *desktop;
+ struct hw_msg_source source = { IMDT_MOUSE, IMO_HARDWARE };
+
+ desktop = get_thread_desktop( current, 0 );
+
+ switch (req->input.type)
+ {
+ case RIM_TYPEMOUSE:
+ if ((device = current->process->rawinput_mouse))
+ {
+ struct thread *thread = device->target ? get_window_thread( device->target ) : NULL;
+ if (device->target ? (thread != current) : (current->queue->input != desktop->foreground_input))
+ {
+ if ( thread )
+ release_object( thread );
+ release_object( desktop );
+ return;
+ }
+ if (thread)
+ release_object( thread );
+
+ if (!(msg = alloc_hardware_message( 0, source, 0 ))) return;
+ msg_data = msg->data;
+
+ msg->win = device->target;
+ msg->msg = WM_INPUT;
+ msg->wparam = RIM_INPUT;
+ msg->lparam = 0;
+
+ msg_data->flags = 0;
+ msg_data->rawinput.type = RIM_TYPEMOUSE;
+ msg_data->rawinput.mouse.x = req->input.mouse.x;
+ msg_data->rawinput.mouse.y = req->input.mouse.y;
+ msg_data->rawinput.mouse.button_flags = req->input.mouse.button_flags;
+ msg_data->rawinput.mouse.button_data = req->input.mouse.button_data;
+
+ queue_hardware_message( desktop, msg, 0 );
+ }
+ break;
+ default:
+ set_error( STATUS_INVALID_PARAMETER );
+ }
+
+ release_object(desktop);
+}
+
/* post a quit message to the current queue */
DECL_HANDLER(post_quit_message)
{
diff --git a/server/trace.c b/server/trace.c
index 3562823659..bccab449cf 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -390,6 +390,27 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )
}
}
+static void dump_hw_rawinput( const char *prefix, const hw_rawinput_t *rawinput )
+{
+ switch (rawinput->type)
+ {
+ case RIM_TYPEMOUSE:
+ fprintf( stderr, "%s{type=MOUSE,x=%d,y=%d,button_flags=%04hx,button_data=%04hx}",
+ prefix, rawinput->mouse.x, rawinput->mouse.y, rawinput->mouse.button_flags,
+ rawinput->mouse.button_data);
+ break;
+ case RIM_TYPEKEYBOARD:
+ fprintf( stderr, "%s{type=KEYBOARD}\n", prefix);
+ break;
+ case RIM_TYPEHID:
+ fprintf( stderr, "%s{type=HID}\n", prefix);
+ break;
+ default:
+ fprintf( stderr, "%s{type=%04x}", prefix, rawinput->type);
+ break;
+ }
+}
+
static void dump_luid( const char *prefix, const luid_t *luid )
{
fprintf( stderr, "%s%d.%u", prefix, luid->high_part, luid->low_part );
diff --git a/tools/make_requests b/tools/make_requests
index 367f245653..cf631923a7 100755
--- a/tools/make_requests
+++ b/tools/make_requests
@@ -53,6 +53,7 @@ my %formats =
"ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ],
"cpu_type_t" => [ 4, 4, "&dump_cpu_type" ],
"hw_input_t" => [ 32, 8, "&dump_hw_input" ],
+ "hw_rawinput_t" => [ 16, 8, "&dump_hw_rawinput" ]
);
my @requests = ();
--
2.22.0
July 26, 2019
Re: [PATCH] wined3d: Inhibit the screensaver while a full-screen application has focus.
by Dmitry Timoshkov
Zebediah Figura <zfigura(a)codeweavers.com> wrote:
> @@ -1033,6 +1033,7 @@ HRESULT CDECL wined3d_device_acquire_focus_window(struct wined3d_device *device,
>
> InterlockedExchangePointer((void **)&device->focus_window, window);
> SetWindowPos(window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
> + SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);
>
> return WINED3D_OK;
> }
> @@ -1043,6 +1044,7 @@ void CDECL wined3d_device_release_focus_window(struct wined3d_device *device)
>
> if (device->focus_window) wined3d_unregister_window(device->focus_window);
> InterlockedExchangePointer((void **)&device->focus_window, NULL);
> + SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, TRUE, NULL, 0);
> }
It would probably make sense to set screensaver value to its original
state, so if screensaver was originally disabled then don't accidently
enable it.
--
Dmitry.
July 26, 2019
[PATCH 2/2 v2] msctf: Accept ITfInputProcessorProfileActivationSink in ThreadMgr AdviseSink
by Andrew Eikum
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com>
---
v2: Fix failing tests and add some more.
dlls/msctf/msctf_internal.h | 1 +
dlls/msctf/tests/inputprocessor.c | 69 ++++++++++++++++++++++++++++++-
dlls/msctf/threadmgr.c | 13 +++++-
3 files changed, 80 insertions(+), 3 deletions(-)
diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h
index 71ed10bb8dd..584bb1044ed 100644
--- a/dlls/msctf/msctf_internal.h
+++ b/dlls/msctf/msctf_internal.h
@@ -33,6 +33,7 @@
#define COOKIE_MAGIC_THREADFOCUSSINK 0x0080
#define COOKIE_MAGIC_KEYTRACESINK 0x0090
#define COOKIE_MAGIC_UIELEMENTSINK 0x00a0
+#define COOKIE_MAGIC_INPUTPROCESSORPROFILEACTIVATIONSINK 0x00b0
extern DWORD tlsIndex DECLSPEC_HIDDEN;
extern TfClientId processId DECLSPEC_HIDDEN;
diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c
index d440b536764..d73a3f94510 100644
--- a/dlls/msctf/tests/inputprocessor.c
+++ b/dlls/msctf/tests/inputprocessor.c
@@ -64,7 +64,8 @@ static DWORD tmSinkCookie;
static DWORD tmSinkRefCount;
static DWORD dmSinkCookie;
static DWORD documentStatus;
-static DWORD key_trace_sink_cookie, ui_element_sink_cookie;
+static DWORD key_trace_sink_cookie, ui_element_sink_cookie, profile_activation_sink_cookie;
+static DWORD fake_service_onactivated_flags = 0;
static ITfDocumentMgr *test_CurrentFocus = NULL;
static ITfDocumentMgr *test_PrevFocus = NULL;
static ITfDocumentMgr *test_LastCurrentFocus = FOCUS_SAVE;
@@ -85,6 +86,7 @@ static INT test_ACP_InsertTextAtSelection = SINK_UNEXPECTED;
static INT test_ACP_SetSelection = SINK_UNEXPECTED;
static INT test_OnEndEdit = SINK_UNEXPECTED;
+DEFINE_GUID(CLSID_FakeService, 0xEDE1A7AD,0x66DE,0x47E0,0xB6,0x20,0x3E,0x92,0xF8,0x24,0x6B,0xF3);
static inline int expected_count(int *sink)
{
@@ -725,6 +727,61 @@ static const ITfUIElementSinkVtbl TfUIElementSinkVtbl = {
static ITfUIElementSink TfUIElementSink = { &TfUIElementSinkVtbl };
+static HRESULT WINAPI ProfileActivationSink_QueryInterface(ITfInputProcessorProfileActivationSink *iface,
+ REFIID riid, void **ppvObject)
+{
+ if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ITfInputProcessorProfileActivationSink, riid)){
+ *ppvObject = iface;
+ return S_OK;
+ }
+
+ *ppvObject = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI ProfileActivationSink_AddRef(ITfInputProcessorProfileActivationSink *iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI ProfileActivationSink_Release(ITfInputProcessorProfileActivationSink *iface)
+{
+ return 1;
+}
+
+static HRESULT WINAPI ProfileActivationSink_OnActivated(ITfInputProcessorProfileActivationSink *iface,
+ DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid,
+ REFGUID guidProfile, HKL hkl, DWORD dwFlags)
+{
+ trace("Got OnActivated: {dwProfileType %08x, langid %08x, clsid %s, catid %s, guidProfile %s, %p, dwFlags %08x}\n",
+ dwProfileType, langid, wine_dbgstr_guid(clsid),
+ wine_dbgstr_guid(catid), wine_dbgstr_guid(guidProfile), hkl, dwFlags);
+
+ ok(dwProfileType == TF_PROFILETYPE_INPUTPROCESSOR || dwProfileType == TF_PROFILETYPE_KEYBOARDLAYOUT,
+ "unexpected dwProfileType: 0x%x\n", dwProfileType);
+
+ if(dwProfileType == TF_PROFILETYPE_INPUTPROCESSOR && IsEqualGUID(&CLSID_FakeService, clsid)){
+ if(dwFlags & TF_IPSINK_FLAG_ACTIVE){
+ ok(test_ShouldActivate, "OnActivated: Activation came unexpectedly\n");
+ }
+
+ fake_service_onactivated_flags = dwFlags;
+ }
+
+ return S_OK;
+}
+
+static const ITfInputProcessorProfileActivationSinkVtbl TfInputProcessorProfileActivationSinkVtbl = {
+ ProfileActivationSink_QueryInterface,
+ ProfileActivationSink_AddRef,
+ ProfileActivationSink_Release,
+ ProfileActivationSink_OnActivated
+};
+
+static ITfInputProcessorProfileActivationSink TfInputProcessorProfileActivationSink = {
+ &TfInputProcessorProfileActivationSinkVtbl
+};
+
static HRESULT WINAPI TfTransitoryExtensionSink_QueryInterface(ITfTransitoryExtensionSink *iface, REFIID riid, void **ppv)
{
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ITfTransitoryExtensionSink, riid)) {
@@ -974,7 +1031,6 @@ static HRESULT UnregisterTextService(void)
* The tests
*/
-DEFINE_GUID(CLSID_FakeService, 0xEDE1A7AD,0x66DE,0x47E0,0xB6,0x20,0x3E,0x92,0xF8,0x24,0x6B,0xF3);
DEFINE_GUID(CLSID_TF_InputProcessorProfiles, 0x33c53a50,0xf456,0x4884,0xb0,0x49,0x85,0xfd,0x64,0x3e,0xcf,0xed);
DEFINE_GUID(CLSID_TF_CategoryMgr, 0xA4B544A1,0x438D,0x4B41,0x93,0x25,0x86,0x95,0x23,0xE2,0xD6,0xC7);
DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745c63,0xb2f0,0x4784,0x8b,0x67,0x5e,0x12,0xc8,0x70,0x1a,0x31);
@@ -1198,6 +1254,10 @@ static void test_ThreadMgrAdviseSinks(void)
&ui_element_sink_cookie);
ok(hr == S_OK, "Failed to Advise ITfUIElementSink\n");
+ hr = ITfSource_AdviseSink(source, &IID_ITfInputProcessorProfileActivationSink, (IUnknown*)&TfInputProcessorProfileActivationSink,
+ &profile_activation_sink_cookie);
+ ok(hr == S_OK, "Failed to Advise ITfInputProcessorProfileActivationSink\n");
+
ITfSource_Release(source);
}
@@ -1221,6 +1281,9 @@ static void test_ThreadMgrUnadviseSinks(void)
hr = ITfSource_UnadviseSink(source, ui_element_sink_cookie);
ok(hr == S_OK, "Failed to unadvise ITfUIElementSink\n");
+ hr = ITfSource_UnadviseSink(source, profile_activation_sink_cookie);
+ ok(hr == S_OK, "Failed to unadvise ITfInputProcessorProfileActivationSink\n");
+
ITfSource_Release(source);
}
@@ -1618,6 +1681,8 @@ static void test_startSession(void)
ok(SUCCEEDED(hr),"Failed to Activate\n");
ok(cid != tid,"TextService id mistakenly matches Client id\n");
+ todo_wine ok(fake_service_onactivated_flags & TF_IPSINK_FLAG_ACTIVE, "Expected OnActivated callback\n");
+
test_ShouldActivate = FALSE;
hr = ITfThreadMgr_Activate(g_tm,&cid2);
ok(SUCCEEDED(hr),"Failed to Activate\n");
diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c
index 7afef3cdd53..2c208fbc04f 100644
--- a/dlls/msctf/threadmgr.c
+++ b/dlls/msctf/threadmgr.c
@@ -97,6 +97,7 @@ typedef struct tagACLMulti {
struct list ThreadFocusSink;
struct list ThreadMgrEventSink;
struct list UIElementSink;
+ struct list InputProcessorProfileActivationSink;
} ThreadMgr;
typedef struct tagEnumTfDocumentMgr {
@@ -174,6 +175,7 @@ static void ThreadMgr_Destructor(ThreadMgr *This)
free_sinks(&This->ThreadFocusSink);
free_sinks(&This->ThreadMgrEventSink);
free_sinks(&This->UIElementSink);
+ free_sinks(&This->InputProcessorProfileActivationSink);
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->CurrentPreservedKeys)
{
@@ -633,6 +635,13 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface,
COOKIE_MAGIC_UIELEMENTSINK, punk, pdwCookie);
}
+ if (IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink))
+ {
+ WARN("semi-stub for ITfInputProcessorProfileActivationSink: sink won't be used.\n");
+ return advise_sink(&This->InputProcessorProfileActivationSink, &IID_ITfInputProcessorProfileActivationSink,
+ COOKIE_MAGIC_INPUTPROCESSORPROFILEACTIVATIONSINK, punk, pdwCookie);
+ }
+
FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
return E_NOTIMPL;
}
@@ -646,7 +655,8 @@ static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCo
magic = get_Cookie_magic(pdwCookie);
if (magic != COOKIE_MAGIC_TMSINK && magic != COOKIE_MAGIC_THREADFOCUSSINK
- && magic != COOKIE_MAGIC_KEYTRACESINK && magic != COOKIE_MAGIC_UIELEMENTSINK)
+ && magic != COOKIE_MAGIC_KEYTRACESINK && magic != COOKIE_MAGIC_UIELEMENTSINK
+ && magic != COOKIE_MAGIC_INPUTPROCESSORPROFILEACTIVATIONSINK)
return E_INVALIDARG;
return unadvise_sink(pdwCookie);
@@ -1364,6 +1374,7 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
list_init(&This->ThreadFocusSink);
list_init(&This->ThreadMgrEventSink);
list_init(&This->UIElementSink);
+ list_init(&This->InputProcessorProfileActivationSink);
TRACE("returning %p\n", This);
*ppOut = (IUnknown *)&This->ITfThreadMgrEx_iface;
--
2.22.0
July 25, 2019
[PATCH] wined3d: Inhibit the screensaver while a full-screen application has focus.
by Zebediah Figura
This matches Windows behaviour at least as of Windows 7.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
Windows does not seem to do it using SystemParametersInfo(), nor using
SetThreadExecutionState(). I suspect it is instead using the Power*Request()
APIs, but as far as I'm aware implementing those would require getting at an
external library such as X11 or dbus from ntdll (or kernel32), which is not
permitted.
dlls/wined3d/device.c | 2 ++
dlls/wined3d/swapchain.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a4c26cf3976..d37a2169707 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1033,6 +1033,7 @@ HRESULT CDECL wined3d_device_acquire_focus_window(struct wined3d_device *device,
InterlockedExchangePointer((void **)&device->focus_window, window);
SetWindowPos(window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
+ SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);
return WINED3D_OK;
}
@@ -1043,6 +1044,7 @@ void CDECL wined3d_device_release_focus_window(struct wined3d_device *device)
if (device->focus_window) wined3d_unregister_window(device->focus_window);
InterlockedExchangePointer((void **)&device->focus_window, NULL);
+ SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, TRUE, NULL, 0);
}
static void device_init_swapchain_state(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 8603c8de7a0..7e35a2f349e 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1198,6 +1198,8 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
ShowWindow(swapchain->device_window, SW_MINIMIZE);
}
+ SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, !activate, NULL, 0);
+
if (!focus_messages)
device->filter_messages = filter_messages;
}
--
2.20.1
July 25, 2019
Re: [PATCH 2/2] winebus: Use the SDL joystick index as device id instead of instance id
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=54882
Your paranoid android.
=== debian10 (32 bit report) ===
Report errors:
ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit Chinese:China report) ===
Report errors:
ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit WoW report) ===
Report errors:
ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (64 bit WoW report) ===
Report errors:
ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
July 25, 2019
Re: [PATCH 1/2] ntoskrnl: Update the interface if it is already in the device_interfaces tree
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=54881
Your paranoid android.
=== debian10 (32 bit report) ===
Report errors:
ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit Chinese:China report) ===
Report errors:
ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit WoW report) ===
Report errors:
ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (64 bit WoW report) ===
Report errors:
ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
July 25, 2019
[PATCH 2/2] winebus: Use the SDL joystick index as device id instead of instance id
by Rémi Bernon
Some games are using the HID device id as the gamepad index for xinput
API. When hotplugging devices, SDL increases its instances id and it
doesn't match anymore with xinput gamepad numbers.
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/winebus.sys/bus_sdl.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c
index d24e21cff83..7bd4a13b14c 100644
--- a/dlls/winebus.sys/bus_sdl.c
+++ b/dlls/winebus.sys/bus_sdl.c
@@ -744,17 +744,21 @@ static const platform_vtbl sdl_vtbl =
set_feature_report,
};
+static int compare_joystick_id(DEVICE_OBJECT *device, void* context)
+{
+ return impl_from_DEVICE_OBJECT(device)->id - PtrToUlong(context);
+}
+
static BOOL set_report_from_event(SDL_Event *event)
{
DEVICE_OBJECT *device;
struct platform_private *private;
/* All the events coming in will have 'which' as a 3rd field */
- SDL_JoystickID index = ((SDL_JoyButtonEvent*)event)->which;
-
- device = bus_find_hid_device(&sdl_vtbl, ULongToPtr(index));
+ SDL_JoystickID id = ((SDL_JoyButtonEvent*)event)->which;
+ device = bus_enumerate_hid_devices(&sdl_vtbl, compare_joystick_id, ULongToPtr(id));
if (!device)
{
- ERR("Failed to find device at index %i\n",index);
+ ERR("Failed to find device at index %i\n",id);
return FALSE;
}
private = impl_from_DEVICE_OBJECT(device);
@@ -814,11 +818,11 @@ static BOOL set_mapped_report_from_event(SDL_Event *event)
DEVICE_OBJECT *device;
struct platform_private *private;
/* All the events coming in will have 'which' as a 3rd field */
- int index = ((SDL_ControllerButtonEvent*)event)->which;
- device = bus_find_hid_device(&sdl_vtbl, ULongToPtr(index));
+ SDL_JoystickID id = ((SDL_ControllerButtonEvent*)event)->which;
+ device = bus_enumerate_hid_devices(&sdl_vtbl, compare_joystick_id, ULongToPtr(id));
if (!device)
{
- ERR("Failed to find device at index %i\n",index);
+ ERR("Failed to find device at index %i\n",id);
return FALSE;
}
private = impl_from_DEVICE_OBJECT(device);
@@ -878,7 +882,7 @@ static BOOL set_mapped_report_from_event(SDL_Event *event)
return FALSE;
}
-static void try_remove_device(SDL_JoystickID index)
+static void try_remove_device(SDL_JoystickID id)
{
DEVICE_OBJECT *device = NULL;
struct platform_private *private;
@@ -886,7 +890,7 @@ static void try_remove_device(SDL_JoystickID index)
SDL_GameController *sdl_controller;
SDL_Haptic *sdl_haptic;
- device = bus_find_hid_device(&sdl_vtbl, ULongToPtr(index));
+ device = bus_enumerate_hid_devices(&sdl_vtbl, compare_joystick_id, ULongToPtr(id));
if (!device) return;
private = impl_from_DEVICE_OBJECT(device);
@@ -905,7 +909,7 @@ static void try_remove_device(SDL_JoystickID index)
pSDL_HapticClose(sdl_haptic);
}
-static void try_add_device(SDL_JoystickID index)
+static void try_add_device(unsigned int index)
{
DWORD vid = 0, pid = 0, version = 0;
DEVICE_OBJECT *device = NULL;
@@ -967,7 +971,7 @@ static void try_add_device(SDL_JoystickID index)
input = 0;
device = bus_create_hid_device(sdl_busidW, vid, pid,
- input, version, id, serial, is_xbox_gamepad, &GUID_DEVCLASS_SDL,
+ input, version, index, serial, is_xbox_gamepad, &GUID_DEVCLASS_SDL,
&sdl_vtbl, sizeof(struct platform_private));
if (device)
--
2.20.1
July 25, 2019