[Xquartz-dev] [XQuartz] #241: xquarz uses 100% of CPU when not focused
Jeremy Huddleston
jeremyhu at apple.com
Sun Apr 12 19:05:54 PDT 2009
On Apr 12, 2009, at 17:56, Christof Wolf wrote:
> On Sunday 12 April 2009, Jeremy Huddleston wrote:
>> Ok, I was able to reproduce it and fix it! YAY! So would you mind
>> trying 1.4.2-apple42 via MacPorts or download the X11.bin replacement
>> from http://xquartz.macosforge.org/downloads and verify that it's
>> fixed for you as well.
> Jeremy,
>
> I could not compile apple42 via MacPorts - but I downloaded it - and
> it works
> fine!! no CPU issue - what caused it anyway? - if that is not too
> complicated :-)
Thanks for testing.
Could you tell me what error you're encountering with Macports
building it?
It was a combination of two errors:
We were using the wrong values for ProximityIn and ProximityOut when
generating the proximity events (pen going in or leaving the tablet
area). This resulted in num_events being 0 and we didn't queue up
those events. After enqueuing the events, we put a byte in a pipe
that the server thread is select()ing on to wake it up (yes, hacky.).
The server thread reads this byte out of that pipe after it dequeues
the event. Unfortunately, since there actually wasn't an event in the
queue, it didn't get around to clearing the pipe and the select()
turned into effectively a no-op in the while loop.
You didn't see this bad behavior when X11 was in the foreground
because we were sending MotionNotify events as well (thus there was a
"real" event in the queue).
So I fixed these two errors by checking num_events before the poke and
making sure that we properly generate the proximity events.
More information about the Xquartz-dev
mailing list