diff options
Diffstat (limited to '')
| -rw-r--r-- | x.c | 27 |
1 files changed, 9 insertions, 18 deletions
| @@ -157,7 +157,7 @@ static void selnotify(XEvent *); | |||
| 157 | static void selclear_(XEvent *); | 157 | static void selclear_(XEvent *); |
| 158 | static void selrequest(XEvent *); | 158 | static void selrequest(XEvent *); |
| 159 | static void setsel(char *, Time); | 159 | static void setsel(char *, Time); |
| 160 | static void mousesel(XEvent *); | 160 | static void mousesel(XEvent *, int); |
| 161 | static void mousereport(XEvent *); | 161 | static void mousereport(XEvent *); |
| 162 | static char *kmap(KeySym, uint); | 162 | static char *kmap(KeySym, uint); |
| 163 | static int match(uint, uint); | 163 | static int match(uint, uint); |
| @@ -313,7 +313,7 @@ y2row(int y) | |||
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | void | 315 | void |
| 316 | mousesel(XEvent *e) | 316 | mousesel(XEvent *e, int done) |
| 317 | { | 317 | { |
| 318 | int type, seltype = SEL_REGULAR; | 318 | int type, seltype = SEL_REGULAR; |
| 319 | uint state = e->xbutton.state & ~(Button1Mask | forceselmod); | 319 | uint state = e->xbutton.state & ~(Button1Mask | forceselmod); |
| @@ -324,8 +324,9 @@ mousesel(XEvent *e) | |||
| 324 | break; | 324 | break; |
| 325 | } | 325 | } |
| 326 | } | 326 | } |
| 327 | 327 | selextend(x2col(e->xbutton.x), y2row(e->xbutton.y), seltype, done); | |
| 328 | selextend(x2col(e->xbutton.x), y2row(e->xbutton.y), seltype); | 328 | if (done) |
| 329 | setsel(getsel(), e->xbutton.time); | ||
| 329 | } | 330 | } |
| 330 | 331 | ||
| 331 | void | 332 | void |
| @@ -630,16 +631,10 @@ brelease(XEvent *e) | |||
| 630 | return; | 631 | return; |
| 631 | } | 632 | } |
| 632 | 633 | ||
| 633 | if (e->xbutton.button == Button2) { | 634 | if (e->xbutton.button == Button2) |
| 634 | selpaste(NULL); | 635 | selpaste(NULL); |
| 635 | } else if (e->xbutton.button == Button1) { | 636 | else if (e->xbutton.button == Button1) |
| 636 | if (sel.mode == SEL_READY) { | 637 | mousesel(e, 1); |
| 637 | mousesel(e); | ||
| 638 | setsel(getsel(), e->xbutton.time); | ||
| 639 | } else | ||
| 640 | selclear_(NULL); | ||
| 641 | sel.mode = SEL_IDLE; | ||
| 642 | } | ||
| 643 | } | 638 | } |
| 644 | 639 | ||
| 645 | void | 640 | void |
| @@ -650,11 +645,7 @@ bmotion(XEvent *e) | |||
| 650 | return; | 645 | return; |
| 651 | } | 646 | } |
| 652 | 647 | ||
| 653 | if (!sel.mode) | 648 | mousesel(e, 0); |
| 654 | return; | ||
| 655 | |||
| 656 | sel.mode = SEL_READY; | ||
| 657 | mousesel(e); | ||
| 658 | } | 649 | } |
| 659 | 650 | ||
| 660 | void | 651 | void |
