void screen_update(Buf* buf, unsigned crsr, unsigned* csrx, unsigned* csry);
unsigned screen_getoff(Buf* buf, unsigned pos, unsigned row, unsigned col);
+
+void screen_getcoords(Buf* buf, unsigned pos, unsigned* posx, unsigned* posy);
+
void screen_setsize(Buf* buf, unsigned nrows, unsigned ncols);
void screen_getsize(unsigned* nrows, unsigned* ncols);
Row* screen_getrow(unsigned row);
select(mevnt);
}
buf_find(&Buffer, &DotBeg, &DotEnd);
+
+ unsigned x, y;
+ screen_getcoords(&Buffer, DotEnd, &x, &y);
+ extern void move_pointer(unsigned x, unsigned y);
+ move_pointer(x, y);
}
void scrollup(MouseEvent* mevnt) {
}
}
+void screen_getcoords(Buf* buf, unsigned pos, unsigned* posx, unsigned* posy) {
+ for (unsigned y = 0; y < NumRows; y++) {
+ unsigned start = Rows[y]->off;
+ unsigned end = Rows[y]->off + Rows[y]->rlen - 1;
+ if (start <= pos && pos <= end) {
+ unsigned off = start;
+ for (unsigned x = 0; x < NumCols;) {
+ if (off == pos) {
+ *posy = y, *posx = x;
+ return;
+ }
+ x += runewidth(x, buf_get(buf,off++));
+ }
+ break;
+ }
+ }
+}
+
void screen_update(Buf* buf, unsigned csr, unsigned* csrx, unsigned* csry) {
/* scroll the view and reflow the screen lines */
sync_view(buf, csr);
unsigned DotEnd;
enum ColorScheme ColorBase;
+void move_pointer(unsigned x, unsigned y) { }
+
int main(int argc, char** argv) {
atf_init(argc,argv);
RUN_EXTERN_TEST_SUITE(BufferTests);
}
return 0;
}
+
+void move_pointer(unsigned x, unsigned y) {
+ x = (x * Fonts.base.width) + (Fonts.base.width / 2);
+ y = ((y+1) * Fonts.base.height) + (Fonts.base.height / 2);
+ XWarpPointer(X.display, X.window, X.window, 0, 0, X.width, X.height, x, y);
+}