x-selection.m:1502:1: warning: method has no return type specified; defaults to 'id'
[-Wmissing-method-return-type,Semantic Issue]
- init
^
(id)
1 warning generated.
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:
-bap
-psl
-T PrivatePtr
-T pmWait
-T _XFUNCPROTOBEGIN
-T _XFUNCPROTOEND
-T _X_EXPORT
The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.
The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.
The comparison was done with this script:
dir1=$1
dir2=$2
for dir in $dir1 $dir2; do
(cd $dir && find . -name '*.o' | while read file; do
dir=`dirname $file`
base=`basename $file .o`
dump=$dir/$base.dump
objdump -d $file > $dump
done)
done
find $dir1 -name '*.dump' | while read dump; do
otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
diff -u $dump $otherdump
done
Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Added a configure option called --enable-standalone-xpbproxy which is useful for deveoping xpbproxy.
The 'active' switch in preferences just disables the in-server xpbproxy (not this standalone).
(cherry picked from commit 4294493632)
It seems that we were calling copy_completed: too soon. Now we return instead
of falling through to the free_propdata, and copy_completed:.
(cherry picked from commit 5797d5b662)
This may work, unfortunately I don't have test apps that fail.
The way it works is by using an NSImage class initWithPasteboard:
method, which we then get the TIFFRepresentation of, and convert
to PNG or JPEG.
The TIFFRepresentation uses NSTIFFCompressionNone; which should be
lossless.
(cherry picked from commit 8d048cfa95)
Add dump_prefs() for instrospection.
Make prefs_get_bool a little more clear.
In get_property don't assume that the Mac realloc(NULL, 0); returns
non-NULL. We shouldn't depend on implementation-defined behavior too
much.
Add more commentary in various spots.
Add TARGETS in the TARGETS response. I don't know why some X11 apps
do this, but it could be something that some weird toolkit/app tests
for.
In reload_preferences add preferences synchronization, so that xpbproxy
reloads the preferences, and picks up any changes.
Fix a typo/misspelling of the sync_clipboard_to_pasteboard preference.
(cherry picked from commit 165cbbb90c)
instead of calling CFRunLoopRun() directly. The leak wasn't reproducible on
this machine, but someone was able to produce a leak trace with Instruments
that indicates it was leaking in the CFRunLoopRun() path.
x-input.m: dequeue and ignore events when pbproxy_active is false.
x-selection.h: add an is_active method that is used by x-input.m to ignore
events.
x-selection.m: Handle nearly every preference, except for primary_on_grab,
which I don't really understand yet.
(cherry picked from commit 4d51ad851e)
Remove some unnecesssary headers.
Remove some dead code that was never called or used in pbproxy.
Make use of an NSAutoreleasePool in x_init. It could potentially cause a leak
on a startup without this.
Start adding reload_preferences to the x_selection class, as well as event
handling for that.
(cherry picked from commit 602e8ba8f7)
Fix the usage of the NSString cStringUsingEncoding: - it doesn't NUL
terminate the string, which lead to a bus error. So, we use
lengthOfBytesUsingEncoding: to get the length in bytes instead of
strlen().
(cherry picked from commit 6333d619e7)
2 of the paths leaked, when INCR transfers were done. Now we
are leak free according to the leaks program for all transfers
I have tried so far.
(cherry picked from commit aa98db576b)
NSAutoreleasePool. Now the usage is consistent. In x_input_run()
we create a pool, and release it after processing the XEvents.
Add some getpid() output to main for debugging. It needs a bit more
testing before the next release.
Don't retain the NSPasteboard as the old code did. That may have
contributed to the leak, and it made it so that we needed the
NSAutoreleasePool created in main().
Remove the _known_types, and _pasteboard instance variables from
the x_selection class. They aren't needed anymore.
The leaks program now indicates 0 leaks after some usage. I want
to test further, but this seems much better, and my memory usage
graph indicates it's not growing.
(cherry picked from commit b245d84a72)
macro causes a leak (according to the leaks program).
Attempt to fix several other leaks with release method calls.
For some reason the process still grows more than it should...
I will need to use some better methods than leaks, and malloc_history
I suspect. Whatever is leaking, it's hard to find. I need to isolate
the cases more.
Add a missing image/jpeg branch.
Remove read_prop_32 - it's not used.
(cherry picked from commit 63a680354d)
Move the struct atom_list into the x-selection class, so that it's
no longer a global variable named atoms. This may ease pthread
integration and reduce the chances of symbols conflicting.
(cherry picked from commit c1403c713c)
We may need another branch to convert a PICT to a PNG or JPEG. For now
TIFF works well in all of the test image copying apps when converted to
PNG or JPEG with an NSBitmapImageRep class.
(cherry picked from commit adf339d8f9)
INCR transfers mixed with a CLIPBOARD change.
Fix a bug with some UTF-8 transfers. I can only guess that my UTF-8
tests before were inadequate. I can now copy/paste any characters between
uxterm and Textedit.app.
(cherry picked from commit 7ca1532e8e)
to verify that the behavior didn't change.
main.m: XInternAtom compound_text, and atom_pair.
pbproxy.h: Add compound_text and atom_pair to the struct atom_list.
x-selection.m: Add an #include of Xutil.h. Refactor the reply struct
initialization to be done in a common place. Add send_reply: to simplify
the code a bit more. Add send_compound_text: which handles the
COMPOUND_TEXT type. Add the beginnings of a send_multiple:. Change
handle_image:extension: to handle_image:. The extension: message isn't
needed anymore.
(cherry picked from commit 1e9460abdf)
We can now copy and paste images to and from X11. Text copying and
pasting works as well.
The NSPasteboard can contain TIFF or PICT images, and pbproxy will
translate to an image/png or image/jpeg request, and list those in the
TARGETS.
I added a description of the basic design at the top of x-selection.m.
I removed the request_data x_selection class struct. It's not needed.
(cherry picked from commit 4a8daf8846)
to a TIFFRepresentation for use with NSPasteboard.
This has been tested with the Gimp and works with some minor quartz-wm changes.
The Finder clipboard shows the image updates after an Edit -> Copy.
(cherry picked from commit 12912adaee)
This change adds some [self own_clipboard] calls in the necessary places to get the proper greedy behavior.
UTF8_STRING and STRING properties seem to work well now with the test cases (PRIMARY, and CLIPBOARD). I can copy from several different X apps, and have the behavior be correct when pasting. I also verified that quartz-wm isn't doing the copying, by disabling the quartz-wm paths.
(cherry picked from commit 934669f732)
Add TRACE() calls where appropriate to try to figure out why we are losing CLIPBOARD at times, after transferring PRIMARY to the NSPasteboard.
Use the new pbproxy_clipboard_to_pasteboard where appropriate.
(cherry picked from commit 40190675a6)
Convert the puts usage to use DB().
Add the initial handle_image method.
Check for nil in the NSString instantiation in various places.
Add some commentary to enhance the clarity of why I did some things.
(cherry picked from commit 37361567b6)