diff options
| -rw-r--r-- | st.c | 23 |
1 files changed, 14 insertions, 9 deletions
| @@ -423,7 +423,7 @@ static void xsettitle(char *); | |||
| 423 | static void xresettitle(void); | 423 | static void xresettitle(void); |
| 424 | static void xsetpointermotion(int); | 424 | static void xsetpointermotion(int); |
| 425 | static void xseturgency(int); | 425 | static void xseturgency(int); |
| 426 | static void xsetsel(char *); | 426 | static void xsetsel(char *, Time); |
| 427 | static void xtermclear(int, int, int, int); | 427 | static void xtermclear(int, int, int, int); |
| 428 | static void xunloadfont(Font *); | 428 | static void xunloadfont(Font *); |
| 429 | static void xunloadfonts(void); | 429 | static void xunloadfonts(void); |
| @@ -449,7 +449,7 @@ static void selinit(void); | |||
| 449 | static void selnormalize(void); | 449 | static void selnormalize(void); |
| 450 | static inline bool selected(int, int); | 450 | static inline bool selected(int, int); |
| 451 | static char *getsel(void); | 451 | static char *getsel(void); |
| 452 | static void selcopy(void); | 452 | static void selcopy(Time); |
| 453 | static void selscroll(int, int); | 453 | static void selscroll(int, int); |
| 454 | static void selsnap(int, int *, int *, int); | 454 | static void selsnap(int, int *, int *, int); |
| 455 | static int x2col(int); | 455 | static int x2col(int); |
| @@ -984,8 +984,8 @@ getsel(void) { | |||
| 984 | } | 984 | } |
| 985 | 985 | ||
| 986 | void | 986 | void |
| 987 | selcopy(void) { | 987 | selcopy(Time t) { |
| 988 | xsetsel(getsel()); | 988 | xsetsel(getsel(), t); |
| 989 | } | 989 | } |
| 990 | 990 | ||
| 991 | void | 991 | void |
| @@ -997,7 +997,7 @@ selnotify(XEvent *e) { | |||
| 997 | XSelectionEvent *xsev; | 997 | XSelectionEvent *xsev; |
| 998 | 998 | ||
| 999 | ofs = 0; | 999 | ofs = 0; |
| 1000 | xsev = (XSelectionEvent *)e; | 1000 | xsev = &e->xselection; |
| 1001 | if (xsev->property == None) | 1001 | if (xsev->property == None) |
| 1002 | return; | 1002 | return; |
| 1003 | do { | 1003 | do { |
| @@ -1083,6 +1083,9 @@ selrequest(XEvent *e) { | |||
| 1083 | xev.selection = xsre->selection; | 1083 | xev.selection = xsre->selection; |
| 1084 | xev.target = xsre->target; | 1084 | xev.target = xsre->target; |
| 1085 | xev.time = xsre->time; | 1085 | xev.time = xsre->time; |
| 1086 | if (xsre->property == None) | ||
| 1087 | xsre->property = xsre->target; | ||
| 1088 | |||
| 1086 | /* reject */ | 1089 | /* reject */ |
| 1087 | xev.property = None; | 1090 | xev.property = None; |
| 1088 | 1091 | ||
| @@ -1125,11 +1128,13 @@ selrequest(XEvent *e) { | |||
| 1125 | } | 1128 | } |
| 1126 | 1129 | ||
| 1127 | void | 1130 | void |
| 1128 | xsetsel(char *str) { | 1131 | xsetsel(char *str, Time t) { |
| 1129 | free(sel.primary); | 1132 | free(sel.primary); |
| 1130 | sel.primary = str; | 1133 | sel.primary = str; |
| 1131 | 1134 | ||
| 1132 | XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, CurrentTime); | 1135 | XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t); |
| 1136 | if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win) | ||
| 1137 | selclear(0); | ||
| 1133 | } | 1138 | } |
| 1134 | 1139 | ||
| 1135 | void | 1140 | void |
| @@ -1146,7 +1151,7 @@ brelease(XEvent *e) { | |||
| 1146 | selclear(NULL); | 1151 | selclear(NULL); |
| 1147 | } else { | 1152 | } else { |
| 1148 | getbuttoninfo(e); | 1153 | getbuttoninfo(e); |
| 1149 | selcopy(); | 1154 | selcopy(e->xbutton.time); |
| 1150 | } | 1155 | } |
| 1151 | sel.mode = 0; | 1156 | sel.mode = 0; |
| 1152 | tsetdirt(sel.nb.y, sel.ne.y); | 1157 | tsetdirt(sel.nb.y, sel.ne.y); |
| @@ -2390,7 +2395,7 @@ tputtab(int n) { | |||
| 2390 | for(--x; x > 0 && !term.tabs[x]; --x) | 2395 | for(--x; x > 0 && !term.tabs[x]; --x) |
| 2391 | /* nothing */ ; | 2396 | /* nothing */ ; |
| 2392 | } | 2397 | } |
| 2393 | tmoveto(x, term.c.y); | 2398 | term.c.x = LIMIT(x, 0, term.col-1); |
| 2394 | } | 2399 | } |
| 2395 | 2400 | ||
| 2396 | void | 2401 | void |
