]> git.pld-linux.org Git - packages/aterm.git/blob - aterm-copy.patch
d0cfa1cb12fd28aa753737172387d6d2b7866ebd
[packages/aterm.git] / aterm-copy.patch
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
4 @@ -59,7 +59,7 @@
5  XINC = @X_CFLAGS@ @XPM_CFLAGS@
6  
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
10  
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
16 @@ -2651,7 +2651,7 @@
17                 switch (ev->xbutton.button) {
18                 case Button1:
19                 case Button3:
20 -                   selection_make(ev->xbutton.time);
21 +                   selection_make(ev->xbutton.time, ev->xbutton.state);
22                     break;
23  
24                 case Button2:
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
28 @@ -425,9 +425,8 @@
29      signal(sig, SIG_DFL);
30  
31  #ifdef UTMP_SUPPORT
32 -    privileges(RESTORE);
33 -    cleanutent();
34 -    privileges(IGNORE);
35 +      if (!(Options & Opt_utmpInhibit))
36 +       removeFromUtmp();
37  #endif
38  
39      kill(getpid(), sig);
40 @@ -452,7 +451,8 @@
41      chown(ttydev, ttyfd_stat.st_uid, ttyfd_stat.st_gid);
42  #endif
43  #ifdef UTMP_SUPPORT
44 -    cleanutent();
45 +      if (!(Options & Opt_utmpInhibit))
46 +       removeFromUtmp();
47  #endif
48      privileges(IGNORE);
49  }
50 @@ -1060,10 +1060,8 @@
51         exit(EXIT_FAILURE);
52      }
53  #ifdef UTMP_SUPPORT
54 -    privileges(RESTORE);
55      if (!(Options & Opt_utmpInhibit))
56 -       makeutent(ttydev, display_name);        /* stamp /etc/utmp */
57 -    privileges(IGNORE);
58 +       addToUtmp(ttydev, display_name, ptyfd);
59  #endif
60  
61      return 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
65 @@ -44,7 +44,7 @@
66  
67  #include <X11/Xatom.h>
68  #include <X11/Xmd.h>           /* get the typedef for CARD32 */
69 -
70 +#include <X11/Xmu/Atoms.h>
71  
72  static screen_t    screen;
73  
74 @@ -2759,21 +2759,34 @@
75      long            nread;
76      unsigned long   bytes_after, nitems;
77      unsigned char  *data;
78 +    XTextProperty   ct;
79      Atom            actual_type;
80      int             actual_fmt;
81 +    int             dummy_count;
82 +    char          **cl;
83  
84      if (prop == None)
85         return;
86 +
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)) {
92 -           XFree(data);
93 +                               Delete, AnyPropertyType, &ct.encoding, &ct.format,
94 +                               &ct.nitems, &bytes_after, &ct.value) != Success)) {
95 +           XFree(ct.value);
96             return;
97         }
98 -       PasteIt(data, nitems);
99 -       XFree(data);
100 +       
101 +       if (XmbTextPropertyToTextList(Xdisplay, &ct, &cl, &dummy_count) == Success && cl) {
102 +            PasteIt(cl[0], strlen(cl[0]));
103 +           XFreeStringList(cl);
104 +       } else {
105 +           PasteIt(ct.value, (unsigned int)ct.nitems);
106 +       }
107 +
108 +       nread += ct.nitems;
109 +
110 +       if (ct.value)
111 +           XFree(ct.value);
112      }
113  }
114  
115 @@ -2787,6 +2800,9 @@
116  selection_request(Time tm, int x, int y)
117  {
118      Atom            prop;
119 +    Atom            xa;
120 +
121 +    xa = XInternAtom(Xdisplay, "COMPOUND_TEXT", False);
122  
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);
127      } else {
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,
131                           tm);
132      }
133  }
134 @@ -2827,7 +2843,7 @@
135   */
136  /* PROTO */
137  void
138 -selection_make(Time tm)
139 +selection_make(Time tm, unsigned int key_state)
140  {
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;
146  
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);
151 +    } else {
152 +        XSetSelectionOwner(Xdisplay, XA_PRIMARY, TermWin.vt, tm);
153 +    }
154 +       
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)
160  {
161      XEvent          ev;
162 -    Atom32          target_list[2];
163 +    Atom32          target_list[4];
164 +    Atom            target;
165      static Atom     xa_targets = None;
166 -
167 +    static Atom     xa_compound_text = None;
168 +    static Atom     xa_text = None;
169 +    XTextProperty   ct;
170 +    XICCEncodingStyle style;
171 +    char           *cl[4];
172 +
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);
180  
181      ev.xselection.type = SelectionNotify;
182      ev.xselection.property = None;
183 @@ -3344,18 +3376,37 @@
184      ev.xselection.time = rq->time;
185  
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;
193 +       
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;
207 +
208 +    } else if (rq->target == XA_STRING
209 +               || rq->target == xa_compound_text
210 +               || rq->target == xa_text) {
211 +       
212 +       if (rq->target == XA_STRING) {
213 +            style = XStringStyle;
214 +            target = XA_STRING;
215 +        } else {
216 +            target = xa_compound_text;
217 +            style = (rq->target == xa_compound_text) ? XCompoundTextStyle
218 +                     : XStdICCTextStyle;
219 +        }
220 +        
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;
226      }
227 +
228      XSendEvent(Xdisplay, rq->requestor, False, 0, &ev);
229  }
230  
This page took 0.10106 seconds and 2 git commands to generate.