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:
parent
cdd9206b13
commit
012c7d00d2
2 changed files with 20 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue