Commit Diff


commit - 1555bd7aaad44bb26e0442a6798671be636df5b3
commit + e39b8b19286e7c6054953a88935442ec29a68eec
blob - d897fcde92b09889ede97bfe3856c7c0da167c3b
blob + 514deb30578d644b49a63bbceef66e6bfbf62204
--- plumb/basic
+++ plumb/basic
@@ -57,7 +57,7 @@ data set	$file
 attr add	addr=$3
 plumb to edit
 plumb start /usr/local/plan9/bin/B $file
-#plumb client window $editor
+# plumb client window $editor
 
 # .h files are looked up in /sys/include and passed to edit
 type is text
@@ -66,7 +66,8 @@ arg isfile	/sys/include/$1
 data set	$file
 attr add	addr=$3
 plumb to edit
-plumb client window $editor
+plumb start /usr/local/plan9/bin/B $file
+# plumb client window $editor
 
 # .m files are looked up in /sys/module and passed to edit
 type is text
@@ -75,7 +76,8 @@ arg isfile	/sys/module/$1
 data set	$file
 attr add	addr=$3
 plumb to edit
-plumb client window $editor
+plumb start /usr/local/plan9/bin/B $file
+# plumb client window $editor
 
 # faces -> new mail window for message
 type	is	text
blob - 0f0ab11201024e491ebef601843f6c325b2148ab
blob + b8a63c5714c8f854c690acba69126db45aea059b
--- src/cmd/mkfile
+++ src/cmd/mkfile
@@ -6,7 +6,7 @@ LDFLAGS=$LDFLAGS -lsec -lregexp9 -l9 -lbio -lfmt -lutf
 
 <$PLAN9/src/mkmany
 
-BUGGERED='CVS|oplumb|plumb|plumb2|mk|vac|9term|venti'
+BUGGERED='CVS|oplumb|plumb|plumb2|mk|vac|9term|venti|htmlfmt'
 DIRS=`ls -l |sed -n 's/^d.* //p' |egrep -v "$BUGGERED"`
 
 <$PLAN9/src/mkdirs
blob - a83d5b9d1893743875b23b8b1940078d1e1a2652
blob + 085082dfb067addc16a5e28d4f4b98e0d3c47c17
--- src/libdraw/x11-init.c
+++ src/libdraw/x11-init.c
@@ -379,6 +379,10 @@ xattach(char *label)
 	 * Look up clipboard atom.
 	 */
 	_x.clipboard = XInternAtom(_x.display, "CLIPBOARD", False);
+	_x.utf8string = XInternAtom(_x.display, "UTF8_STRING", False);
+	_x.targets = XInternAtom(_x.display, "TARGETS", False);
+	_x.text = XInternAtom(_x.display, "TEXT", False);
+	_x.compoundtext = XInternAtom(_x.display, "COMPOUND_TEXT", False);
 
 	/*
 	 * Lots of display connections for various procs.
blob - 337bf5b6f56a87c9d1d7fa4e3d9be27ac521a027
blob + 0c9924499c38d1708611fe582620a6de315af31d
--- src/libdraw/x11-itrans.c
+++ src/libdraw/x11-itrans.c
@@ -378,6 +378,9 @@ xgetsnarf(XDisplay *xd)
 	 * come, and we have no way to time out.  Instead, we will clear
 	 * local property #1, request our buddy to fill it in for us, and poll
 	 * until he's done or we get tired of waiting.
+	 *
+	 * We should try to go for _x.utf8string instead of XA_STRING,
+	 * but that would add to the polling.
 	 */
 	prop = 1;
 	XChangeProperty(xd, _x.drawable, prop, XA_STRING, 8, PropModeReplace, (uchar*)"", 0);
@@ -392,7 +395,7 @@ xgetsnarf(XDisplay *xd)
 			break;
 		lastlen = len;
 	}
-	if(i == 30){
+	if(i == 10){
 		data = nil;
 		goto out;
 	}
@@ -400,7 +403,7 @@ xgetsnarf(XDisplay *xd)
 	data = nil;
 	XGetWindowProperty(xd, _x.drawable, prop, 0, SnarfSize/sizeof(ulong), 0, 
 		AnyPropertyType, &type, &fmt, &len, &dummy, &xdata);
-	if(type != XA_STRING || len == 0){
+	if((type != XA_STRING && type != _x.utf8string) || len == 0){
 		if(xdata)
 			XFree(xdata);
 		data = nil;
@@ -444,19 +447,33 @@ xputsnarf(XDisplay *xd, char *data)
 int
 xselect(XEvent *e, XDisplay *xd)
 {
+	char *name;
 	XEvent r;
 	XSelectionRequestEvent *xe;
+	Atom a[4];
 
 	memset(&r, 0, sizeof r);
 	xe = (XSelectionRequestEvent*)e;
-	if(1 || xe->target == XA_STRING){
-		qlock(&clip.lk);
-		XChangeProperty(xd, xe->requestor, xe->property, XA_STRING, 8,
-			PropModeReplace, (uchar*)clip.buf, strlen(clip.buf)+1);
-		qunlock(&clip.lk);
-		r.xselection.property = xe->property;
+if(0) fprint(2, "xselect target=%d requestor=%d property=%d selection=%d\n",
+	xe->target, xe->requestor, xe->property, xe->selection);
+	r.xselection.property = xe->property;
+	if(xe->target == _x.targets){
+		a[0] = XA_STRING;
+		a[1] = _x.utf8string;
+		a[2] = _x.text;
+		a[3] = _x.compoundtext;
+
+		XChangeProperty(xd, xe->requestor, xe->property, xe->target,
+			8, PropModeReplace, (uchar*)a, sizeof a);
+	}else if(xe->target == XA_STRING || xe->target == _x.utf8string || xe->target == _x.text || xe->target == _x.compoundtext){
+		/* if the target is STRING we're supposed to reply with Latin1 XXX */
+		qlock(&clip.lk);
+		XChangeProperty(xd, xe->requestor, xe->property, xe->target,
+			8, PropModeReplace, (uchar*)clip.buf, strlen(clip.buf));
+		qunlock(&clip.lk);
 	}else{
-		fprint(2, "asked for a %d\n", xe->target);
+		name = XGetAtomName(xd, xe->target);
+		fprint(2, "%s: cannot handle selection request for '%s' (%d)\n", argv0, name, (int)xe->target);
 		r.xselection.property = None;
 	}
 
blob - 1b1012be7a2b42e472ac4c31388363c37f2c09ec
blob + afd47ccc4d52fa961b239054a0ab4ad6f5f4e01e
--- src/libdraw/x11-memdraw.h
+++ src/libdraw/x11-memdraw.h
@@ -65,6 +65,10 @@ struct Xprivate {
 	XVisual		*vis;
 	u32int		white;
 	Atom		clipboard;
+	Atom		utf8string;
+	Atom		targets;
+	Atom		text;
+	Atom		compoundtext;
 	uint		putsnarf;
 	uint		assertsnarf;
 	int		destroyed;