Browse Source

Update to latest juce

tags/2018-04-16
falkTX 10 years ago
parent
commit
f53e138daf
7 changed files with 78 additions and 75 deletions
  1. +7
    -4
      libs/juce/source/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  2. +41
    -41
      libs/juce/source/modules/juce_events/timers/juce_Timer.cpp
  3. +8
    -10
      libs/juce/source/modules/juce_events/timers/juce_Timer.h
  4. +1
    -1
      libs/juce/source/modules/juce_gui_basics/components/juce_Component.cpp
  5. +2
    -2
      libs/juce/source/modules/juce_gui_basics/native/juce_linux_Clipboard.cpp
  6. +18
    -16
      libs/juce/source/modules/juce_gui_basics/native/juce_linux_Windowing.cpp
  7. +1
    -1
      libs/juce/source/modules/juce_gui_extra/native/juce_linux_SystemTrayIcon.cpp

+ 7
- 4
libs/juce/source/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp View File

@@ -1285,10 +1285,10 @@ public:
case audioMasterSizeWindow: case audioMasterSizeWindow:
if (AudioProcessorEditor* ed = getActiveEditor()) if (AudioProcessorEditor* ed = getActiveEditor())
{ {
#if JUCE_LINUX
#if JUCE_LINUX
const MessageManagerLock mmLock; const MessageManagerLock mmLock;
#endif
ed->setSize (index, (int) value);
#endif
ed->setSize (index, (int) value);
} }
return 1; return 1;
@@ -1978,7 +1978,10 @@ public:
#elif JUCE_LINUX #elif JUCE_LINUX
if (pluginWindow != 0) if (pluginWindow != 0)
{ {
XMoveResizeWindow (display, pluginWindow, pos.getX(), pos.getY(), getWidth(), getHeight());
XMoveResizeWindow (display, pluginWindow,
pos.getX(), pos.getY(),
(unsigned int) getWidth(),
(unsigned int) getHeight());
XMapRaised (display, pluginWindow); XMapRaised (display, pluginWindow);
XFlush (display); XFlush (display);
} }


+ 41
- 41
libs/juce/source/modules/juce_events/timers/juce_Timer.cpp View File

@@ -112,10 +112,10 @@ public:
{ {
const LockType::ScopedLockType sl (lock); const LockType::ScopedLockType sl (lock);
while (firstTimer != nullptr && firstTimer->countdownMs <= 0)
while (firstTimer != nullptr && firstTimer->timerCountdownMs <= 0)
{ {
Timer* const t = firstTimer; Timer* const t = firstTimer;
t->countdownMs = t->periodMs;
t->timerCountdownMs = t->timerPeriodMs;
removeTimer (t); removeTimer (t);
addTimer (t); addTimer (t);
@@ -169,11 +169,11 @@ public:
{ {
if (instance != nullptr) if (instance != nullptr)
{ {
tim->countdownMs = newCounter;
tim->periodMs = newCounter;
tim->timerCountdownMs = newCounter;
tim->timerPeriodMs = newCounter;
if ((tim->next != nullptr && tim->next->countdownMs < tim->countdownMs)
|| (tim->previous != nullptr && tim->previous->countdownMs > tim->countdownMs))
if ((tim->nextTimer != nullptr && tim->nextTimer->timerCountdownMs < tim->timerCountdownMs)
|| (tim->previousTimer != nullptr && tim->previousTimer->timerCountdownMs > tim->timerCountdownMs))
{ {
instance->removeTimer (tim); instance->removeTimer (tim);
instance->addTimer (tim); instance->addTimer (tim);
@@ -210,28 +210,28 @@ private:
Timer* i = firstTimer; Timer* i = firstTimer;
if (i == nullptr || i->countdownMs > t->countdownMs)
if (i == nullptr || i->timerCountdownMs > t->timerCountdownMs)
{ {
t->next = firstTimer;
t->nextTimer = firstTimer;
firstTimer = t; firstTimer = t;
} }
else else
{ {
while (i->next != nullptr && i->next->countdownMs <= t->countdownMs)
i = i->next;
while (i->nextTimer != nullptr && i->nextTimer->timerCountdownMs <= t->timerCountdownMs)
i = i->nextTimer;
jassert (i != nullptr); jassert (i != nullptr);
t->next = i->next;
t->previous = i;
i->next = t;
t->nextTimer = i->nextTimer;
t->previousTimer = i;
i->nextTimer = t;
} }
if (t->next != nullptr)
t->next->previous = t;
if (t->nextTimer != nullptr)
t->nextTimer->previousTimer = t;
jassert ((t->next == nullptr || t->next->countdownMs >= t->countdownMs)
&& (t->previous == nullptr || t->previous->countdownMs <= t->countdownMs));
jassert ((t->nextTimer == nullptr || t->nextTimer->timerCountdownMs >= t->timerCountdownMs)
&& (t->previousTimer == nullptr || t->previousTimer->timerCountdownMs <= t->timerCountdownMs));
notify(); notify();
} }
@@ -244,32 +244,32 @@ private:
jassert (timerExists (t)); jassert (timerExists (t));
#endif #endif
if (t->previous != nullptr)
if (t->previousTimer != nullptr)
{ {
jassert (firstTimer != t); jassert (firstTimer != t);
t->previous->next = t->next;
t->previousTimer->nextTimer = t->nextTimer;
} }
else else
{ {
jassert (firstTimer == t); jassert (firstTimer == t);
firstTimer = t->next;
firstTimer = t->nextTimer;
} }
if (t->next != nullptr)
t->next->previous = t->previous;
if (t->nextTimer != nullptr)
t->nextTimer->previousTimer = t->previousTimer;
t->next = nullptr;
t->previous = nullptr;
t->nextTimer = nullptr;
t->previousTimer = nullptr;
} }
int getTimeUntilFirstTimer (const int numMillisecsElapsed) const int getTimeUntilFirstTimer (const int numMillisecsElapsed) const
{ {
const LockType::ScopedLockType sl (lock); const LockType::ScopedLockType sl (lock);
for (Timer* t = firstTimer; t != nullptr; t = t->next)
t->countdownMs -= numMillisecsElapsed;
for (Timer* t = firstTimer; t != nullptr; t = t->nextTimer)
t->timerCountdownMs -= numMillisecsElapsed;
return firstTimer != nullptr ? firstTimer->countdownMs : 1000;
return firstTimer != nullptr ? firstTimer->timerCountdownMs : 1000;
} }
void handleAsyncUpdate() override void handleAsyncUpdate() override
@@ -280,7 +280,7 @@ private:
#if JUCE_DEBUG #if JUCE_DEBUG
bool timerExists (Timer* const t) const noexcept bool timerExists (Timer* const t) const noexcept
{ {
for (Timer* tt = firstTimer; tt != nullptr; tt = tt->next)
for (Timer* tt = firstTimer; tt != nullptr; tt = tt->nextTimer)
if (tt == t) if (tt == t)
return true; return true;
@@ -296,18 +296,18 @@ Timer::TimerThread::LockType Timer::TimerThread::lock;
//============================================================================== //==============================================================================
Timer::Timer() noexcept Timer::Timer() noexcept
: countdownMs (0),
periodMs (0),
previous (nullptr),
next (nullptr)
: timerCountdownMs (0),
timerPeriodMs (0),
previousTimer (nullptr),
nextTimer (nullptr)
{ {
} }
Timer::Timer (const Timer&) noexcept Timer::Timer (const Timer&) noexcept
: countdownMs (0),
periodMs (0),
previous (nullptr),
next (nullptr)
: timerCountdownMs (0),
timerPeriodMs (0),
previousTimer (nullptr),
nextTimer (nullptr)
{ {
} }
@@ -320,10 +320,10 @@ void Timer::startTimer (const int interval) noexcept
{ {
const TimerThread::LockType::ScopedLockType sl (TimerThread::lock); const TimerThread::LockType::ScopedLockType sl (TimerThread::lock);
if (periodMs == 0)
if (timerPeriodMs == 0)
{ {
countdownMs = interval;
periodMs = jmax (1, interval);
timerCountdownMs = interval;
timerPeriodMs = jmax (1, interval);
TimerThread::add (this); TimerThread::add (this);
} }
else else
@@ -344,10 +344,10 @@ void Timer::stopTimer() noexcept
{ {
const TimerThread::LockType::ScopedLockType sl (TimerThread::lock); const TimerThread::LockType::ScopedLockType sl (TimerThread::lock);
if (periodMs > 0)
if (timerPeriodMs > 0)
{ {
TimerThread::remove (this); TimerThread::remove (this);
periodMs = 0;
timerPeriodMs = 0;
} }
} }


+ 8
- 10
libs/juce/source/modules/juce_events/timers/juce_Timer.h View File

@@ -54,7 +54,6 @@ class JUCE_API Timer
protected: protected:
//============================================================================== //==============================================================================
/** Creates a Timer. /** Creates a Timer.
When created, the timer is stopped, so use startTimer() to get it going. When created, the timer is stopped, so use startTimer() to get it going.
*/ */
Timer() noexcept; Timer() noexcept;
@@ -64,7 +63,7 @@ protected:
Note that this timer won't be started, even if the one you're copying Note that this timer won't be started, even if the one you're copying
is running. is running.
*/ */
Timer (const Timer& other) noexcept;
Timer (const Timer&) noexcept;
public: public:
//============================================================================== //==============================================================================
@@ -86,8 +85,8 @@ public:
time between calling this method and the next timer callback time between calling this method and the next timer callback
will not be less than the interval length passed in. will not be less than the interval length passed in.
@param intervalInMilliseconds the interval to use (any values less than 1 will be
rounded up to 1)
@param intervalInMilliseconds the interval to use (any value less
than 1 will be rounded up to 1)
*/ */
void startTimer (int intervalInMilliseconds) noexcept; void startTimer (int intervalInMilliseconds) noexcept;
@@ -108,12 +107,12 @@ public:
//============================================================================== //==============================================================================
/** Returns true if the timer is currently running. */ /** Returns true if the timer is currently running. */
bool isTimerRunning() const noexcept { return periodMs > 0; }
bool isTimerRunning() const noexcept { return timerPeriodMs > 0; }
/** Returns the timer's interval. /** Returns the timer's interval.
@returns the timer's interval in milliseconds if it's running, or 0 if it's not. @returns the timer's interval in milliseconds if it's running, or 0 if it's not.
*/ */
int getTimerInterval() const noexcept { return periodMs; }
int getTimerInterval() const noexcept { return timerPeriodMs; }
//============================================================================== //==============================================================================
@@ -125,11 +124,10 @@ public:
private: private:
class TimerThread; class TimerThread;
friend class TimerThread; friend class TimerThread;
int countdownMs, periodMs;
Timer* previous;
Timer* next;
int timerCountdownMs, timerPeriodMs; // NB: these member variable names are a little verbose
Timer* previousTimer, *nextTimer; // to reduce risk of name-clashes with user subclasses
Timer& operator= (const Timer&);
Timer& operator= (const Timer&) JUCE_DELETED_FUNCTION;
}; };
#endif // JUCE_TIMER_H_INCLUDED #endif // JUCE_TIMER_H_INCLUDED

+ 1
- 1
libs/juce/source/modules/juce_gui_basics/components/juce_Component.cpp View File

@@ -154,7 +154,7 @@ private:
bool shouldBailOut() const noexcept bool shouldBailOut() const noexcept
{ {
return checker.shouldBailOut() || safePointer == 0;
return checker.shouldBailOut() || safePointer == nullptr;
} }
private: private:


+ 2
- 2
libs/juce/source/modules/juce_gui_basics/native/juce_linux_Clipboard.cpp View File

@@ -22,8 +22,8 @@
============================================================================== ==============================================================================
*/ */
extern Display* display;
extern Window juce_messageWindowHandle;
extern ::Display* display;
extern ::Window juce_messageWindowHandle;
namespace ClipboardHelpers namespace ClipboardHelpers
{ {


+ 18
- 16
libs/juce/source/modules/juce_gui_basics/native/juce_linux_Windowing.cpp View File

@@ -22,7 +22,7 @@
============================================================================== ==============================================================================
*/ */
extern Display* display;
extern ::Display* display;
extern XContext windowHandleXContext; extern XContext windowHandleXContext;
typedef void (*WindowMessageReceiveCallback) (XEvent&); typedef void (*WindowMessageReceiveCallback) (XEvent&);
extern WindowMessageReceiveCallback dispatchWindowMessage; extern WindowMessageReceiveCallback dispatchWindowMessage;
@@ -775,7 +775,7 @@ class DisplayGeometry
{ {
private: private:
//============================================================================== //==============================================================================
DisplayGeometry (::Display *dpy, double masterScale)
DisplayGeometry (::Display* dpy, double masterScale)
{ {
jassert (instance == nullptr); jassert (instance == nullptr);
instance = this; instance = this;
@@ -912,19 +912,20 @@ public:
} }
//============================================================================== //==============================================================================
static DisplayGeometry& getInstance ()
static DisplayGeometry& getInstance()
{ {
jassert (instance != nullptr); jassert (instance != nullptr);
return *instance; return *instance;
} }
static DisplayGeometry& getOrCreateInstance (::Display *dpy, double masterScale)
static DisplayGeometry& getOrCreateInstance (::Display* dpy, double masterScale)
{ {
if (instance == nullptr) if (instance == nullptr)
new DisplayGeometry (dpy, masterScale); new DisplayGeometry (dpy, masterScale);
return getInstance(); return getInstance();
} }
private: private:
//============================================================================== //==============================================================================
static DisplayGeometry* instance; static DisplayGeometry* instance;
@@ -1027,7 +1028,7 @@ private:
} }
//============================================================================== //==============================================================================
XRRScreenResources* getScreenResources (::Display *dpy, ::Window window)
XRRScreenResources* getScreenResources (::Display* dpy, ::Window window)
{ {
if (getScreenResourcesPtr != nullptr) if (getScreenResourcesPtr != nullptr)
return getScreenResourcesPtr (dpy, window); return getScreenResourcesPtr (dpy, window);
@@ -1035,7 +1036,7 @@ private:
return nullptr; return nullptr;
} }
XRROutputInfo* getOutputInfo (::Display *dpy, XRRScreenResources *resources, RROutput output)
XRROutputInfo* getOutputInfo (::Display* dpy, XRRScreenResources* resources, RROutput output)
{ {
if (getOutputInfoPtr != nullptr) if (getOutputInfoPtr != nullptr)
return getOutputInfoPtr (dpy, resources, output); return getOutputInfoPtr (dpy, resources, output);
@@ -1043,7 +1044,7 @@ private:
return nullptr; return nullptr;
} }
XRRCrtcInfo* getCrtcInfo (::Display *dpy, XRRScreenResources *resources, RRCrtc crtc)
XRRCrtcInfo* getCrtcInfo (::Display* dpy, XRRScreenResources* resources, RRCrtc crtc)
{ {
if (getCrtcInfoPtr != nullptr) if (getCrtcInfoPtr != nullptr)
return getCrtcInfoPtr (dpy, resources, crtc); return getCrtcInfoPtr (dpy, resources, crtc);
@@ -1051,13 +1052,14 @@ private:
return nullptr; return nullptr;
} }
RROutput getOutputPrimary (::Display *dpy, ::Window window)
RROutput getOutputPrimary (::Display* dpy, ::Window window)
{ {
if (getOutputPrimaryPtr != nullptr) if (getOutputPrimaryPtr != nullptr)
return getOutputPrimaryPtr (dpy, window); return getOutputPrimaryPtr (dpy, window);
return 0; return 0;
} }
private: private:
//============================================================================== //==============================================================================
friend class ContainerDeletePolicy<XRRScreenResources>; friend class ContainerDeletePolicy<XRRScreenResources>;
@@ -1084,13 +1086,13 @@ private:
private: private:
static XRandrWrapper* instance; static XRandrWrapper* instance;
typedef XRRScreenResources* (*tXRRGetScreenResources) (::Display *dpy, ::Window window);
typedef void (*tXRRFreeScreenResources) (XRRScreenResources *resources);
typedef XRROutputInfo* (*tXRRGetOutputInfo) (::Display *dpy, XRRScreenResources *resources, RROutput output);
typedef void (*tXRRFreeOutputInfo) (XRROutputInfo *outputInfo);
typedef XRRCrtcInfo* (*tXRRGetCrtcInfo) (::Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
typedef void (*tXRRFreeCrtcInfo) (XRRCrtcInfo *crtcInfo);
typedef RROutput (*tXRRGetOutputPrimary) (::Display *dpy, ::Window window);
typedef XRRScreenResources* (*tXRRGetScreenResources) (::Display*, ::Window);
typedef void (*tXRRFreeScreenResources) (XRRScreenResources*);
typedef XRROutputInfo* (*tXRRGetOutputInfo) (::Display*, XRRScreenResources*, RROutput);
typedef void (*tXRRFreeOutputInfo) (XRROutputInfo*);
typedef XRRCrtcInfo* (*tXRRGetCrtcInfo) (::Display*, XRRScreenResources*, RRCrtc);
typedef void (*tXRRFreeCrtcInfo) (XRRCrtcInfo*);
typedef RROutput (*tXRRGetOutputPrimary) (::Display*, ::Window);
void* libXrandr; void* libXrandr;
tXRRGetScreenResources getScreenResourcesPtr; tXRRGetScreenResources getScreenResourcesPtr;
@@ -1172,7 +1174,7 @@ private:
} }
//============================================================================== //==============================================================================
void queryDisplayInfos (::Display *dpy, double masterScale) noexcept
void queryDisplayInfos (::Display* dpy, double masterScale) noexcept
{ {
ScopedXLock xlock; ScopedXLock xlock;


+ 1
- 1
libs/juce/source/modules/juce_gui_extra/native/juce_linux_SystemTrayIcon.cpp View File

@@ -22,7 +22,7 @@
============================================================================== ==============================================================================
*/ */
extern Display* display;
extern ::Display* display;
//============================================================================== //==============================================================================
class SystemTrayIconComponent::Pimpl class SystemTrayIconComponent::Pimpl


Loading…
Cancel
Save