[PATCH v9 5/8] server: Don't emulate rawinput mouse events if native exist.

Rémi Bernon rbernon at codeweavers.com
Mon Jul 29 07:58:12 CDT 2019


On 7/27/19 1:18 AM, Derek Lesho wrote:
> Signed-off-by: Derek Lesho <dereklesho52 at Gmail.com>
> ---
> v9: Make raw-mouse emulation all of nothing
> ---
>   server/protocol.def |  5 +++--
>   server/queue.c      | 14 ++++++++++----
>   2 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/server/protocol.def b/server/protocol.def
> index b5368c71f6..4ce9091661 100644
> --- a/server/protocol.def
> +++ b/server/protocol.def
> @@ -310,8 +310,7 @@ typedef union
>           /* 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
> +#define RIM_ENABLE_NATIVE_MOUSE   0x0800
>   
>   struct hardware_msg_data
>   {
> @@ -367,6 +366,8 @@ typedef union
>       } hw;
>   } hw_input_t;
>   
> +#define RIM_ENABLE_NATIVE_MOUSE_MOVE   0x0800
> +#define RIM_ENABLE_NATIVE_MOUSE_PRESS  0x1000
>   typedef union
>   {
>       unsigned char            bytes[1];   /* raw data for sent messages */
> diff --git a/server/queue.c b/server/queue.c
> index 03e64341c1..fd830d2da1 100644
> --- a/server/queue.c
> +++ b/server/queue.c
> @@ -1599,6 +1599,8 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
>       return 1;
>   }
>   
> +int emulate_raw_mouse = 1;
> +
>   /* queue a hardware message for a mouse event */
>   static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input,
>                                   unsigned int origin, struct msg_queue *sender )
> @@ -1664,7 +1666,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
>           y = desktop->cursor.y;
>       }
>   
> -    if ((device = current->process->rawinput_mouse))
> +    device = current->process->rawinput_mouse;
> +    if (device && emulate_raw_mouse)
>       {
>           if (!(msg = alloc_hardware_message( input->mouse.info, source, time ))) return 0;
>           msg_data = msg->data;
> @@ -1713,11 +1716,11 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
>           }
>   
>           queue_hardware_message( desktop, msg, 0 );
> -
> -        if (device->flags & RIDEV_NOLEGACY)
> -            return FALSE;
>       }
>   
> +    if (device && device->flags & RIDEV_NOLEGACY)
> +        return FALSE;
> +
>       for (i = 0; i < ARRAY_SIZE( messages ); i++)
>       {
>           if (!messages[i]) continue;
> @@ -2466,6 +2469,9 @@ DECL_HANDLER(send_rawinput_message)
>               queue_hardware_message( desktop, msg, 0 );
>           }
>           break;
> +    case RIM_ENABLE_NATIVE_MOUSE_MOVE:
> +        emulate_raw_mouse = 0;
> +        break;
>       default:
>           set_error( STATUS_INVALID_PARAMETER );
>       }
> 

IMHO reacting to the first send_rawinput_message request to decide to 
stop emulating raw input is enough, no need for custom message type that 
may collide at some point with Windows values.
-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list