diff options
Diffstat (limited to 'st.c')
| -rw-r--r-- | st.c | 26 |
1 files changed, 21 insertions, 5 deletions
| @@ -229,6 +229,12 @@ typedef struct { | |||
| 229 | } XWindow; | 229 | } XWindow; |
| 230 | 230 | ||
| 231 | typedef struct { | 231 | typedef struct { |
| 232 | int b; | ||
| 233 | uint mask; | ||
| 234 | char s[ESC_BUF_SIZ]; | ||
| 235 | } Mousekey; | ||
| 236 | |||
| 237 | typedef struct { | ||
| 232 | KeySym k; | 238 | KeySym k; |
| 233 | uint mask; | 239 | uint mask; |
| 234 | char s[ESC_BUF_SIZ]; | 240 | char s[ESC_BUF_SIZ]; |
| @@ -771,10 +777,24 @@ mousereport(XEvent *e) { | |||
| 771 | void | 777 | void |
| 772 | bpress(XEvent *e) { | 778 | bpress(XEvent *e) { |
| 773 | struct timeval now; | 779 | struct timeval now; |
| 780 | Mousekey *mk; | ||
| 774 | 781 | ||
| 775 | if(IS_SET(MODE_MOUSE)) { | 782 | if(IS_SET(MODE_MOUSE)) { |
| 776 | mousereport(e); | 783 | mousereport(e); |
| 777 | } else if(e->xbutton.button == Button1) { | 784 | return; |
| 785 | } | ||
| 786 | |||
| 787 | for(mk = mshortcuts; mk < mshortcuts + LEN(mshortcuts); mk++) { | ||
| 788 | if(e->xbutton.button == mk->b | ||
| 789 | && match(mk->mask, e->xbutton.state)) { | ||
| 790 | ttywrite(mk->s, strlen(mk->s)); | ||
| 791 | if(IS_SET(MODE_ECHO)) | ||
| 792 | techo(mk->s, strlen(mk->s)); | ||
| 793 | return; | ||
| 794 | } | ||
| 795 | } | ||
| 796 | |||
| 797 | if(e->xbutton.button == Button1) { | ||
| 778 | gettimeofday(&now, NULL); | 798 | gettimeofday(&now, NULL); |
| 779 | 799 | ||
| 780 | /* Clear previous selection, logically and visually. */ | 800 | /* Clear previous selection, logically and visually. */ |
| @@ -817,10 +837,6 @@ bpress(XEvent *e) { | |||
| 817 | } | 837 | } |
| 818 | sel.tclick2 = sel.tclick1; | 838 | sel.tclick2 = sel.tclick1; |
| 819 | sel.tclick1 = now; | 839 | sel.tclick1 = now; |
| 820 | } else if(e->xbutton.button == Button4) { | ||
| 821 | ttywrite("\031", 1); | ||
| 822 | } else if(e->xbutton.button == Button5) { | ||
| 823 | ttywrite("\005", 1); | ||
| 824 | } | 840 | } |
| 825 | } | 841 | } |
| 826 | 842 | ||
