• 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: Creating a runloop to handle specific mouse events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a runloop to handle specific mouse events


  • Subject: Re: Creating a runloop to handle specific mouse events
  • From: Benjamin Stiglitz <email@hidden>
  • Date: Thu, 04 Sep 2008 11:04:45 -0400

At one point, my application blocks the runloop and I have to poll for mouse events by calling [NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]. I'm not happy with the polling. It seems to me that creating a separate thread and configuring its runloop to process the events I'm interested in (specific mouse events for a specific window) is a more elegant solution. I couldn't find any example code doing that. I suspect that it's not possible for third-party developers to tap into the event stream coming from the window server, to create a CFRunloopSource similar to the one that feeds the main runloop.

This isn’t really polling as much as taking over the runloop and filtering out some events. There’s nothing really inelegant about this— it’s the call that powers the tracking loop in most of the controls in AppKit. If you really wanted, you could shuffle off the events to another thread for processing later.


-Ben_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Creating a runloop to handle specific mouse events
      • From: Uli Kusterer <email@hidden>
References: 
 >nibless applications (From: David Alter <email@hidden>)
 >Re: nibless applications (From: Filip van der Meeren <email@hidden>)
 >Re: nibless applications (From: Jeff Johnson <email@hidden>)
 >Creating a runloop to handle specific mouse events (From: Berk Özer <email@hidden>)

  • Prev by Date: Re: Why do all these methods of measuring string metrics with font attribute fail?
  • Next by Date: Re: What Size My Window?
  • Previous by thread: Re: Creating a runloop to handle specific mouse events
  • Next by thread: Re: Creating a runloop to handle specific mouse events
  • Index(es):
    • Date
    • Thread