Fix Weston crash on touchscreen input
[AGL/meta-agl.git] / meta-agl / recipes-graphics / wayland / weston / fix-touchscreen-crash.patch
1 Fix Weston crash on touchscreen input
2
3 Check for touch->focus before using it, as some touchscreens will generate
4 out-of-screen coordinates and cause touch->focus to be NULL. (e.g. Raspberry Pi
5 display, some displays after weston-calibrator)
6
7 Bug-AGL: SPEC-309
8
9 Upstream-Status: Backport [https://cgit.freedesktop.org/wayland/weston/commit/src/input.c?id=2c40d1d30eabe46706822a8b5c94579aeba58e84]
10 ===================================================
11 --- a/src/input.c        2015-09-14 14:23:28.000000000 -0400
12 +++ b/src/input.c        2016-11-09 16:06:28.371959318 -0500
13 @@ -245,11 +245,14 @@
14         struct wl_list *resource_list;
15         wl_fixed_t sx, sy;
16  
17 +       if (!touch->focus)
18 +               return;
19 +
20         weston_view_from_global_fixed(touch->focus, x, y, &sx, &sy);
21  
22         resource_list = &touch->focus_resource_list;
23  
24 -       if (!wl_list_empty(resource_list) && touch->focus) {
25 +       if (!wl_list_empty(resource_list)) {
26                 serial = wl_display_next_serial(display);
27                 wl_resource_for_each(resource, resource_list)
28                         wl_touch_send_down(resource, serial, time,
29