diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
commit | 02d7aa8915f9c3a3288dab01f321eb94ba219e3b (patch) | |
tree | f053238978479e408a2b83571443e132f30586ab /src/cmd/snarfer | |
parent | c0c9d8f883dfd3a7f5a74499d91bb95884b15873 (diff) | |
parent | 3d1382b98a502d0c34d5ba2c462396acc515016e (diff) | |
download | plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.gz plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.bz2 plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/cmd/snarfer')
-rw-r--r-- | src/cmd/snarfer/mac-snarfer.c (renamed from src/cmd/snarfer/osx-cocoa-snarfer.c) | 1 | ||||
-rw-r--r-- | src/cmd/snarfer/mkfile | 2 | ||||
-rw-r--r-- | src/cmd/snarfer/osx-snarfer.c | 2 | ||||
-rw-r--r-- | src/cmd/snarfer/snarfer.c | 26 |
4 files changed, 13 insertions, 18 deletions
diff --git a/src/cmd/snarfer/osx-cocoa-snarfer.c b/src/cmd/snarfer/mac-snarfer.c index 20f5b6ad..613a8cc5 100644 --- a/src/cmd/snarfer/osx-cocoa-snarfer.c +++ b/src/cmd/snarfer/mac-snarfer.c @@ -1,2 +1 @@ #include "snarfer.c" - diff --git a/src/cmd/snarfer/mkfile b/src/cmd/snarfer/mkfile index 66fa9015..66192085 100644 --- a/src/cmd/snarfer/mkfile +++ b/src/cmd/snarfer/mkfile @@ -9,4 +9,4 @@ HFILES= <$PLAN9/src/mkone x11-snarfer.$O: snarfer.c -osx-snarfer.$O: snarfer.c +mac-snarfer.$O: snarfer.c diff --git a/src/cmd/snarfer/osx-snarfer.c b/src/cmd/snarfer/osx-snarfer.c deleted file mode 100644 index 20f5b6ad..00000000 --- a/src/cmd/snarfer/osx-snarfer.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "snarfer.c" - diff --git a/src/cmd/snarfer/snarfer.c b/src/cmd/snarfer/snarfer.c index 9477f042..d09b2f44 100644 --- a/src/cmd/snarfer/snarfer.c +++ b/src/cmd/snarfer/snarfer.c @@ -89,7 +89,7 @@ void main(int argc, char **argv) { XEvent xevent; - + ARGBEGIN{ default: usage(); @@ -100,14 +100,14 @@ main(int argc, char **argv) if((xdisplay = XOpenDisplay(nil)) == nil) sysfatal("XOpenDisplay: %r"); - drawable = XCreateWindow(xdisplay, DefaultRootWindow(xdisplay), - 0, 0, 1, 1, 0, 0, - InputOutput, DefaultVisual(xdisplay, DefaultScreen(xdisplay)), + drawable = XCreateWindow(xdisplay, DefaultRootWindow(xdisplay), + 0, 0, 1, 1, 0, 0, + InputOutput, DefaultVisual(xdisplay, DefaultScreen(xdisplay)), 0, 0); if(drawable == None) sysfatal("XCreateWindow: %r"); XFlush(xdisplay); - + xclipboard = XInternAtom(xdisplay, "CLIPBOARD", False); xutf8string = XInternAtom(xdisplay, "UTF8_STRING", False); xtargets = XInternAtom(xdisplay, "TARGETS", False); @@ -122,7 +122,7 @@ main(int argc, char **argv) xgetsnarf(); appleputsnarf(); xputsnarf(); - + for(;;){ XNextEvent(xdisplay, &xevent); switch(xevent.type){ @@ -150,9 +150,9 @@ xselectionrequest(XEvent *e) XEvent r; XSelectionRequestEvent *xe; XDisplay *xd; - + xd = xdisplay; - + memset(&r, 0, sizeof r); xe = (XSelectionRequestEvent*)e; if(0) fprint(2, "xselect target=%d requestor=%d property=%d selection=%d\n", @@ -198,7 +198,7 @@ xgetsnarf(void) int fmt, i; XWindow w; XDisplay *xd; - + xd = xdisplay; w = None; @@ -229,7 +229,7 @@ xgetsnarf(void) */ if(w == None) return nil; - + /* * We should be waiting for SelectionNotify here, but it might never * come, and we have no way to time out. Instead, we will clear @@ -256,7 +256,7 @@ xgetsnarf(void) return nil; /* get the property */ data = nil; - XGetWindowProperty(xd, drawable, prop, 0, SnarfSize/sizeof(ulong), 0, + XGetWindowProperty(xd, drawable, prop, 0, SnarfSize/sizeof(ulong), 0, AnyPropertyType, &type, &fmt, &len, &dummy, &xdata); if(xdata == nil || (type != XA_STRING && type != xutf8string) || len == 0){ if(xdata) @@ -297,7 +297,7 @@ appleputsnarf(void) fprint(2, "apple pasteboard cannot assert ownership\n"); return; } - cfdata = CFDataCreate(kCFAllocatorDefault, + cfdata = CFDataCreate(kCFAllocatorDefault, (uchar*)rsnarf, runestrlen(rsnarf)*2); if(cfdata == nil){ fprint(2, "apple pasteboard cfdatacreate failed\n"); @@ -312,5 +312,3 @@ appleputsnarf(void) CFRelease(cfdata); #endif } - - |