• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSPasteboard notifications?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPasteboard notifications?


  • Subject: Re: NSPasteboard notifications?
  • From: petite_abeille <email@hidden>
  • Date: Sun, 22 Feb 2004 12:57:34 +0100

Hi Allan,

On Feb 22, 2004, at 05:19, Allan Odgaard wrote:

Is there a "clean" way to get notified about the NSPasteboard activities?

No -- but I think it's safe to assume that others will only modify the pasteboard when your application is inactive -- so you can check the changeCount each time your app gets inactive/active and then send a notification (if it is changed).

Hmmm... not quite sure if I understand what would be the modus operandi for checking changeCount in this context...

Some background info:

Out of desperation [1], I quickly hacked together a little something akin to a NSPasteboard buffer where I automatically keep track of the last couple of pasted values:

(1) Each time the general pasteboard is triggered, it records its value and add it to an handy little list of recently pasted values.
(2) This change also gets broadcasted to all other running applications to update their list of externally modified pasteboard values.
(3) The pasteboard buffer is persistent.

(1) is achieved by, er, patching some relevant NSPasteboard methods.
(2) is currently handled by, gasp, NSDistributedNotificationCenter.
(3) is done by unceremoniously dumping the buffer values in the NSUserDefaults of each apps.

The end results of this nonsense is that I have a little extra sub menu bellow 'Edit' -> 'Paste' in every Cocoa apps which lists the latest pasteboard operations, both local and external.

So the pasteboard buffer operates at two levels: the information is first captured and recorded locally and then forwarded to other running applications.

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?

Cheers,

PA.

[1] On the other hand, I'm sure that somebody, somewhere, somehow *must* already have implemented a decent pasteboard buffer of some sort. But I haven't tracked it down yet :/ Pointers welcome :)
_______________________________________________
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.
  • Follow-Ups:
    • Re: NSPasteboard notifications?
      • From: Allan Odgaard <email@hidden>
References: 
 >NSPasteboard notifications? (From: petite_abeille <email@hidden>)
 >Re: NSPasteboard notifications? (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Re: Function overloading for ObjC classes
  • Next by Date: Webview Focus
  • Previous by thread: Re: NSPasteboard notifications?
  • Next by thread: Re: NSPasteboard notifications?
  • Index(es):
    • Date
    • Thread