}
}
-static void mouse_left(WinRegion id, int state, bool pressed, size_t row, size_t col) {
+static void mouse_left(WinRegion id, bool pressed, size_t row, size_t col) {
static int count = 0;
static Time before = 0;
if (!pressed) return;
count = ((X.now - before) <= (uint64_t)ClickTime ? count+1 : 1);
before = X.now;
- if (PRESSED(state, MouseRight)) {
+ if (PRESSED(X.mods, MouseRight)) {
puts("fetch tag");
- } else if (PRESSED(state, MouseMiddle)) {
+ } else if (PRESSED(X.mods, MouseMiddle)) {
/* if we didnt get an arg, find one in the selection */
char* arg = NULL;
if (!arg || !*arg) arg = view_getstr(win_view(EDIT));
}
}
-static void mouse_middle(WinRegion id, int state, bool pressed, size_t row, size_t col) {
+static void mouse_middle(WinRegion id, bool pressed, size_t row, size_t col) {
if (pressed) { ExecRequest = 1; return; }
- if (PRESSED(state, MouseLeft)) {
+ if (PRESSED(X.mods, MouseLeft)) {
cut(NULL);
} else if (ExecRequest) {
char* str = view_fetch(win_view(id), row, col, riscmd);
}
}
-static void mouse_right(WinRegion id, int state, bool pressed, size_t row, size_t col) {
+static void mouse_right(WinRegion id, bool pressed, size_t row, size_t col) {
if (pressed) return;
- if (PRESSED(state, MouseLeft)) {
+ if (PRESSED(X.mods, MouseLeft)) {
paste(NULL);
} else {
FetchCmd[2] = view_fetch(win_view(id), row, col, risfile);
view_scroll(win_view(id), amount);
}
-static void mouse_click(int btn, int mods, bool pressed, int x, int y) {
+static void mouse_click(int btn, bool pressed, int x, int y) {
size_t row, col;
Focused = (y <= Divider ? TAGS : EDIT);
get_position(Focused, x, y, &row, &col);
switch(btn) {
- case MouseLeft: mouse_left(Focused, mods, pressed, row, col); break;
- case MouseMiddle: mouse_middle(Focused, mods, pressed, row, col); break;
- case MouseRight: mouse_right(Focused, mods, pressed, row, col); break;
+ case MouseLeft: mouse_left(Focused, pressed, row, col); break;
+ case MouseMiddle: mouse_middle(Focused, pressed, row, col); break;
+ case MouseRight: mouse_right(Focused, pressed, row, col); break;
case MouseWheelUp: mouse_scroll(Focused, pressed, -ScrollBy); break;
case MouseWheelDn: mouse_scroll(Focused, pressed, +ScrollBy); break;
}
static void xbtnpress(XConf* x, XEvent* e) {
(void)x;
- mouse_click(e->xbutton.button, e->xbutton.state, true, e->xbutton.x, e->xbutton.y);
+ mouse_click(e->xbutton.button, true, e->xbutton.x, e->xbutton.y);
}
static void xbtnrelease(XConf* x, XEvent* e) {
(void)x;
- mouse_click(e->xbutton.button, e->xbutton.state, false, e->xbutton.x, e->xbutton.y);
+ mouse_click(e->xbutton.button, false, e->xbutton.x, e->xbutton.y);
}
static void xbtnmotion(XConf* x, XEvent* e) {
}
}
-/* Keyboard and Tag Handlers
+/* Keyboard Editing Handlers
******************************************************************************/
static void select_line(char* arg) {
(void)arg;
win_quit();
}
+/* Keyboard and Tag Handlers
+ ******************************************************************************/
+
static void put(char* arg) {
Buf* buf = win_buf(EDIT);
if (buf_save(buf, arg) == NORMAL) {