# HG changeset patch # User John Tsiombikas # Date 1607786400 -7200 # Node ID 48e708baa7be9722ce85d28e6a308f9ec8e8f134 # Parent b352e29dc35a0ea53ad8a37035d0f4ce0a367ab8 added predicate imtk_layout_contains(x, y) diff -r b352e29dc35a -r 48e708baa7be src/imtk.h --- a/src/imtk.h Thu Mar 20 07:00:38 2014 +0200 +++ b/src/imtk.h Sat Dec 12 17:20:00 2020 +0200 @@ -85,6 +85,7 @@ void imtk_layout_newline(void); void imtk_layout_get_pos(int *x, int *y); void imtk_layout_get_bounds(int *bbox); +int imtk_layout_contains(int x, int y); /* defined in draw.c */ void imtk_set_color(unsigned int col, float r, float g, float b, float a); diff -r b352e29dc35a -r 48e708baa7be src/layout.c --- a/src/layout.c Thu Mar 20 07:00:38 2014 +0200 +++ b/src/layout.c Sat Dec 12 17:20:00 2020 +0200 @@ -99,3 +99,14 @@ { memcpy(bbox, st[top].box, sizeof st[top].box); } + +int imtk_layout_contains(int x, int y) +{ + if(x < st[top].box[0] || x >= st[top].box[0] + st[top].box[2]) { + return 0; + } + if(y < st[top].box[1] || y >= st[top].box[1] + st[top].box[3]) { + return 0; + } + return 1; +}