1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Linux: Fix for high CPU load

This commit is contained in:
ed 2019-08-07 12:44:42 +01:00
parent cdd9206b13
commit 012c7d00d2
2 changed files with 20 additions and 2 deletions

View file

@ -124,7 +124,7 @@ public:
const ScopedLock sl (lock);
fdReadCallbacks.push_back ({ fd, std::move (cb) });
pfds.push_back ({ fd, POLLIN | POLLOUT, 0 });
pfds.push_back ({ fd, POLLIN, 0 });
}
void unregisterFdCallback (int fd)

View file

@ -1661,7 +1661,7 @@ public:
if (XSHMHelpers::isShmAvailable (display))
{
ScopedXLock xlock (display);
if (event.xany.type == XShmGetEventBase (display))
if (event.xany.type == shmCompletionEvent)
repainter->notifyPaintCompleted();
}
#endif
@ -2269,6 +2269,15 @@ private:
void timerCallback() override
{
#if JUCE_USE_XSHM
if (shmPaintsPending != 0)
{
ScopedXLock xlock (display);
XEvent evt;
while (XCheckTypedWindowEvent (display, peer.windowH, peer.shmCompletionEvent, &evt))
--shmPaintsPending;
}
if (shmPaintsPending != 0)
return;
#endif
@ -2399,6 +2408,10 @@ private:
enum { KeyPressEventType = 2 };
static ::Display* display;
#if JUCE_USE_XSHM
int shmCompletionEvent = 0;
#endif
struct MotifWmHints
{
unsigned long flags;
@ -2728,6 +2741,11 @@ private:
initialisePointerMap();
updateModifierMappings();
#if JUCE_USE_XSHM
if (XSHMHelpers::isShmAvailable (display))
shmCompletionEvent = XShmGetEventBase (display) + ShmCompletion;
#endif
}
void destroyWindow()