X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=aa2cd085eec33f594bcb8aa800fd5f75e6329074;hb=a53017c8b47f511cf0462ac910cf9223a31ceb2f;hp=8065ebee9f1b517d3b0bb3bbc1a705c917ce0141;hpb=1e09726518b84091e80dfaf96632c122f6f446a6;p=st.git diff --git a/st.c b/st.c index 8065ebe..aa2cd08 100644 --- a/st.c +++ b/st.c @@ -229,6 +229,12 @@ typedef struct { } XWindow; typedef struct { + int b; + uint mask; + char s[ESC_BUF_SIZ]; +} Mousekey; + +typedef struct { KeySym k; uint mask; char s[ESC_BUF_SIZ]; @@ -771,10 +777,24 @@ mousereport(XEvent *e) { void bpress(XEvent *e) { struct timeval now; + Mousekey *mk; if(IS_SET(MODE_MOUSE)) { mousereport(e); - } else if(e->xbutton.button == Button1) { + return; + } + + for(mk = mshortcuts; mk < mshortcuts + LEN(mshortcuts); mk++) { + if(e->xbutton.button == mk->b + && match(mk->mask, e->xbutton.state)) { + ttywrite(mk->s, strlen(mk->s)); + if(IS_SET(MODE_ECHO)) + techo(mk->s, strlen(mk->s)); + return; + } + } + + if(e->xbutton.button == Button1) { gettimeofday(&now, NULL); /* Clear previous selection, logically and visually. */ @@ -817,10 +837,6 @@ bpress(XEvent *e) { } sel.tclick2 = sel.tclick1; sel.tclick1 = now; - } else if(e->xbutton.button == Button4) { - ttywrite("\031", 1); - } else if(e->xbutton.button == Button5) { - ttywrite("\005", 1); } } @@ -3442,9 +3458,13 @@ run(void) { if(xev && !FD_ISSET(xfd, &rfd)) xev--; - if(!FD_ISSET(cmdfd, &rfd) && !FD_ISSET(xfd, &rfd) \ - && !blinkset) { - tv = NULL; + if(!FD_ISSET(cmdfd, &rfd) && !FD_ISSET(xfd, &rfd)) { + if(blinkset) { + drawtimeout.tv_usec = 1000 * \ + blinktimeout; + } else { + tv = NULL; + } } } }