Re: Drawing from secondary thread erases resize corner in window?

2008-02-29 Thread Hank Heijink (Mailinglists)
Sent a message to the list from the wrong account, so it bounced. Here it is: On Feb 28, 2008, at 5:01 PM, Hamish Allan wrote: You could try kCFRunLoopCommonModes (pre-Leopard) / NSRunLoopCommonModes (post-Leopard). I believe that NSDefaultRunLoopMode and NSEventTrackingRunLoopMode are in the

Re: Drawing from secondary thread erases resize corner in window?

2008-02-28 Thread Ron Fleckner
On 29/02/2008, at 8:31 AM, Nate Weaver wrote: On Feb 28, 2008, at 3:18 PM, Hank Heijink wrote: On Feb 28, 2008, at 2:56 PM, Nate Weaver wrote: Interesting... I hadn't thought of that. Don't I have to add another timer to the NSDefaultRunLoopMode though? If I have to chose between having

Re: Drawing from secondary thread erases resize corner in window?

2008-02-28 Thread Hamish Allan
On Thu, Feb 28, 2008 at 9:18 PM, Hank Heijink <[EMAIL PROTECTED]> wrote: > That's not my experience. If I just add a timer for the > NSEventTrackingRunLoopMode, the only time that timer fires is when the > run loop is in event tracking mode, which is what I would expect. In > the NSDefaultRunL

Re: Drawing from secondary thread erases resize corner in window?

2008-02-28 Thread Nate Weaver
On Feb 28, 2008, at 3:18 PM, Hank Heijink wrote: On Feb 28, 2008, at 2:56 PM, Nate Weaver wrote: Interesting... I hadn't thought of that. Don't I have to add another timer to the NSDefaultRunLoopMode though? If I have to chose between having two timers on the main thread that alternate,

Re: Drawing from secondary thread erases resize corner in window?

2008-02-28 Thread Hank Heijink
On Feb 28, 2008, at 2:56 PM, Nate Weaver wrote: Interesting... I hadn't thought of that. Don't I have to add another timer to the NSDefaultRunLoopMode though? If I have to chose between having two timers on the main thread that alternate, or one on a secondary thread, I think I'll go with

Re: Drawing from secondary thread erases resize corner in window? [solved, for now]

2008-02-28 Thread Nate Weaver
On Feb 28, 2008, at 1:49 PM, Hank Heijink wrote: On Feb 28, 2008, at 1:46 PM, Nate Weaver wrote: You could also use [[NSRunLoop mainRunLoop] addTimer:yourTimer forMode:NSEventTrackingRunLoopMode] and avoid another thread altogether. Interesting... I hadn't thought of that. Don't I have

Re: Drawing from secondary thread erases resize corner in window? [solved, for now]

2008-02-28 Thread Hank Heijink
On Feb 28, 2008, at 1:46 PM, Nate Weaver wrote: You could also use [[NSRunLoop mainRunLoop] addTimer:yourTimer forMode:NSEventTrackingRunLoopMode] and avoid another thread altogether. Interesting... I hadn't thought of that. Don't I have to add another timer to the NSDefaultRunLoopMode

Re: Drawing from secondary thread erases resize corner in window? [solved, for now]

2008-02-28 Thread Nate Weaver
the only reason I'm trying to draw on another thread is that my drawing is timer-driven, and the timer gets suspended if it's on the main thread and the user clicks on a menu or a scrollbar or some such thing. You could also use [[NSRunLoop mainRunLoop] addTimer:yourTimer forMode:NSEventTracki

Re: Drawing from secondary thread erases resize corner in window? [solved, for now]

2008-02-28 Thread Hank Heijink
I haven't found out what I need to do to avoid drawing over the resize corner on a secondary thread. There's something that the system does when it calls drawRect: as a result of a call to setNeedsDisplayInRect: that I can't reproduce. I'm pretty sure it's not a multithreading issue, but si

Re: Drawing from secondary thread erases resize corner in window?

2008-02-28 Thread Hamish Allan
On Thu, Feb 28, 2008 at 1:30 AM, Chris Suter <[EMAIL PROTECTED]> wrote: > I suspect the problem with the resize corner is because it's drawn by > the framework and the code that draws in the background is overwriting > it. I'm not sure how you solve that. Assuming you're drawing on a secondary

Re: Drawing from secondary thread erases resize corner in window?

2008-02-27 Thread Chris Suter
On 28/02/2008, at 10:54 AM, Kyle Sluder wrote: On Wed, Feb 27, 2008 at 2:40 PM, Hank Heijink <[EMAIL PROTECTED]> wrote: I have a window with a custom view that occupies the entire window, so the little resize corner in the lower right is within the bounds of the view. I noticed that when I

Re: Drawing from secondary thread erases resize corner in window?

2008-02-27 Thread j o a r
On Feb 28, 2008, at 12:54 AM, Kyle Sluder wrote: Do not use AppKit from any thread other than your main thread. It is not thread-safe. ...besides the things that are explicitly documented to be thread safe:

Re: Drawing from secondary thread erases resize corner in window?

2008-02-27 Thread Kyle Sluder
On Wed, Feb 27, 2008 at 2:40 PM, Hank Heijink <[EMAIL PROTECTED]> wrote: > I have a window with a custom view that occupies the entire window, so > the little resize corner in the lower right is within the bounds of > the view. I noticed that when I draw into the window from the main > thread (

Re: Drawing from secondary thread erases resize corner in window?

2008-02-27 Thread Hank Heijink
On Feb 27, 2008, at 2:40 PM, Hank Heijink wrote: - (void)updateView { if (useSecondaryThread) { if ([view lockFocusIfCanDraw]) { [view drawFromSecondaryThread:view.bounds]; [[view window] flushWindow];

Drawing from secondary thread erases resize corner in window?

2008-02-27 Thread Hank Heijink
Hi list, I have a window with a custom view that occupies the entire window, so the little resize corner in the lower right is within the bounds of the view. I noticed that when I draw into the window from the main thread (i.e. the usual way) that resize corner is redrawn when the view is