commit 4f39815
Michael Forney
·
2015-10-31 07:11:29 +0000 UTC
parent 402420f
Fix pointer clipping with -DNDEBUG assert is implemented with a no-op macro with -DNDEBUG.
1 files changed,
+6,
-2
+6,
-2
1@@ -32,7 +32,6 @@
2 #include "cursor/cursor_data.h"
3
4 #include <stdio.h>
5-#include <assert.h>
6 #include <wld/wld.h>
7
8 static void
9@@ -258,7 +257,12 @@ clip_position(struct pointer *pointer, wl_fixed_t fx, wl_fixed_t fy)
10 last_y = wl_fixed_to_int(pointer->y);
11
12 if (!pixman_region32_contains_point(&pointer->region, x, y, NULL)) {
13- assert(pixman_region32_contains_point(&pointer->region, last_x, last_y, &box));
14+ if (!pixman_region32_contains_point(&pointer->region, last_x, last_y, &box)) {
15+ WARNING("cursor is not in the visible screen area\n");
16+ pointer->x = 0;
17+ pointer->y = 0;
18+ return;
19+ }
20
21 /* Do some clipping. */
22 x = MAX(MIN(x, box.x2 - 1), box.x1);