On Sat, Aug 11, 2012 at 1:29 AM, Benjamin Smedberg <benja...@smedbergs.us>wrote:

> On 8/9/2012 7:27 PM, Matt Woodrow wrote:
>
>> When OMTC arrives, which thread will be running the widget event loop
>>> and receiving WM_PAINT messages?
>>>
>> Still the main gecko thread, we just don't paint synchronously in
>> response to this event. Apparently this is fine.
>>
> Do you have documentation on this? Here are the details which cause me to
> think that this is incorrect:
>
> * BeginPaint to obtain the HDC must be called synchronously from within
> the WM_PAINT message handler
> * Most of GDI is thread-affine and you need to call the painting functions
> on the same thread as the HDC was created on
>

It needs to be tested, but you can call GetDC(HWND) from another thread and
then you should be able to draw into the DC on that thread. In this model
we would not actually Invalidate() the window ourselves, so would not
usually receive WM_PAINT events.

As a partial aside, I think it might be *better* if the OMTC thread was the
> thread which actually processed windows events, especially if we didn't
> ever need to block the OMTC thread on the main gecko thread and merely
> dispatch them asynchronously: this could significantly improve our
> situation with plugin hangs (but it would probably cause problems with
> accessibility and perhaps a few other situations).
>

I think making the HWND message loop thread not be the main thread would be
very hard. Drag and drop and IME for example require synchronous processing.

Rob
-- 
“You have heard that it was said, ‘Love your neighbor and hate your enemy.’
But I tell you, love your enemies and pray for those who persecute you,
that you may be children of your Father in heaven. ... If you love those
who love you, what reward will you get? Are not even the tax collectors
doing that? And if you greet only your own people, what are you doing more
than others?" [Matthew 5:43-47]
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to