[PATCH v2] compositor: send a pointer motion if the focus surface moves under the pointer

Scott Moreau oreaus at gmail.com
Thu Feb 21 07:27:29 PST 2013


On Thu, Feb 21, 2013 at 8:17 AM, Scott Moreau <oreaus at gmail.com> wrote:

> Hi Giulio,
>
> On Thu, Feb 21, 2013 at 8:03 AM, Giulio Camuffo <giuliocamuffo at gmail.com>wrote:
>
>> ---
>>  src/compositor.c | 24 +++++++++++++++++++-----
>>  1 file changed, 19 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/compositor.c b/src/compositor.c
>> index 64d0830..ec0329b 100644
>> --- a/src/compositor.c
>> +++ b/src/compositor.c
>> @@ -776,6 +776,7 @@ weston_device_repick(struct weston_seat *seat)
>>         const struct wl_pointer_grab_interface *interface;
>>         struct weston_surface *surface, *focus;
>>         struct wl_pointer *pointer = seat->seat.pointer;
>> +       int32_t curr_x, curr_y;
>>
>>         if (!pointer)
>>                 return;
>> @@ -783,16 +784,29 @@ weston_device_repick(struct weston_seat *seat)
>>         surface = weston_compositor_pick_surface(seat->compositor,
>>                                                  pointer->x,
>>                                                  pointer->y,
>> -                                                &pointer->current_x,
>> -                                                &pointer->current_y);
>> +                                                &curr_x,
>> +                                                &curr_y);
>>
>>         if (&surface->surface != pointer->current) {
>>                 interface = pointer->grab->interface;
>>                 pointer->current = &surface->surface;
>>                 interface->focus(pointer->grab, &surface->surface,
>> -                                pointer->current_x,
>> -                                pointer->current_y);
>> -       }
>> +                                curr_x,
>> +                                curr_y);
>> +       } else if (pointer->current_x != curr_x ||
>> +                       pointer->current_y != curr_y) {
>> +               /* The current surface moved under the cursor, send
>> +                * a focus and a motion event. */
>>
>
>
> Shouldn't we send an enter event with wl_surface_send_enter() instead?
>

Actually, wl_surface_send_enter() is sent when a surface enters an output.
I meant wl_pointer_send_enter() which is called internally by libwayland in
wl_pointer_set_focus().


>
>
>> +               interface = pointer->grab->interface;
>> +               interface->focus(pointer->grab, &surface->surface,
>> +                                curr_x,
>> +                                curr_y);
>> +               interface->motion(pointer->grab,
>> weston_compositor_get_time(),
>> +                                 curr_x,
>> +                                 curr_y);
>> +       }
>> +       pointer->current_x = curr_x;
>> +       pointer->current_y = curr_y;
>>
>>         focus = (struct weston_surface *) pointer->grab->focus;
>>         if (focus)
>> --
>> 1.8.1.3
>>
>>
>> - Scott
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130221/be1cf70e/attachment-0001.html>


More information about the wayland-devel mailing list