X-Git-Url: https://jasonwoof.com/gitweb/?p=st.git;a=blobdiff_plain;f=st.c;h=4a505b528fb562e3487402bbd77675852062cbc2;hp=088df02a43264e793d8ec85126ee111d48350887;hb=d945d7093d1822bf249e2e38ce97e5b37f695fdb;hpb=e2aa4d8e8467c0cf53bcc2fd31bfe4586658a899 diff --git a/st.c b/st.c index 088df02..4a505b5 100644 --- a/st.c +++ b/st.c @@ -649,9 +649,10 @@ utf8validate(long *u, size_t i) { static void selinit(void) { - memset(&sel.tclick1, 0, sizeof(sel.tclick1)); - memset(&sel.tclick2, 0, sizeof(sel.tclick2)); + clock_gettime(CLOCK_MONOTONIC, &sel.tclick1); + clock_gettime(CLOCK_MONOTONIC, &sel.tclick2); sel.mode = 0; + sel.snap = 0; sel.ob.x = -1; sel.primary = NULL; sel.clipboard = NULL; @@ -820,66 +821,67 @@ getbuttoninfo(XEvent *e) { void mousereport(XEvent *e) { - int x = x2col(e->xbutton.x), y = y2row(e->xbutton.y), - button = e->xbutton.button, state = e->xbutton.state, - len; - char buf[40]; - static int ox, oy; - - /* from urxvt */ - if(e->xbutton.type == MotionNotify) { - if(x == ox && y == oy) - return; - if(!IS_SET(MODE_MOUSEMOTION) && !IS_SET(MODE_MOUSEMANY)) - return; - /* MOUSE_MOTION: no reporting if no button is pressed */ - if(IS_SET(MODE_MOUSEMOTION) && oldbutton == 3) - return; - - button = oldbutton + 32; - ox = x; - oy = y; - } else { - if(!IS_SET(MODE_MOUSESGR) && e->xbutton.type == ButtonRelease) { - button = 3; - } else { - button -= Button1; - if(button >= 3) - button += 64 - 3; - } - if(e->xbutton.type == ButtonPress) { - oldbutton = button; - ox = x; - oy = y; - } else if(e->xbutton.type == ButtonRelease) { - oldbutton = 3; - /* MODE_MOUSEX10: no button release reporting */ - if(IS_SET(MODE_MOUSEX10)) - return; - if (button == 64 || button == 65) - return; - } - } - - if(!IS_SET(MODE_MOUSEX10)) { - button += (state & ShiftMask ? 4 : 0) - + (state & Mod4Mask ? 8 : 0) - + (state & ControlMask ? 16 : 0); - } - - len = 0; - if(IS_SET(MODE_MOUSESGR)) { - len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c", - button, x+1, y+1, - e->xbutton.type == ButtonRelease ? 'm' : 'M'); - } else if(x < 223 && y < 223) { - len = snprintf(buf, sizeof(buf), "\033[M%c%c%c", - 32+button, 32+x+1, 32+y+1); - } else { - return; - } - - ttywrite(buf, len); + return; // jason +// int x = x2col(e->xbutton.x), y = y2row(e->xbutton.y), +// button = e->xbutton.button, state = e->xbutton.state, +// len; +// char buf[40]; +// static int ox, oy; +// +// /* from urxvt */ +// if(e->xbutton.type == MotionNotify) { +// if(x == ox && y == oy) +// return; +// if(!IS_SET(MODE_MOUSEMOTION) && !IS_SET(MODE_MOUSEMANY)) +// return; +// /* MOUSE_MOTION: no reporting if no button is pressed */ +// if(IS_SET(MODE_MOUSEMOTION) && oldbutton == 3) +// return; +// +// button = oldbutton + 32; +// ox = x; +// oy = y; +// } else { +// if(!IS_SET(MODE_MOUSESGR) && e->xbutton.type == ButtonRelease) { +// button = 3; +// } else { +// button -= Button1; +// if(button >= 3) +// button += 64 - 3; +// } +// if(e->xbutton.type == ButtonPress) { +// oldbutton = button; +// ox = x; +// oy = y; +// } else if(e->xbutton.type == ButtonRelease) { +// oldbutton = 3; +// /* MODE_MOUSEX10: no button release reporting */ +// if(IS_SET(MODE_MOUSEX10)) +// return; +// if (button == 64 || button == 65) +// return; +// } +// } +// +// if(!IS_SET(MODE_MOUSEX10)) { +// button += (state & ShiftMask ? 4 : 0) +// + (state & Mod4Mask ? 8 : 0) +// + (state & ControlMask ? 16 : 0); +// } +// +// len = 0; +// if(IS_SET(MODE_MOUSESGR)) { +// len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c", +// button, x+1, y+1, +// e->xbutton.type == ButtonRelease ? 'm' : 'M'); +// } else if(x < 223 && y < 223) { +// len = snprintf(buf, sizeof(buf), "\033[M%c%c%c", +// 32+button, 32+x+1, 32+y+1); +// } else { +// return; +// } +// +// ttywrite(buf, len); } void