Runloops and Window Dragging
Runloops and Window Dragging
- Subject: Runloops and Window Dragging
- From: Caylan Larson <email@hidden>
- Date: Wed, 02 Oct 2013 13:36:28 -0500
I am using CGWindowListCreateImage to fetch an image of the windows behind my app. This works beautifully and is OK for my needs. Except...
I have problems when I drag the window. The goal is near real-time image updates during the drag event.
The runloop never seems to fully display the results of my drawRect (I can log in drawRect, but the results are not displayed). I've tried operation queues, using mouseDragged, spinning off a thread on a window move notification using detachNewThreadSelector and looking for mouse up using nextEventMatchingMask --- all the while sending setNeedsDisplay:YES to the view or, heaven forbid, sending drawRect straight away (doesn't make a difference). I've made sure "Can Draw Concurrently" is checked at every level as well as the window setting for allowsConcurrentViewDrawing.
My next step was to ditch drawRect and instead use an embedded imageView in a scrollView. In windowWillMove I stuff the whole screen's image in the imageView and then scrollPoint to the window's frame origin. This still doesn't get me real-time scrolling of the scrollView when the window is dragged.
My hunch is that the window drag event makes the runloop run in NSEventTrackingRunLoopMode, which limits drawRect's efficacy. Any way around this condition?
Caylan
_______________________________________________
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