static int Divider;
static Atom SelTarget;
static int FontSel;
+static bool SyncMouse = false;
static struct XSel Selections[] = {
{ .name = "PRIMARY" },
{ .name = "CLIPBOARD" },
free(SearchTerm);
SearchTerm = view_fetch(win_view(id), row, col, risfile);
view_findstr(win_view(EDIT), SearchDir, SearchTerm);
+ SyncMouse = true;
} else {
free(FetchCmd[1]);
}
}
}
+static bool draw_csr(View* view, size_t fheight, int x, int y, bool csrdrawn) {
+ if (!csrdrawn && !view_selsize(view)) {
+ int csrclr = (view == &Regions[TAGS] ? TagsCsr : EditCsr);
+ draw_rect(csrclr, x-1, y, 3, 3);
+ draw_rect(csrclr, x, y, 1, fheight);
+ draw_rect(csrclr, x-1, y+fheight-3, 3, 3);
+ csrdrawn = true;
+ }
+ if (SyncMouse && view == &Regions[EDIT]) {
+ XWarpPointer(X.display, X.self, X.self, 0, 0, X.width, X.height, x-4, y + fheight/2);
+ SyncMouse = false;
+ }
+ return csrdrawn;
+}
+
static void draw_view(View* view, XftFont* font, size_t nrows, drawcsr* csr, int bg, int fg, int sel) {
size_t fheight = font->height;
size_t csrx = SIZE_MAX, csry = SIZE_MAX;
rune = ' ';
if (buf_insel(&(view->buffer), row->cols[i].off))
draw_rect(sel, x, y, row->cols[i].width, fheight);
- if (!csr_drawn && !view_selsize(view) && row->cols[i].off == view->buffer.selection.end) {
- draw_rect((i == TAGS ? TagsCsr : EditCsr), x-1, y, 3, 3);
- draw_rect((i == TAGS ? TagsCsr : EditCsr), x, y, 1, fheight);
- draw_rect((i == TAGS ? TagsCsr : EditCsr), x-1, y+fheight-3, 3, 3);
- csr_drawn = true;
- }
+ if (row->cols[i].off == view->buffer.selection.end)
+ csr_drawn = draw_csr(view, fheight, x, y, csr_drawn);
specs[i].glyph = XftCharIndex(X.display, font, rune);
specs[i].x = x;
specs[i].y = y + font->ascent;
return true;
}
}
+
+void win_syncmouse(void) {
+ SyncMouse = true;
+}