input: Don't send modifiers if client doesn't have a pointer resource

This fixes an uninitialized serial error, were we could send out the
modifier event even if the client didn't have a pointer resource.  We
send out the modifier event to let clients know the modifer mask when
they receive a pointer button event.  Thus, if the client doesn't have
a pointer we don't need to send the modifier event.

Additionally we would send out the modifier event with an
uninitialized serial number.

Finally, this commit restores the order of sending the modifier event
before the enter, like it used to be.  Not likely to be an issue,
since the client will always receive the modifier event before any
button event, but it's a little nicer to give the client the modifier
events before it receives any pointer events.
This commit is contained in:
Kristian Høgsberg 2013-10-09 10:54:03 -07:00
parent b4659eb159
commit cb406f1afd

View File

@ -489,6 +489,12 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
serial = wl_display_next_serial(display);
if (kbd && kbd->focus != pointer->focus)
send_modifiers_to_client_in_list(surface_client,
&kbd->resource_list,
serial,
kbd);
move_resources_for_client(focus_resource_list,
&pointer->resource_list,
surface_client);
@ -503,15 +509,6 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
pointer->focus_serial = serial;
}
if (kbd && surface && surface->resource && kbd->focus != pointer->focus) {
struct wl_client *surface_client =
wl_resource_get_client(surface->resource);
send_modifiers_to_client_in_list(surface_client,
&kbd->resource_list,
serial,
kbd);
}
pointer->focus = surface;
wl_signal_emit(&pointer->focus_signal, pointer);
}