22 lines
462 B
C
22 lines
462 B
C
#include "dat.h"
|
|
#include "fn.h"
|
|
|
|
void
|
|
popupposition(Caret *caret, int pointerx, int pointery, int screenw,
|
|
int screenh, int w, int h, int *x, int *y)
|
|
{
|
|
vlong px, py, xmax, ymax;
|
|
|
|
if(caret->valid){
|
|
px = caret->x;
|
|
py = (vlong)caret->y + max(caret->h, 0);
|
|
}else{
|
|
px = (vlong)pointerx + 10;
|
|
py = (vlong)pointery + 10;
|
|
}
|
|
xmax = max((vlong)screenw - w, 0);
|
|
ymax = max((vlong)screenh - h, 0);
|
|
*x = max(0, min(px, xmax));
|
|
*y = max(0, min(py, ymax));
|
|
}
|