mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-22 01:34:21 +00:00
Couple of minor mouse-pointer fixes.
This commit is contained in:
parent
574694f458
commit
81b2e7818d
15 changed files with 239 additions and 221 deletions
|
|
@ -1095,12 +1095,12 @@ bool Random::nextBool() throw()
|
|||
|
||||
float Random::nextFloat() throw()
|
||||
{
|
||||
return ((uint32) nextInt()) / (float) 0xffffffff;
|
||||
return static_cast <uint32> (nextInt()) / (float) 0xffffffff;
|
||||
}
|
||||
|
||||
double Random::nextDouble() throw()
|
||||
{
|
||||
return ((uint32) nextInt()) / (double) 0xffffffff;
|
||||
return static_cast <uint32> (nextInt()) / (double) 0xffffffff;
|
||||
}
|
||||
|
||||
const BitArray Random::nextLargeNumber (const BitArray& maximumValue) throw()
|
||||
|
|
@ -39808,10 +39808,13 @@ bool Component::isBroughtToFrontOnMouseClick() const throw()
|
|||
|
||||
void Component::setMouseCursor (const MouseCursor& cursor)
|
||||
{
|
||||
cursor_ = cursor;
|
||||
if (cursor_ != cursor)
|
||||
{
|
||||
cursor_ = cursor;
|
||||
|
||||
if (flags.visibleFlag)
|
||||
sendFakeMouseMove();
|
||||
if (flags.visibleFlag)
|
||||
updateMouseCursor();
|
||||
}
|
||||
}
|
||||
|
||||
const MouseCursor Component::getMouseCursor()
|
||||
|
|
@ -236886,56 +236889,60 @@ const String SystemClipboard::getTextFromClipboard() throw()
|
|||
// compiled on its own).
|
||||
#if JUCE_INCLUDED_FILE
|
||||
|
||||
static int64 highResTimerFrequency = 0;
|
||||
static double highResTimerToMillisecRatio = 0;
|
||||
|
||||
#if JUCE_INTEL
|
||||
|
||||
static void juce_getCpuVendor (char* const v) throw()
|
||||
namespace SystemStatsHelpers
|
||||
{
|
||||
int vendor[4];
|
||||
zerostruct (vendor);
|
||||
int dummy = 0;
|
||||
static int64 highResTimerFrequency = 0;
|
||||
static double highResTimerToMillisecRatio = 0;
|
||||
|
||||
asm ("mov %%ebx, %%esi \n\t"
|
||||
"cpuid \n\t"
|
||||
"xchg %%esi, %%ebx"
|
||||
: "=a" (dummy), "=S" (vendor[0]), "=c" (vendor[2]), "=d" (vendor[1]) : "a" (0));
|
||||
#if JUCE_INTEL
|
||||
|
||||
memcpy (v, vendor, 16);
|
||||
static void juce_getCpuVendor (char* const v) throw()
|
||||
{
|
||||
int vendor[4];
|
||||
zerostruct (vendor);
|
||||
int dummy = 0;
|
||||
|
||||
asm ("mov %%ebx, %%esi \n\t"
|
||||
"cpuid \n\t"
|
||||
"xchg %%esi, %%ebx"
|
||||
: "=a" (dummy), "=S" (vendor[0]), "=c" (vendor[2]), "=d" (vendor[1]) : "a" (0));
|
||||
|
||||
memcpy (v, vendor, 16);
|
||||
}
|
||||
|
||||
static unsigned int getCPUIDWord (unsigned int& familyModel, unsigned int& extFeatures)
|
||||
{
|
||||
unsigned int cpu = 0;
|
||||
unsigned int ext = 0;
|
||||
unsigned int family = 0;
|
||||
unsigned int dummy = 0;
|
||||
|
||||
asm ("mov %%ebx, %%esi \n\t"
|
||||
"cpuid \n\t"
|
||||
"xchg %%esi, %%ebx"
|
||||
: "=a" (family), "=S" (ext), "=c" (dummy), "=d" (cpu) : "a" (1));
|
||||
|
||||
familyModel = family;
|
||||
extFeatures = ext;
|
||||
return cpu;
|
||||
}
|
||||
|
||||
struct CPUFlags
|
||||
{
|
||||
bool hasMMX : 1;
|
||||
bool hasSSE : 1;
|
||||
bool hasSSE2 : 1;
|
||||
bool has3DNow : 1;
|
||||
};
|
||||
|
||||
static CPUFlags cpuFlags;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static unsigned int getCPUIDWord (unsigned int& familyModel, unsigned int& extFeatures)
|
||||
{
|
||||
unsigned int cpu = 0;
|
||||
unsigned int ext = 0;
|
||||
unsigned int family = 0;
|
||||
unsigned int dummy = 0;
|
||||
|
||||
asm ("mov %%ebx, %%esi \n\t"
|
||||
"cpuid \n\t"
|
||||
"xchg %%esi, %%ebx"
|
||||
: "=a" (family), "=S" (ext), "=c" (dummy), "=d" (cpu) : "a" (1));
|
||||
|
||||
familyModel = family;
|
||||
extFeatures = ext;
|
||||
return cpu;
|
||||
}
|
||||
|
||||
struct CPUFlags
|
||||
{
|
||||
bool hasMMX : 1;
|
||||
bool hasSSE : 1;
|
||||
bool hasSSE2 : 1;
|
||||
bool has3DNow : 1;
|
||||
};
|
||||
|
||||
static CPUFlags cpuFlags;
|
||||
|
||||
#endif
|
||||
|
||||
void SystemStats::initialiseStats() throw()
|
||||
{
|
||||
using namespace SystemStatsHelpers;
|
||||
static bool initialised = false;
|
||||
|
||||
if (! initialised)
|
||||
|
|
@ -237008,7 +237015,7 @@ int SystemStats::getMemorySizeInMegabytes() throw()
|
|||
bool SystemStats::hasMMX() throw()
|
||||
{
|
||||
#if JUCE_INTEL
|
||||
return cpuFlags.hasMMX;
|
||||
return SystemStatsHelpers::cpuFlags.hasMMX;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
@ -237017,7 +237024,7 @@ bool SystemStats::hasMMX() throw()
|
|||
bool SystemStats::hasSSE() throw()
|
||||
{
|
||||
#if JUCE_INTEL
|
||||
return cpuFlags.hasSSE;
|
||||
return SystemStatsHelpers::cpuFlags.hasSSE;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
@ -237026,7 +237033,7 @@ bool SystemStats::hasSSE() throw()
|
|||
bool SystemStats::hasSSE2() throw()
|
||||
{
|
||||
#if JUCE_INTEL
|
||||
return cpuFlags.hasSSE2;
|
||||
return SystemStatsHelpers::cpuFlags.hasSSE2;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
@ -237035,7 +237042,7 @@ bool SystemStats::hasSSE2() throw()
|
|||
bool SystemStats::has3DNow() throw()
|
||||
{
|
||||
#if JUCE_INTEL
|
||||
return cpuFlags.has3DNow;
|
||||
return SystemStatsHelpers::cpuFlags.has3DNow;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
@ -237045,7 +237052,7 @@ const String SystemStats::getCpuVendor() throw()
|
|||
{
|
||||
#if JUCE_INTEL
|
||||
char v [16];
|
||||
juce_getCpuVendor (v);
|
||||
SystemStatsHelpers::juce_getCpuVendor (v);
|
||||
return String (v, 16);
|
||||
#else
|
||||
return String::empty;
|
||||
|
|
@ -237087,12 +237094,12 @@ const String SystemStats::getFullUserName()
|
|||
|
||||
uint32 juce_millisecondsSinceStartup() throw()
|
||||
{
|
||||
return (uint32) (mach_absolute_time() * highResTimerToMillisecRatio);
|
||||
return (uint32) (mach_absolute_time() * SystemStatsHelpers::highResTimerToMillisecRatio);
|
||||
}
|
||||
|
||||
double Time::getMillisecondCounterHiRes() throw()
|
||||
{
|
||||
return mach_absolute_time() * highResTimerToMillisecRatio;
|
||||
return mach_absolute_time() * SystemStatsHelpers::highResTimerToMillisecRatio;
|
||||
}
|
||||
|
||||
int64 Time::getHighResolutionTicks() throw()
|
||||
|
|
@ -237102,7 +237109,7 @@ int64 Time::getHighResolutionTicks() throw()
|
|||
|
||||
int64 Time::getHighResolutionTicksPerSecond() throw()
|
||||
{
|
||||
return highResTimerFrequency;
|
||||
return SystemStatsHelpers::highResTimerFrequency;
|
||||
}
|
||||
|
||||
int64 SystemStats::getClockCycleCounter() throw()
|
||||
|
|
@ -237754,11 +237761,6 @@ void juce_setCurrentThreadName (const String& /*name*/)
|
|||
{
|
||||
}
|
||||
|
||||
Thread::ThreadID Thread::getCurrentThreadId()
|
||||
{
|
||||
return (ThreadID) pthread_self();
|
||||
}
|
||||
|
||||
bool juce_setThreadPriority (void* handle, int priority)
|
||||
{
|
||||
if (handle == 0)
|
||||
|
|
@ -237771,6 +237773,11 @@ bool juce_setThreadPriority (void* handle, int priority)
|
|||
return pthread_setschedparam ((pthread_t) handle, policy, ¶m) == 0;
|
||||
}
|
||||
|
||||
Thread::ThreadID Thread::getCurrentThreadId()
|
||||
{
|
||||
return static_cast <ThreadID> (pthread_self());
|
||||
}
|
||||
|
||||
void Thread::yield()
|
||||
{
|
||||
sched_yield();
|
||||
|
|
@ -241991,6 +241998,8 @@ void juce_glViewport (const int w, const int h)
|
|||
|
||||
#if JUCE_MAC
|
||||
|
||||
Image* juce_loadPNGImageFromStream (InputStream& inputStream);
|
||||
|
||||
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw()
|
||||
{
|
||||
NSImage* im = CoreGraphicsImage::createNSImage (image);
|
||||
|
|
@ -242003,7 +242012,8 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
|
|||
|
||||
static void* juce_cursorFromData (const unsigned char* data, const size_t size, float hx, float hy) throw()
|
||||
{
|
||||
ScopedPointer <Image> im (ImageFileFormat::loadFrom ((const char*) data, (int) size));
|
||||
MemoryInputStream stream (data, size, false);
|
||||
ScopedPointer <Image> im (juce_loadPNGImageFromStream (stream));
|
||||
jassert (im != 0);
|
||||
|
||||
if (im == 0)
|
||||
|
|
@ -242037,10 +242047,7 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
|
|||
break;
|
||||
|
||||
case MouseCursor::NoCursor:
|
||||
{
|
||||
Image blank (Image::ARGB, 8, 8, true);
|
||||
return juce_createMouseCursorFromImage (blank, 0, 0);
|
||||
}
|
||||
return juce_createMouseCursorFromImage (Image (Image::ARGB, 8, 8, true), 0, 0);
|
||||
|
||||
case MouseCursor::DraggingHandCursor:
|
||||
c = [NSCursor openHandCursor];
|
||||
|
|
@ -245979,6 +245986,7 @@ void NSViewComponentPeer::toFront (bool makeActiveWindow)
|
|||
if (! recursiveToFrontCall)
|
||||
{
|
||||
recursiveToFrontCall = true;
|
||||
Desktop::getInstance().getMainMouseSource().forceMouseCursorUpdate();
|
||||
handleBroughtToFront();
|
||||
recursiveToFrontCall = false;
|
||||
}
|
||||
|
|
@ -246016,7 +246024,6 @@ void NSViewComponentPeer::viewFocusGain()
|
|||
currentlyFocusedPeer->handleFocusLoss();
|
||||
|
||||
currentlyFocusedPeer = this;
|
||||
|
||||
handleFocusGain();
|
||||
}
|
||||
}
|
||||
|
|
@ -246194,6 +246201,7 @@ void NSViewComponentPeer::redirectMouseMove (NSEvent* ev)
|
|||
|
||||
void NSViewComponentPeer::redirectMouseEnter (NSEvent* ev)
|
||||
{
|
||||
Desktop::getInstance().getMainMouseSource().forceMouseCursorUpdate();
|
||||
currentModifiers = currentModifiers.withoutMouseButtons();
|
||||
sendMouseEvent (ev);
|
||||
}
|
||||
|
|
@ -246526,6 +246534,8 @@ const int KeyPress::rewindKey = 0x30003;
|
|||
|
||||
#if JUCE_MAC
|
||||
|
||||
Image* juce_loadPNGImageFromStream (InputStream& inputStream);
|
||||
|
||||
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw()
|
||||
{
|
||||
NSImage* im = CoreGraphicsImage::createNSImage (image);
|
||||
|
|
@ -246538,7 +246548,8 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
|
|||
|
||||
static void* juce_cursorFromData (const unsigned char* data, const size_t size, float hx, float hy) throw()
|
||||
{
|
||||
ScopedPointer <Image> im (ImageFileFormat::loadFrom ((const char*) data, (int) size));
|
||||
MemoryInputStream stream (data, size, false);
|
||||
ScopedPointer <Image> im (juce_loadPNGImageFromStream (stream));
|
||||
jassert (im != 0);
|
||||
|
||||
if (im == 0)
|
||||
|
|
@ -246572,10 +246583,7 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
|
|||
break;
|
||||
|
||||
case MouseCursor::NoCursor:
|
||||
{
|
||||
Image blank (Image::ARGB, 8, 8, true);
|
||||
return juce_createMouseCursorFromImage (blank, 0, 0);
|
||||
}
|
||||
return juce_createMouseCursorFromImage (Image (Image::ARGB, 8, 8, true), 0, 0);
|
||||
|
||||
case MouseCursor::DraggingHandCursor:
|
||||
c = [NSCursor openHandCursor];
|
||||
|
|
@ -248891,14 +248899,6 @@ void AudioCDReader::ejectDisk()
|
|||
// compiled on its own).
|
||||
#if JUCE_INCLUDED_FILE
|
||||
|
||||
struct CallbackMessagePayload
|
||||
{
|
||||
MessageCallbackFunction* function;
|
||||
void* parameter;
|
||||
void* volatile result;
|
||||
bool volatile hasBeenExecuted;
|
||||
};
|
||||
|
||||
class AppDelegateRedirector
|
||||
{
|
||||
public:
|
||||
|
|
@ -248972,6 +248972,14 @@ public:
|
|||
juce_HandleProcessFocusChange();
|
||||
}
|
||||
|
||||
struct CallbackMessagePayload
|
||||
{
|
||||
MessageCallbackFunction* function;
|
||||
void* parameter;
|
||||
void* volatile result;
|
||||
bool volatile hasBeenExecuted;
|
||||
};
|
||||
|
||||
virtual void performCallback (CallbackMessagePayload* pl)
|
||||
{
|
||||
pl->result = (*pl->function) (pl->parameter);
|
||||
|
|
@ -249121,7 +249129,8 @@ using namespace JUCE_NAMESPACE;
|
|||
{
|
||||
if ([info isKindOfClass: [NSData class]])
|
||||
{
|
||||
CallbackMessagePayload* pl = (CallbackMessagePayload*) [((NSData*) info) bytes];
|
||||
AppDelegateRedirector::CallbackMessagePayload* pl
|
||||
= (AppDelegateRedirector::CallbackMessagePayload*) [((NSData*) info) bytes];
|
||||
|
||||
if (pl != 0)
|
||||
redirector->performCallback (pl);
|
||||
|
|
@ -249338,7 +249347,7 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* call
|
|||
|
||||
const ScopedAutoReleasePool pool;
|
||||
|
||||
CallbackMessagePayload cmp;
|
||||
AppDelegateRedirector::CallbackMessagePayload cmp;
|
||||
cmp.function = callback;
|
||||
cmp.parameter = data;
|
||||
cmp.result = 0;
|
||||
|
|
|
|||
|
|
@ -726,10 +726,10 @@ template <typename Type>
|
|||
inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
|
||||
|
||||
template <typename Type>
|
||||
inline Type jmin (const Type a, const Type b) { return (a > b) ? b : a; }
|
||||
inline Type jmin (const Type a, const Type b) { return (b < a) ? b : a; }
|
||||
|
||||
template <typename Type>
|
||||
inline Type jmin (const Type a, const Type b, const Type c) { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); }
|
||||
inline Type jmin (const Type a, const Type b, const Type c) { return (b < a) ? ((c < b) ? c : b) : ((c < a) ? c : a); }
|
||||
|
||||
template <typename Type>
|
||||
inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
|
||||
|
|
@ -742,7 +742,7 @@ inline Type jlimit (const Type lowerLimit,
|
|||
jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
|
||||
|
||||
return (valueToConstrain < lowerLimit) ? lowerLimit
|
||||
: ((valueToConstrain > upperLimit) ? upperLimit
|
||||
: ((upperLimit < valueToConstrain) ? upperLimit
|
||||
: valueToConstrain);
|
||||
}
|
||||
|
||||
|
|
@ -755,7 +755,7 @@ inline void swapVariables (Type& variable1, Type& variable2)
|
|||
}
|
||||
|
||||
template <typename Type>
|
||||
inline int numElementsInArray (Type& array) { return (int) (sizeof (array) / sizeof (array[0])); }
|
||||
inline int numElementsInArray (Type& array) { return static_cast<int> (sizeof (array) / sizeof (array[0])); }
|
||||
|
||||
// Some useful maths functions that aren't always present with all compilers and build settings.
|
||||
|
||||
|
|
@ -842,33 +842,33 @@ public:
|
|||
|
||||
static uint64 swap (uint64 value);
|
||||
|
||||
static uint16 swapIfBigEndian (const uint16 value);
|
||||
static uint16 swapIfBigEndian (uint16 value);
|
||||
|
||||
static uint32 swapIfBigEndian (const uint32 value);
|
||||
static uint32 swapIfBigEndian (uint32 value);
|
||||
|
||||
static uint64 swapIfBigEndian (const uint64 value);
|
||||
static uint64 swapIfBigEndian (uint64 value);
|
||||
|
||||
static uint16 swapIfLittleEndian (const uint16 value);
|
||||
static uint16 swapIfLittleEndian (uint16 value);
|
||||
|
||||
static uint32 swapIfLittleEndian (const uint32 value);
|
||||
static uint32 swapIfLittleEndian (uint32 value);
|
||||
|
||||
static uint64 swapIfLittleEndian (const uint64 value);
|
||||
static uint64 swapIfLittleEndian (uint64 value);
|
||||
|
||||
static uint32 littleEndianInt (const char* const bytes);
|
||||
static uint32 littleEndianInt (const char* bytes);
|
||||
|
||||
static uint16 littleEndianShort (const char* const bytes);
|
||||
static uint16 littleEndianShort (const char* bytes);
|
||||
|
||||
static uint32 bigEndianInt (const char* const bytes);
|
||||
static uint32 bigEndianInt (const char* bytes);
|
||||
|
||||
static uint16 bigEndianShort (const char* const bytes);
|
||||
static uint16 bigEndianShort (const char* bytes);
|
||||
|
||||
static int littleEndian24Bit (const char* const bytes);
|
||||
static int littleEndian24Bit (const char* bytes);
|
||||
|
||||
static int bigEndian24Bit (const char* const bytes);
|
||||
static int bigEndian24Bit (const char* bytes);
|
||||
|
||||
static void littleEndian24BitToChars (const int value, char* const destBytes);
|
||||
static void littleEndian24BitToChars (int value, char* destBytes);
|
||||
|
||||
static void bigEndian24BitToChars (const int value, char* const destBytes);
|
||||
static void bigEndian24BitToChars (int value, char* destBytes);
|
||||
|
||||
static bool isBigEndian();
|
||||
};
|
||||
|
|
@ -880,9 +880,9 @@ public:
|
|||
inline uint16 ByteOrder::swap (uint16 n)
|
||||
{
|
||||
#if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
|
||||
return (uint16) _byteswap_ushort (n);
|
||||
return static_cast <uint16> (_byteswap_ushort (n));
|
||||
#else
|
||||
return (uint16) ((n << 8) | (n >> 8));
|
||||
return static_cast <uint16> ((n << 8) | (n >> 8));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -7044,13 +7044,13 @@ class JUCE_API Random
|
|||
{
|
||||
public:
|
||||
|
||||
Random (const int64 seedValue) throw();
|
||||
Random (int64 seedValue) throw();
|
||||
|
||||
~Random() throw();
|
||||
|
||||
int nextInt() throw();
|
||||
|
||||
int nextInt (const int maxValue) throw();
|
||||
int nextInt (int maxValue) throw();
|
||||
|
||||
int64 nextInt64() throw();
|
||||
|
||||
|
|
@ -7066,9 +7066,9 @@ public:
|
|||
|
||||
static Random& getSystemRandom() throw();
|
||||
|
||||
void setSeed (const int64 newSeed) throw();
|
||||
void setSeed (int64 newSeed) throw();
|
||||
|
||||
void combineSeed (const int64 seedValue) throw();
|
||||
void combineSeed (int64 seedValue) throw();
|
||||
|
||||
void setSeedRandomly();
|
||||
|
||||
|
|
@ -8211,10 +8211,10 @@ class JUCE_API GZIPCompressorOutputStream : public OutputStream
|
|||
{
|
||||
public:
|
||||
|
||||
GZIPCompressorOutputStream (OutputStream* const destStream,
|
||||
GZIPCompressorOutputStream (OutputStream* destStream,
|
||||
int compressionLevel = 0,
|
||||
const bool deleteDestStreamWhenDestroyed = false,
|
||||
const bool noWrap = false);
|
||||
bool deleteDestStreamWhenDestroyed = false,
|
||||
bool noWrap = false);
|
||||
|
||||
~GZIPCompressorOutputStream();
|
||||
|
||||
|
|
@ -8253,10 +8253,10 @@ class JUCE_API GZIPDecompressorInputStream : public InputStream
|
|||
{
|
||||
public:
|
||||
|
||||
GZIPDecompressorInputStream (InputStream* const sourceStream,
|
||||
const bool deleteSourceWhenDestroyed,
|
||||
const bool noWrap = false,
|
||||
const int64 uncompressedStreamLength = -1);
|
||||
GZIPDecompressorInputStream (InputStream* sourceStream,
|
||||
bool deleteSourceWhenDestroyed,
|
||||
bool noWrap = false,
|
||||
int64 uncompressedStreamLength = -1);
|
||||
|
||||
~GZIPDecompressorInputStream();
|
||||
|
||||
|
|
|
|||
|
|
@ -46,48 +46,48 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Swaps the byte order of a 16-bit int if the CPU is big-endian */
|
||||
static uint16 swapIfBigEndian (const uint16 value);
|
||||
static uint16 swapIfBigEndian (uint16 value);
|
||||
|
||||
/** Swaps the byte order of a 32-bit int if the CPU is big-endian */
|
||||
static uint32 swapIfBigEndian (const uint32 value);
|
||||
static uint32 swapIfBigEndian (uint32 value);
|
||||
|
||||
/** Swaps the byte order of a 64-bit int if the CPU is big-endian */
|
||||
static uint64 swapIfBigEndian (const uint64 value);
|
||||
static uint64 swapIfBigEndian (uint64 value);
|
||||
|
||||
/** Swaps the byte order of a 16-bit int if the CPU is little-endian */
|
||||
static uint16 swapIfLittleEndian (const uint16 value);
|
||||
static uint16 swapIfLittleEndian (uint16 value);
|
||||
|
||||
/** Swaps the byte order of a 32-bit int if the CPU is little-endian */
|
||||
static uint32 swapIfLittleEndian (const uint32 value);
|
||||
static uint32 swapIfLittleEndian (uint32 value);
|
||||
|
||||
/** Swaps the byte order of a 64-bit int if the CPU is little-endian */
|
||||
static uint64 swapIfLittleEndian (const uint64 value);
|
||||
static uint64 swapIfLittleEndian (uint64 value);
|
||||
|
||||
//==============================================================================
|
||||
/** Turns 4 bytes into a little-endian integer. */
|
||||
static uint32 littleEndianInt (const char* const bytes);
|
||||
static uint32 littleEndianInt (const char* bytes);
|
||||
|
||||
/** Turns 2 bytes into a little-endian integer. */
|
||||
static uint16 littleEndianShort (const char* const bytes);
|
||||
static uint16 littleEndianShort (const char* bytes);
|
||||
|
||||
/** Turns 4 bytes into a big-endian integer. */
|
||||
static uint32 bigEndianInt (const char* const bytes);
|
||||
static uint32 bigEndianInt (const char* bytes);
|
||||
|
||||
/** Turns 2 bytes into a big-endian integer. */
|
||||
static uint16 bigEndianShort (const char* const bytes);
|
||||
static uint16 bigEndianShort (const char* bytes);
|
||||
|
||||
//==============================================================================
|
||||
/** Converts 3 little-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits). */
|
||||
static int littleEndian24Bit (const char* const bytes);
|
||||
static int littleEndian24Bit (const char* bytes);
|
||||
|
||||
/** Converts 3 big-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits). */
|
||||
static int bigEndian24Bit (const char* const bytes);
|
||||
static int bigEndian24Bit (const char* bytes);
|
||||
|
||||
/** Copies a 24-bit number to 3 little-endian bytes. */
|
||||
static void littleEndian24BitToChars (const int value, char* const destBytes);
|
||||
static void littleEndian24BitToChars (int value, char* destBytes);
|
||||
|
||||
/** Copies a 24-bit number to 3 big-endian bytes. */
|
||||
static void bigEndian24BitToChars (const int value, char* const destBytes);
|
||||
static void bigEndian24BitToChars (int value, char* destBytes);
|
||||
|
||||
//==============================================================================
|
||||
/** Returns true if the current CPU is big-endian. */
|
||||
|
|
@ -103,9 +103,9 @@ public:
|
|||
inline uint16 ByteOrder::swap (uint16 n)
|
||||
{
|
||||
#if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
|
||||
return (uint16) _byteswap_ushort (n);
|
||||
return static_cast <uint16> (_byteswap_ushort (n));
|
||||
#else
|
||||
return (uint16) ((n << 8) | (n >> 8));
|
||||
return static_cast <uint16> ((n << 8) | (n >> 8));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,11 +112,11 @@ inline Type jmax (const Type a, const Type b, const Type c, const Type d)
|
|||
|
||||
/** Returns the smaller of two values. */
|
||||
template <typename Type>
|
||||
inline Type jmin (const Type a, const Type b) { return (a > b) ? b : a; }
|
||||
inline Type jmin (const Type a, const Type b) { return (b < a) ? b : a; }
|
||||
|
||||
/** Returns the smaller of three values. */
|
||||
template <typename Type>
|
||||
inline Type jmin (const Type a, const Type b, const Type c) { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); }
|
||||
inline Type jmin (const Type a, const Type b, const Type c) { return (b < a) ? ((c < b) ? c : b) : ((c < a) ? c : a); }
|
||||
|
||||
/** Returns the smaller of four values. */
|
||||
template <typename Type>
|
||||
|
|
@ -148,7 +148,7 @@ inline Type jlimit (const Type lowerLimit,
|
|||
jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
|
||||
|
||||
return (valueToConstrain < lowerLimit) ? lowerLimit
|
||||
: ((valueToConstrain > upperLimit) ? upperLimit
|
||||
: ((upperLimit < valueToConstrain) ? upperLimit
|
||||
: valueToConstrain);
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ inline void swapVariables (Type& variable1, Type& variable2)
|
|||
@endcode
|
||||
*/
|
||||
template <typename Type>
|
||||
inline int numElementsInArray (Type& array) { return (int) (sizeof (array) / sizeof (array[0])); }
|
||||
inline int numElementsInArray (Type& array) { return static_cast<int> (sizeof (array) / sizeof (array[0])); }
|
||||
|
||||
//==============================================================================
|
||||
// Some useful maths functions that aren't always present with all compilers and build settings.
|
||||
|
|
|
|||
|
|
@ -86,12 +86,12 @@ bool Random::nextBool() throw()
|
|||
|
||||
float Random::nextFloat() throw()
|
||||
{
|
||||
return ((uint32) nextInt()) / (float) 0xffffffff;
|
||||
return static_cast <uint32> (nextInt()) / (float) 0xffffffff;
|
||||
}
|
||||
|
||||
double Random::nextDouble() throw()
|
||||
{
|
||||
return ((uint32) nextInt()) / (double) 0xffffffff;
|
||||
return static_cast <uint32> (nextInt()) / (double) 0xffffffff;
|
||||
}
|
||||
|
||||
const BitArray Random::nextLargeNumber (const BitArray& maximumValue) throw()
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
new Random (Time::currentTimeMillis())
|
||||
*/
|
||||
Random (const int64 seedValue) throw();
|
||||
Random (int64 seedValue) throw();
|
||||
|
||||
/** Destructor. */
|
||||
~Random() throw();
|
||||
|
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
@returns a random integer between 0 (inclusive) and maxValue (exclusive).
|
||||
*/
|
||||
int nextInt (const int maxValue) throw();
|
||||
int nextInt (int maxValue) throw();
|
||||
|
||||
/** Returns the next 64-bit random number.
|
||||
|
||||
|
|
@ -103,13 +103,13 @@ public:
|
|||
static Random& getSystemRandom() throw();
|
||||
|
||||
/** Resets this Random object to a given seed value. */
|
||||
void setSeed (const int64 newSeed) throw();
|
||||
void setSeed (int64 newSeed) throw();
|
||||
|
||||
/** Merges this object's seed with another value.
|
||||
This sets the seed to be a value created by combining the current seed and this
|
||||
new value.
|
||||
*/
|
||||
void combineSeed (const int64 seedValue) throw();
|
||||
void combineSeed (int64 seedValue) throw();
|
||||
|
||||
/** Reseeds this generator using a value generated from various semi-random system
|
||||
properties like the current time, etc.
|
||||
|
|
|
|||
|
|
@ -1503,10 +1503,13 @@ bool Component::isBroughtToFrontOnMouseClick() const throw()
|
|||
//==============================================================================
|
||||
void Component::setMouseCursor (const MouseCursor& cursor)
|
||||
{
|
||||
cursor_ = cursor;
|
||||
if (cursor_ != cursor)
|
||||
{
|
||||
cursor_ = cursor;
|
||||
|
||||
if (flags.visibleFlag)
|
||||
sendFakeMouseMove();
|
||||
if (flags.visibleFlag)
|
||||
updateMouseCursor();
|
||||
}
|
||||
}
|
||||
|
||||
const MouseCursor Component::getMouseCursor()
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ public:
|
|||
@param noWrap this is used internally by the ZipFile class
|
||||
and should be ignored by user applications
|
||||
*/
|
||||
GZIPCompressorOutputStream (OutputStream* const destStream,
|
||||
GZIPCompressorOutputStream (OutputStream* destStream,
|
||||
int compressionLevel = 0,
|
||||
const bool deleteDestStreamWhenDestroyed = false,
|
||||
const bool noWrap = false);
|
||||
bool deleteDestStreamWhenDestroyed = false,
|
||||
bool noWrap = false);
|
||||
|
||||
/** Destructor. */
|
||||
~GZIPCompressorOutputStream();
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ public:
|
|||
uncompressed stream will be, then it can supply this
|
||||
value, which will be returned by getTotalLength()
|
||||
*/
|
||||
GZIPDecompressorInputStream (InputStream* const sourceStream,
|
||||
const bool deleteSourceWhenDestroyed,
|
||||
const bool noWrap = false,
|
||||
const int64 uncompressedStreamLength = -1);
|
||||
GZIPDecompressorInputStream (InputStream* sourceStream,
|
||||
bool deleteSourceWhenDestroyed,
|
||||
bool noWrap = false,
|
||||
int64 uncompressedStreamLength = -1);
|
||||
|
||||
/** Destructor. */
|
||||
~GZIPDecompressorInputStream();
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ BEGIN_JUCE_NAMESPACE
|
|||
#include "../io/files/juce_FileInputStream.h"
|
||||
#include "../io/files/juce_NamedPipe.h"
|
||||
#include "../io/network/juce_URL.h"
|
||||
#include "../io/streams/juce_MemoryInputStream.h"
|
||||
#include "../core/juce_PlatformUtilities.h"
|
||||
#include "../text/juce_LocalisedStrings.h"
|
||||
#include "../utilities/juce_DeletedAtShutdown.h"
|
||||
|
|
|
|||
|
|
@ -27,14 +27,6 @@
|
|||
// compiled on its own).
|
||||
#if JUCE_INCLUDED_FILE
|
||||
|
||||
struct CallbackMessagePayload
|
||||
{
|
||||
MessageCallbackFunction* function;
|
||||
void* parameter;
|
||||
void* volatile result;
|
||||
bool volatile hasBeenExecuted;
|
||||
};
|
||||
|
||||
/* When you use multiple DLLs which share similarly-named obj-c classes - like
|
||||
for example having more than one juce plugin loaded into a host, then when a
|
||||
method is called, the actual code that runs might actually be in a different module
|
||||
|
|
@ -118,6 +110,14 @@ public:
|
|||
juce_HandleProcessFocusChange();
|
||||
}
|
||||
|
||||
struct CallbackMessagePayload
|
||||
{
|
||||
MessageCallbackFunction* function;
|
||||
void* parameter;
|
||||
void* volatile result;
|
||||
bool volatile hasBeenExecuted;
|
||||
};
|
||||
|
||||
virtual void performCallback (CallbackMessagePayload* pl)
|
||||
{
|
||||
pl->result = (*pl->function) (pl->parameter);
|
||||
|
|
@ -268,7 +268,8 @@ using namespace JUCE_NAMESPACE;
|
|||
{
|
||||
if ([info isKindOfClass: [NSData class]])
|
||||
{
|
||||
CallbackMessagePayload* pl = (CallbackMessagePayload*) [((NSData*) info) bytes];
|
||||
AppDelegateRedirector::CallbackMessagePayload* pl
|
||||
= (AppDelegateRedirector::CallbackMessagePayload*) [((NSData*) info) bytes];
|
||||
|
||||
if (pl != 0)
|
||||
redirector->performCallback (pl);
|
||||
|
|
@ -486,7 +487,7 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* call
|
|||
|
||||
const ScopedAutoReleasePool pool;
|
||||
|
||||
CallbackMessagePayload cmp;
|
||||
AppDelegateRedirector::CallbackMessagePayload cmp;
|
||||
cmp.function = callback;
|
||||
cmp.parameter = data;
|
||||
cmp.result = 0;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#if JUCE_MAC
|
||||
|
||||
Image* juce_loadPNGImageFromStream (InputStream& inputStream);
|
||||
|
||||
//==============================================================================
|
||||
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw()
|
||||
|
|
@ -43,7 +44,8 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
|
|||
|
||||
static void* juce_cursorFromData (const unsigned char* data, const size_t size, float hx, float hy) throw()
|
||||
{
|
||||
ScopedPointer <Image> im (ImageFileFormat::loadFrom ((const char*) data, (int) size));
|
||||
MemoryInputStream stream (data, size, false);
|
||||
ScopedPointer <Image> im (juce_loadPNGImageFromStream (stream));
|
||||
jassert (im != 0);
|
||||
|
||||
if (im == 0)
|
||||
|
|
@ -77,10 +79,7 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
|
|||
break;
|
||||
|
||||
case MouseCursor::NoCursor:
|
||||
{
|
||||
Image blank (Image::ARGB, 8, 8, true);
|
||||
return juce_createMouseCursorFromImage (blank, 0, 0);
|
||||
}
|
||||
return juce_createMouseCursorFromImage (Image (Image::ARGB, 8, 8, true), 0, 0);
|
||||
|
||||
case MouseCursor::DraggingHandCursor:
|
||||
c = [NSCursor openHandCursor];
|
||||
|
|
|
|||
|
|
@ -1169,6 +1169,7 @@ void NSViewComponentPeer::toFront (bool makeActiveWindow)
|
|||
if (! recursiveToFrontCall)
|
||||
{
|
||||
recursiveToFrontCall = true;
|
||||
Desktop::getInstance().getMainMouseSource().forceMouseCursorUpdate();
|
||||
handleBroughtToFront();
|
||||
recursiveToFrontCall = false;
|
||||
}
|
||||
|
|
@ -1207,7 +1208,6 @@ void NSViewComponentPeer::viewFocusGain()
|
|||
currentlyFocusedPeer->handleFocusLoss();
|
||||
|
||||
currentlyFocusedPeer = this;
|
||||
|
||||
handleFocusGain();
|
||||
}
|
||||
}
|
||||
|
|
@ -1386,6 +1386,7 @@ void NSViewComponentPeer::redirectMouseMove (NSEvent* ev)
|
|||
|
||||
void NSViewComponentPeer::redirectMouseEnter (NSEvent* ev)
|
||||
{
|
||||
Desktop::getInstance().getMainMouseSource().forceMouseCursorUpdate();
|
||||
currentModifiers = currentModifiers.withoutMouseButtons();
|
||||
sendMouseEvent (ev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,57 +27,61 @@
|
|||
// compiled on its own).
|
||||
#if JUCE_INCLUDED_FILE
|
||||
|
||||
static int64 highResTimerFrequency = 0;
|
||||
static double highResTimerToMillisecRatio = 0;
|
||||
|
||||
#if JUCE_INTEL
|
||||
|
||||
static void juce_getCpuVendor (char* const v) throw()
|
||||
namespace SystemStatsHelpers
|
||||
{
|
||||
int vendor[4];
|
||||
zerostruct (vendor);
|
||||
int dummy = 0;
|
||||
static int64 highResTimerFrequency = 0;
|
||||
static double highResTimerToMillisecRatio = 0;
|
||||
|
||||
asm ("mov %%ebx, %%esi \n\t"
|
||||
"cpuid \n\t"
|
||||
"xchg %%esi, %%ebx"
|
||||
: "=a" (dummy), "=S" (vendor[0]), "=c" (vendor[2]), "=d" (vendor[1]) : "a" (0));
|
||||
#if JUCE_INTEL
|
||||
|
||||
memcpy (v, vendor, 16);
|
||||
static void juce_getCpuVendor (char* const v) throw()
|
||||
{
|
||||
int vendor[4];
|
||||
zerostruct (vendor);
|
||||
int dummy = 0;
|
||||
|
||||
asm ("mov %%ebx, %%esi \n\t"
|
||||
"cpuid \n\t"
|
||||
"xchg %%esi, %%ebx"
|
||||
: "=a" (dummy), "=S" (vendor[0]), "=c" (vendor[2]), "=d" (vendor[1]) : "a" (0));
|
||||
|
||||
memcpy (v, vendor, 16);
|
||||
}
|
||||
|
||||
static unsigned int getCPUIDWord (unsigned int& familyModel, unsigned int& extFeatures)
|
||||
{
|
||||
unsigned int cpu = 0;
|
||||
unsigned int ext = 0;
|
||||
unsigned int family = 0;
|
||||
unsigned int dummy = 0;
|
||||
|
||||
asm ("mov %%ebx, %%esi \n\t"
|
||||
"cpuid \n\t"
|
||||
"xchg %%esi, %%ebx"
|
||||
: "=a" (family), "=S" (ext), "=c" (dummy), "=d" (cpu) : "a" (1));
|
||||
|
||||
familyModel = family;
|
||||
extFeatures = ext;
|
||||
return cpu;
|
||||
}
|
||||
|
||||
struct CPUFlags
|
||||
{
|
||||
bool hasMMX : 1;
|
||||
bool hasSSE : 1;
|
||||
bool hasSSE2 : 1;
|
||||
bool has3DNow : 1;
|
||||
};
|
||||
|
||||
static CPUFlags cpuFlags;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static unsigned int getCPUIDWord (unsigned int& familyModel, unsigned int& extFeatures)
|
||||
{
|
||||
unsigned int cpu = 0;
|
||||
unsigned int ext = 0;
|
||||
unsigned int family = 0;
|
||||
unsigned int dummy = 0;
|
||||
|
||||
asm ("mov %%ebx, %%esi \n\t"
|
||||
"cpuid \n\t"
|
||||
"xchg %%esi, %%ebx"
|
||||
: "=a" (family), "=S" (ext), "=c" (dummy), "=d" (cpu) : "a" (1));
|
||||
|
||||
familyModel = family;
|
||||
extFeatures = ext;
|
||||
return cpu;
|
||||
}
|
||||
|
||||
struct CPUFlags
|
||||
{
|
||||
bool hasMMX : 1;
|
||||
bool hasSSE : 1;
|
||||
bool hasSSE2 : 1;
|
||||
bool has3DNow : 1;
|
||||
};
|
||||
|
||||
static CPUFlags cpuFlags;
|
||||
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
void SystemStats::initialiseStats() throw()
|
||||
{
|
||||
using namespace SystemStatsHelpers;
|
||||
static bool initialised = false;
|
||||
|
||||
if (! initialised)
|
||||
|
|
@ -151,7 +155,7 @@ int SystemStats::getMemorySizeInMegabytes() throw()
|
|||
bool SystemStats::hasMMX() throw()
|
||||
{
|
||||
#if JUCE_INTEL
|
||||
return cpuFlags.hasMMX;
|
||||
return SystemStatsHelpers::cpuFlags.hasMMX;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
@ -160,7 +164,7 @@ bool SystemStats::hasMMX() throw()
|
|||
bool SystemStats::hasSSE() throw()
|
||||
{
|
||||
#if JUCE_INTEL
|
||||
return cpuFlags.hasSSE;
|
||||
return SystemStatsHelpers::cpuFlags.hasSSE;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
@ -169,7 +173,7 @@ bool SystemStats::hasSSE() throw()
|
|||
bool SystemStats::hasSSE2() throw()
|
||||
{
|
||||
#if JUCE_INTEL
|
||||
return cpuFlags.hasSSE2;
|
||||
return SystemStatsHelpers::cpuFlags.hasSSE2;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
@ -178,7 +182,7 @@ bool SystemStats::hasSSE2() throw()
|
|||
bool SystemStats::has3DNow() throw()
|
||||
{
|
||||
#if JUCE_INTEL
|
||||
return cpuFlags.has3DNow;
|
||||
return SystemStatsHelpers::cpuFlags.has3DNow;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
@ -188,7 +192,7 @@ const String SystemStats::getCpuVendor() throw()
|
|||
{
|
||||
#if JUCE_INTEL
|
||||
char v [16];
|
||||
juce_getCpuVendor (v);
|
||||
SystemStatsHelpers::juce_getCpuVendor (v);
|
||||
return String (v, 16);
|
||||
#else
|
||||
return String::empty;
|
||||
|
|
@ -232,12 +236,12 @@ const String SystemStats::getFullUserName()
|
|||
//==============================================================================
|
||||
uint32 juce_millisecondsSinceStartup() throw()
|
||||
{
|
||||
return (uint32) (mach_absolute_time() * highResTimerToMillisecRatio);
|
||||
return (uint32) (mach_absolute_time() * SystemStatsHelpers::highResTimerToMillisecRatio);
|
||||
}
|
||||
|
||||
double Time::getMillisecondCounterHiRes() throw()
|
||||
{
|
||||
return mach_absolute_time() * highResTimerToMillisecRatio;
|
||||
return mach_absolute_time() * SystemStatsHelpers::highResTimerToMillisecRatio;
|
||||
}
|
||||
|
||||
int64 Time::getHighResolutionTicks() throw()
|
||||
|
|
@ -247,7 +251,7 @@ int64 Time::getHighResolutionTicks() throw()
|
|||
|
||||
int64 Time::getHighResolutionTicksPerSecond() throw()
|
||||
{
|
||||
return highResTimerFrequency;
|
||||
return SystemStatsHelpers::highResTimerFrequency;
|
||||
}
|
||||
|
||||
int64 SystemStats::getClockCycleCounter() throw()
|
||||
|
|
|
|||
|
|
@ -66,11 +66,6 @@ void juce_setCurrentThreadName (const String& /*name*/)
|
|||
{
|
||||
}
|
||||
|
||||
Thread::ThreadID Thread::getCurrentThreadId()
|
||||
{
|
||||
return (ThreadID) pthread_self();
|
||||
}
|
||||
|
||||
bool juce_setThreadPriority (void* handle, int priority)
|
||||
{
|
||||
if (handle == 0)
|
||||
|
|
@ -83,6 +78,11 @@ bool juce_setThreadPriority (void* handle, int priority)
|
|||
return pthread_setschedparam ((pthread_t) handle, policy, ¶m) == 0;
|
||||
}
|
||||
|
||||
Thread::ThreadID Thread::getCurrentThreadId()
|
||||
{
|
||||
return static_cast <ThreadID> (pthread_self());
|
||||
}
|
||||
|
||||
void Thread::yield()
|
||||
{
|
||||
sched_yield();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue