Files
strans/popup_layout.c

30 lines
503 B
C

#include "dat.h"
#include "popup_layout.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)
{
if(caret->valid){
*x = caret->x;
*y = caret->y + max(caret->h, 0);
}else{
*x = pointerx + 10;
*y = pointery + 10;
}
*x = max(0, min(*x, screenw - w));
*y = max(0, min(*y, screenh - h));
}