34 lines
600 B
C
34 lines
600 B
C
#include "dat.h"
|
|
#include "fn.h"
|
|
|
|
int
|
|
popupcells(Rune *r, int n)
|
|
{
|
|
int i, w;
|
|
|
|
w = 0;
|
|
for(i = 0; i < n; i++)
|
|
if(r[i] != 0xfe0e && r[i] != 0xfe0f)
|
|
w++;
|
|
return w;
|
|
}
|
|
|
|
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));
|
|
}
|