Re: NSPasteboard notifications?
Re: NSPasteboard notifications?
- Subject: Re: NSPasteboard notifications?
- From: petite_abeille <email@hidden>
- Date: Sun, 22 Feb 2004 15:56:52 +0100
Hi Allan,
On Feb 22, 2004, at 15:28, Allan Odgaard wrote:
Sorry, I thought you was writing an application and wanted to learn
when others placed something on the pasteboard.
Well, yes and no. This is not an application per se. In its current
form, it's a little NSBundle packaged as an NSInputManager, so it gets
loaded in every (Cocoa) apps. But then it does indeed needs to, er,
"intercept" the general pasteboard activities to build the buffer
content. This is actually done through, er, runtime patching, but
perhaps there is a less brutal way to achieve this?
(2) This change also gets broadcasted to all other running
applications to update their list of externally modified pasteboard
values.
You could instead report to a server and have each application poll
the server when that particular application goes active -- that should
solve the problem someone reported about cmd-c being slow (because it
had to activate code from all running applications).
Hmmm... yes, this is a possibility. On the other hand, there is really
no "central server" of any kind (well, except the pbs daemon itself).
This is why I use broadcasting at the moment, which may be slightly
heavy handed I admit.
All this works reasonably well, even though I have the nagging
suspicion that this could be achieved in a much more straightforward
way.
Ideas? Alternatives?
I think you have surpassed all previous attempts of global pasteboard
history!
Gasp ;)
I hope you will place this tool in the public domain :)
Well, if there is no better alternative out there, I can release this
hack to the public at large. On the other hand, somebody must have
dealt with this already, no?
I have two question though, what do you do when someone only makes a
promise of a declared type?
Nothing presently. The buffer is only interested in different flavors
of NSStringPboardType for the time being.
I generally do that because the data might be very large, and will
most likely only be pasted in the same application.
And what about when multiple representations exist? I sometimes keep a
private representation of my data on the pasteboard, but when my
application quits I remove this representation (by overwriting the
pasteboard), since the extra information might be session-dependent.
NSStringPboardType is always preferred, as this is really what I want
to keep track of.
Cheers,
PA.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.