1 diff -uNr aterm-0.4.2-orig/autoconf/Make.common.in aterm-0.4.2/autoconf/Make.common.in
2 --- aterm-0.4.2-orig/autoconf/Make.common.in 2001-09-06 18:38:07.000000000 +0200
3 +++ aterm-0.4.2/autoconf/Make.common.in 2004-05-03 01:50:40.995441752 +0200
5 XINC = @X_CFLAGS@ @XPM_CFLAGS@
7 # extra libraries needed by X on some systems, X library location
8 -XLIB = @AFTERSTEP_LIBS@ @X_LIBS@ @X_PRE_LIBS@ @X_EXTRA_LIBS@ @XPM_LIBS@ -lX11
9 +XLIB = @AFTERSTEP_LIBS@ @X_LIBS@ @X_PRE_LIBS@ @X_EXTRA_LIBS@ @XPM_LIBS@ -lX11 -lXmu
11 # End of common section of the Makefile
12 #-------------------------------------------------------------------------
13 diff -uNr aterm-0.4.2-orig/src/command.c aterm-0.4.2/src/command.c
14 --- aterm-0.4.2-orig/src/command.c 2004-05-03 01:38:01.000000000 +0200
15 +++ aterm-0.4.2/src/command.c 2004-05-03 01:46:54.413887384 +0200
17 switch (ev->xbutton.button) {
20 - selection_make(ev->xbutton.time);
21 + selection_make(ev->xbutton.time, ev->xbutton.state);
25 diff -uNr aterm-0.4.2-orig/src/command.c.orig aterm-0.4.2/src/command.c.orig
26 --- aterm-0.4.2-orig/src/command.c.orig 2001-09-06 18:38:07.000000000 +0200
27 +++ aterm-0.4.2/src/command.c.orig 2004-05-03 01:46:54.421886168 +0200
32 - privileges(RESTORE);
35 + if (!(Options & Opt_utmpInhibit))
41 chown(ttydev, ttyfd_stat.st_uid, ttyfd_stat.st_gid);
45 + if (!(Options & Opt_utmpInhibit))
50 @@ -1060,10 +1060,8 @@
54 - privileges(RESTORE);
55 if (!(Options & Opt_utmpInhibit))
56 - makeutent(ttydev, display_name); /* stamp /etc/utmp */
58 + addToUtmp(ttydev, display_name, ptyfd);
62 diff -uNr aterm-0.4.2-orig/src/screen.c aterm-0.4.2/src/screen.c
63 --- aterm-0.4.2-orig/src/screen.c 2001-09-06 18:38:07.000000000 +0200
64 +++ aterm-0.4.2/src/screen.c 2004-05-03 01:46:54.433884344 +0200
67 #include <X11/Xatom.h>
68 #include <X11/Xmd.h> /* get the typedef for CARD32 */
70 +#include <X11/Xmu/Atoms.h>
72 static screen_t screen;
74 @@ -2759,21 +2759,34 @@
76 unsigned long bytes_after, nitems;
87 for (nread = 0, bytes_after = 1; bytes_after > 0; nread += nitems) {
88 if ((XGetWindowProperty(Xdisplay, win, prop, (nread / 4), PROP_SIZE,
89 - Delete, AnyPropertyType, &actual_type,
90 - &actual_fmt, &nitems, &bytes_after,
91 - &data) != Success)) {
93 + Delete, AnyPropertyType, &ct.encoding, &ct.format,
94 + &ct.nitems, &bytes_after, &ct.value) != Success)) {
98 - PasteIt(data, nitems);
101 + if (XmbTextPropertyToTextList(Xdisplay, &ct, &cl, &dummy_count) == Success && cl) {
102 + PasteIt(cl[0], strlen(cl[0]));
103 + XFreeStringList(cl);
105 + PasteIt(ct.value, (unsigned int)ct.nitems);
108 + nread += ct.nitems;
115 @@ -2787,6 +2800,9 @@
116 selection_request(Time tm, int x, int y)
121 + xa = XInternAtom(Xdisplay, "COMPOUND_TEXT", False);
123 if (x < 0 || x >= TermWin.width || y < 0 || y >= TermWin.height)
124 return; /* outside window */
125 @@ -2797,7 +2813,7 @@
126 selection_paste(Xroot, XA_CUT_BUFFER0, False);
128 prop = XInternAtom(Xdisplay, "VT_SELECTION", False);
129 - XConvertSelection(Xdisplay, XA_PRIMARY, XA_STRING, prop, TermWin.vt,
130 + XConvertSelection(Xdisplay, XA_PRIMARY, xa, prop, TermWin.vt,
134 @@ -2827,7 +2843,7 @@
138 -selection_make(Time tm)
139 +selection_make(Time tm, unsigned int key_state)
141 int i, col, end_col, row, end_row;
142 unsigned char *new_selection_text;
143 @@ -2894,7 +2910,13 @@
144 FREE(selection.text);
145 selection.text = new_selection_text;
147 - XSetSelectionOwner(Xdisplay, XA_PRIMARY, TermWin.vt, tm);
148 + // selecting with ALT will put the text to clipboard
149 + if (key_state & Mod1Mask) {
150 + XSetSelectionOwner(Xdisplay, XA_CLIPBOARD(Xdisplay), TermWin.vt, tm);
152 + XSetSelectionOwner(Xdisplay, XA_PRIMARY, TermWin.vt, tm);
155 if (XGetSelectionOwner(Xdisplay, XA_PRIMARY) != TermWin.vt)
156 print_error("can't get primary selection");
157 XChangeProperty(Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8,
158 @@ -3329,11 +3351,21 @@
159 selection_send(XSelectionRequestEvent * rq)
162 - Atom32 target_list[2];
163 + Atom32 target_list[4];
165 static Atom xa_targets = None;
167 + static Atom xa_compound_text = None;
168 + static Atom xa_text = None;
170 + XICCEncodingStyle style;
173 + if (xa_text == None)
174 + xa_text = XInternAtom(Xdisplay, "TEXT", False);
175 + if (xa_compound_text == None)
176 + xa_compound_text = XInternAtom(Xdisplay, "COMPOUND_TEXT", False);
177 if (xa_targets == None)
178 - xa_targets = XInternAtom(Xdisplay, "TARGETS", False);
179 + xa_targets = XInternAtom(Xdisplay, "TARGETS", False);
181 ev.xselection.type = SelectionNotify;
182 ev.xselection.property = None;
183 @@ -3344,18 +3376,37 @@
184 ev.xselection.time = rq->time;
186 if (rq->target == xa_targets) {
187 - target_list[0] = (Atom32) xa_targets;
188 - target_list[1] = (Atom32) XA_STRING;
189 + target_list[0] = (Atom32) xa_targets;
190 + target_list[1] = (Atom32) XA_STRING;
191 + target_list[2] = (Atom32) xa_text;
192 + target_list[3] = (Atom32) xa_compound_text;
194 XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target,
195 - (8 * sizeof(target_list[0])), PropModeReplace,
196 - (unsigned char *)target_list,
197 - (sizeof(target_list) / sizeof(target_list[0])));
198 - ev.xselection.property = rq->property;
199 - } else if (rq->target == XA_STRING) {
200 - XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target,
201 - 8, PropModeReplace, selection.text, selection.len);
202 - ev.xselection.property = rq->property;
203 + (8 * sizeof(target_list[0])), PropModeReplace,
204 + (unsigned char *)target_list,
205 + (sizeof(target_list) / sizeof(target_list[0])));
206 + ev.xselection.property = rq->property;
208 + } else if (rq->target == XA_STRING
209 + || rq->target == xa_compound_text
210 + || rq->target == xa_text) {
212 + if (rq->target == XA_STRING) {
213 + style = XStringStyle;
214 + target = XA_STRING;
216 + target = xa_compound_text;
217 + style = (rq->target == xa_compound_text) ? XCompoundTextStyle
218 + : XStdICCTextStyle;
221 + cl[0] = selection.text;
222 + XmbTextListToTextProperty(Xdisplay, cl, 1, style, &ct);
223 + XChangeProperty(Xdisplay, rq->requestor, rq->property,
224 + target, 8, PropModeReplace, ct.value, ct.nitems);
225 + ev.xselection.property = rq->property;
228 XSendEvent(Xdisplay, rq->requestor, False, 0, &ev);