mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
1f57e72212
SpiderMonkey was updated to mozjs24. If you want to build elinks with ecmascript support, you must compile using g++ with -fpermissive . There is a lot of warnings. There are some memleaks in ecmascript code, especially related to JSAutoCompartment. I don't know yet, where and how to free it. Debian does not support mozjs24, so I'm going to gradually update SpiderMonkey version.
74 lines
1.4 KiB
C
74 lines
1.4 KiB
C
#ifndef EL__UTIL_BOX_H
|
|
#define EL__UTIL_BOX_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** A rectangular part of a drawing surface, such as the screen. */
|
|
struct el_box {
|
|
int x;
|
|
int y;
|
|
int width;
|
|
int height;
|
|
};
|
|
|
|
/** @relates box */
|
|
static inline int
|
|
is_in_box(struct el_box *box, int x, int y)
|
|
{
|
|
return (x >= box->x && y >= box->y
|
|
&& x < box->x + box->width
|
|
&& y < box->y + box->height);
|
|
}
|
|
|
|
/** @relates box */
|
|
static inline int
|
|
row_is_in_box(struct el_box *box, int y)
|
|
{
|
|
return (y >= box->y && y < box->y + box->height);
|
|
}
|
|
|
|
/** @relates box */
|
|
static inline int
|
|
col_is_in_box(struct el_box *box, int x)
|
|
{
|
|
return (x >= box->x && x < box->x + box->width);
|
|
}
|
|
|
|
/** Check whether a span of columns is in @a box.
|
|
* Mainly intended for use with double-width characters.
|
|
* @relates box */
|
|
static inline int
|
|
colspan_is_in_box(struct el_box *box, int x, int span)
|
|
{
|
|
return (x >= box->x && x + span <= box->x + box->width);
|
|
}
|
|
|
|
|
|
/** @relates box */
|
|
static inline void
|
|
set_box(struct el_box *box, int x, int y, int width, int height)
|
|
{
|
|
box->x = int_max(0, x);
|
|
box->y = int_max(0, y);
|
|
box->width = int_max(0, width);
|
|
box->height = int_max(0, height);
|
|
}
|
|
|
|
/** @relates box */
|
|
static inline void
|
|
copy_box(struct el_box *dst, struct el_box *src)
|
|
{
|
|
copy_struct(dst, src);
|
|
}
|
|
|
|
#define dbg_show_box(box) DBG("x=%i y=%i width=%i height=%i", (box)->x, (box)->y, (box)->width, (box)->height)
|
|
#define dbg_show_xy(x_, y_) DBG("x=%i y=%i", x_, y_)
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|