[5880] in Athena Bugs
7.1 Emacs wedges when trying to paste into an EZ window
daemon@ATHENA.MIT.EDU (epeisach@ATHENA.MIT.EDU)
Tue Aug 28 15:02:43 1990
From: epeisach@ATHENA.MIT.EDU
Date: Tue, 28 Aug 90 15:02:27 -0400
To: bugs@ATHENA.MIT.EDU
The old code was crufty stilen probably from the R3 Text widget befoe
ICCCM was finally defined. The length that is passed in for the
particular case of failure is supposed to be set and has no valid value
(usually very large). The only thing I'm not certain about is the use
of XtRealloc when the Text.c used XtMalloc, but I suspect that
everything should work....
Ezra
Fix follows:
RCS file: RCS/x11term.c,v
retrieving revision 1.1
diff -c -r1.1 x11term.c
*** /tmp/,RCSt1002036 Tue Aug 28 14:55:57 1990
--- x11term.c Tue Aug 28 14:43:25 1990
***************
*** 1908,1913 ****
--- 1908,1914 ----
/*
* A bit of this was borrowed from the Athena Widget set - not all
* this grossness is mine!
+ * This was based on lib/Xaw/Text.c:ConvertSelection()
*/
Boolean EmacsConvertSelection(w, selection, target,
***************
*** 1923,1929 ****
* have no idea why this isn't more automatic.
*/
XmuInternAtom(XXdisplay, XmuMakeAtom("foo"));
!
if (*target == XA_TARGETS(XXdisplay)) {
Atom* targetP;
Atom* std_targets;
--- 1924,1930 ----
* have no idea why this isn't more automatic.
*/
XmuInternAtom(XXdisplay, XmuMakeAtom("foo"));
!
if (*target == XA_TARGETS(XXdisplay)) {
Atom* targetP;
Atom* std_targets;
***************
*** 1931,1943 ****
XmuConvertStandardSelection(w, CurrentTime, selection, target, type,
(caddr_t*)&std_targets, &std_length,
format);
! *value = XtRealloc(*value, sizeof(Atom)*(std_length + 5 + *length));
! targetP = *(Atom**)value + *length;
! *length += std_length + 4;
*targetP++ = XA_STRING;
*targetP++ = XA_TEXT(XXdisplay);
*targetP++ = XA_LENGTH(XXdisplay);
*targetP++ = XA_LIST_LENGTH(XXdisplay);
bcopy((char*)std_targets, (char*)targetP, sizeof(Atom)*std_length);
XtFree((char*)std_targets);
*type = XA_ATOM;
--- 1932,1946 ----
XmuConvertStandardSelection(w, CurrentTime, selection, target, type,
(caddr_t*)&std_targets, &std_length,
format);
! *value = XtRealloc(*value, sizeof(Atom)*(std_length + 7));
! targetP = *(Atom**)value;
! *length = std_length + 6;
*targetP++ = XA_STRING;
*targetP++ = XA_TEXT(XXdisplay);
+ *targetP++ = XA_COMPOUND_TEXT(XXdisplay);
*targetP++ = XA_LENGTH(XXdisplay);
*targetP++ = XA_LIST_LENGTH(XXdisplay);
+ *targetP++ = XA_CHARACTER_POSITION(XXdisplay);
bcopy((char*)std_targets, (char*)targetP, sizeof(Atom)*std_length);
XtFree((char*)std_targets);
*type = XA_ATOM;
***************
*** 1945,1963 ****
return True;
}
! if (*target == XA_STRING || *target == XA_TEXT(XXdisplay)) {
! *type = XA_STRING;
*value = XXCurrentSelection;
*length = XXCurrentSelectionSize;
*format = 8;
return True;
}
! if (*target == XA_LIST_LENGTH(XXdisplay)) {
*value = XtMalloc(4);
if (sizeof(long) == 4)
! *(long*)*value = 1;
else {
! long temp = 1;
bcopy( ((char*)&temp)+sizeof(long)-4, (char*)*value, 4);
}
*type = XA_INTEGER;
--- 1948,1971 ----
return True;
}
! if (*target == XA_STRING || *target == XA_TEXT(XXdisplay) ||
! *target == XA_COMPOUND_TEXT(XXdisplay)) {
! if (*target == XA_COMPOUND_TEXT(XXdisplay))
! *type = *target;
! else
! *type = XA_STRING;
*value = XXCurrentSelection;
*length = XXCurrentSelectionSize;
*format = 8;
return True;
}
!
! if ( *target == XA_LIST_LENGTH(XXdisplay)) {
*value = XtMalloc(4);
if (sizeof(long) == 4)
! *(long*)*value = 1L;
else {
! long temp = 1L;
bcopy( ((char*)&temp)+sizeof(long)-4, (char*)*value, 4);
}
*type = XA_INTEGER;
***************
*** 1978,1983 ****
--- 1986,1994 ----
*format = 32;
return True;
}
+
+ /* Missing XA_CHARACTER_POSITION */
+
if (*target == XA_DELETE(XXdisplay)) {
/* XXX Should I be doing something here? */
*value = NULL;