compositor: rework touch focus
authorPekka Paalanen <ppaalanen@gmail.com>
Tue, 31 Jul 2012 10:21:08 +0000 (13:21 +0300)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 1 Aug 2012 02:27:23 +0000 (22:27 -0400)
commit56464253c02276c386243a844bc781859002d6f1
tree065f44f4052583084baf81489bc7c544be10c67b
parent2fc7cce9b169be4aa97a7e584f5d55db7d5ea65d
compositor: rework touch focus

In the wl_seat conversion, struct wl_touch got fields for the focused
surface and the client resource for the input device being focused.
However, the conversion was incomplete: the old fields
weston_seat::touch_focus* we still used by the event dispatching code,
but the new code never set them. Therefore no touch events were ever
sent.

From weston_seat, remove the fields touch_focus, touch_focus_listener,
touch_focus_resource, and touch_focus_resource_listener. They are
replaced by the corresponding fields and listeners from struct
wl_touch.

While doing this, fix touch_set_focus().

If touch_set_focus() was called first with surface A, and then with
surface B, without being called with NULL in between, it would corrupt
the destroy_signal list. It was equivalent of calling wl_signal_add()
for different signal sources with the same listener without removing in
between.

Now, touch_set_focus() first removes focus and listeners, and then
attempts to assign focus if requested. If the target client has not
subscribed for touch events, the touch focus will now be NULL.
Before this patch, the touch focus was left to the previous surface.

NOTE: this patch depends on the patch "server: add lose_touch_focus()"
for Wayland.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
src/compositor.c
src/compositor.h