fix: harden caret and IBus dispatch
This commit is contained in:
@@ -17,13 +17,17 @@ 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){
|
||||
*x = caret->x;
|
||||
*y = caret->y + max(caret->h, 0);
|
||||
px = caret->x;
|
||||
py = (vlong)caret->y + max(caret->h, 0);
|
||||
}else{
|
||||
*x = pointerx + 10;
|
||||
*y = pointery + 10;
|
||||
px = (vlong)pointerx + 10;
|
||||
py = (vlong)pointery + 10;
|
||||
}
|
||||
*x = max(0, min(*x, screenw - w));
|
||||
*y = max(0, min(*y, screenh - h));
|
||||
xmax = max((vlong)screenw - w, 0);
|
||||
ymax = max((vlong)screenh - h, 0);
|
||||
*x = max(0, min(px, xmax));
|
||||
*y = max(0, min(py, ymax));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user