swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 4f398154ca87053c6cb7531f64cdd64bea67cac4
parent 402420ff88249298e72c5d513ba49cf7fbf473c2
Author: Michael Forney <mforney@mforney.org>
Date:   Sat, 31 Oct 2015 07:11:29 +0000

Fix pointer clipping with -DNDEBUG

assert is implemented with a no-op macro with -DNDEBUG.

Diffstat:
Mlibswc/pointer.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libswc/pointer.c b/libswc/pointer.c @@ -32,7 +32,6 @@ #include "cursor/cursor_data.h" #include <stdio.h> -#include <assert.h> #include <wld/wld.h> static void @@ -258,7 +257,12 @@ clip_position(struct pointer *pointer, wl_fixed_t fx, wl_fixed_t fy) last_y = wl_fixed_to_int(pointer->y); if (!pixman_region32_contains_point(&pointer->region, x, y, NULL)) { - assert(pixman_region32_contains_point(&pointer->region, last_x, last_y, &box)); + if (!pixman_region32_contains_point(&pointer->region, last_x, last_y, &box)) { + WARNING("cursor is not in the visible screen area\n"); + pointer->x = 0; + pointer->y = 0; + return; + } /* Do some clipping. */ x = MAX(MIN(x, box.x2 - 1), box.x1);