ODROID-U3 xorg-server debian package fork :
[deb_xorg-server.git] / debian / patches / xi2-resize-touch.patch
1 --- a/dix/touch.c
2 +++ b/dix/touch.c
3 @@ -460,12 +460,26 @@ TouchEventHistoryPush(TouchPointInfoPtr
4 if (ev->flags & (TOUCH_CLIENT_ID | TOUCH_REPLAYING))
5 return;
6
7 + if (ti->history_elements == ti->history_size - 1) {
8 + DeviceEvent *hist = NULL;
9 + size_t sz = ti->history_size * 2;
10 +
11 + if (sz < 10000) {
12 + hist = realloc(ti->history, sz * sizeof(*hist));
13 +
14 + if (hist) {
15 + ti->history = hist;
16 + ti->history_size = sz;
17 + memset(&hist[sz/2], 0, sizeof(*hist)*sz/2);
18 + }
19 + }
20 + }
21 +
22 ti->history[ti->history_elements++] = *ev;
23 - /* FIXME: proper overflow fixes */
24 if (ti->history_elements > ti->history_size - 1) {
25 ti->history_elements = ti->history_size - 1;
26 - DebugF("source device %d: history size %d overflowing for touch %u\n",
27 - ti->sourceid, ti->history_size, ti->client_id);
28 + ErrorF("source device %d: history size %d overflowing for touch %u\n",
29 + ti->sourceid, ti->history_size, ti->client_id);
30 }
31 }
32