Browse Source

Small fixes for mouse positioning. Clean-up for win32 CD reader code.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
7b955dd6c3
12 changed files with 663 additions and 1094 deletions
  1. +1
    -1
      extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm
  2. +7
    -1
      src/audio/audio_file_formats/juce_AudioThumbnail.h
  3. +10
    -5
      src/gui/components/juce_Desktop.cpp
  4. +13
    -2
      src/gui/components/juce_Desktop.h
  5. +2
    -2
      src/native/linux/juce_linux_Windowing.cpp
  6. +1
    -1
      src/native/mac/juce_iphone_UIViewComponentPeer.mm
  7. +1
    -1
      src/native/mac/juce_mac_MiscUtilities.mm
  8. +613
    -1074
      src/native/windows/juce_win32_AudioCDReader.cpp
  9. +9
    -3
      src/native/windows/juce_win32_DynamicLibraryLoader.cpp
  10. +3
    -1
      src/native/windows/juce_win32_DynamicLibraryLoader.h
  11. +1
    -1
      src/native/windows/juce_win32_Windowing.cpp
  12. +2
    -2
      src/threads/juce_Thread.cpp

+ 1
- 1
extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm View File

@@ -794,7 +794,7 @@ public:
while (i.getNextEvent (midiEventData, midiEventSize, midiEventPosition))
{
jassert (isPositiveAndBelow (midiEventPosition, numSamples));
jassert (isPositiveAndBelow (midiEventPosition, (int) numSamples));


+ 7
- 1
src/audio/audio_file_formats/juce_AudioThumbnail.h View File

@@ -99,7 +99,13 @@ public:
/** Gives the thumbnail an AudioFormatReader to use directly.
This will start parsing the audio in a background thread (unless the hash code
can be looked-up successfully in the thumbnail cache).
can be looked-up successfully in the thumbnail cache). Note that the reader
object will be held by the thumbnail and deleted later when no longer needed.
The thumbnail will actually keep hold of this reader until you clear the thumbnail
or change the input source, so the file will be held open for all this time. If
you don't want the thumbnail to keep a file handle open continuously, you
should use the setSource() method instead, which will only open the file when
it needs to.
*/
void setReader (AudioFormatReader* newReader, int64 hashCode);


+ 10
- 5
src/gui/components/juce_Desktop.cpp View File

@@ -207,12 +207,17 @@ void Desktop::componentBroughtToFront (Component* const c)
}
//==============================================================================
const Point<int> Desktop::getLastMouseDownPosition() throw()
const Point<int> Desktop::getMousePosition()
{
return getInstance().getMainMouseSource().getScreenPosition();
}
const Point<int> Desktop::getLastMouseDownPosition()
{
return getInstance().getMainMouseSource().getLastMouseDownPosition();
}
int Desktop::getMouseButtonClickCounter() throw()
int Desktop::getMouseButtonClickCounter()
{
return getInstance().mouseClickCounter;
}
@@ -288,7 +293,7 @@ void Desktop::removeGlobalMouseListener (MouseListener* const listener)
void Desktop::timerCallback()
{
if (lastFakeMouseMove != getMousePosition())
if (lastFakeMouseMove != getRawMousePosition())
sendMouseMove();
}
@@ -298,7 +303,7 @@ void Desktop::sendMouseMove()
{
startTimer (20);
lastFakeMouseMove = getMousePosition();
lastFakeMouseMove = getRawMousePosition();
Component* const target = findComponentAt (lastFakeMouseMove);
@@ -326,7 +331,7 @@ void Desktop::resetTimer()
else
startTimer (100);
lastFakeMouseMove = getMousePosition();
lastFakeMouseMove = getRawMousePosition();
}
//==============================================================================


+ 13
- 2
src/gui/components/juce_Desktop.h View File

@@ -104,6 +104,10 @@ public:
/** Returns the mouse position.
The co-ordinates are relative to the top-left of the main monitor.
Note that this is just a shortcut for calling getMainMouseSource().getScreenPosition(), and
you should only resort to grabbing the global mouse position if there's really no
way to get the coordinates via a mouse event callback instead.
*/
static const Point<int> getMousePosition();
@@ -114,15 +118,20 @@ public:
static void setMousePosition (const Point<int>& newPosition);
/** Returns the last position at which a mouse button was pressed.
Note that this is just a shortcut for calling getMainMouseSource().getLastMouseDownPosition(),
and in a multi-touch environment, it doesn't make much sense. ALWAYS prefer to
get this information via other means, such as MouseEvent::getMouseDownScreenPosition()
if possible, and only ever call this as a last resort.
*/
static const Point<int> getLastMouseDownPosition() throw();
static const Point<int> getLastMouseDownPosition();
/** Returns the number of times the mouse button has been clicked since the
app started.
Each mouse-down event increments this number by 1.
*/
static int getMouseButtonClickCounter() throw();
static int getMouseButtonClickCounter();
//==============================================================================
/** This lets you prevent the screensaver from becoming active.
@@ -345,6 +354,8 @@ private:
ComponentAnimator animator;
static const Point<int> getRawMousePosition();
void timerCallback();
void resetTimer();


+ 2
- 2
src/native/linux/juce_linux_Windowing.cpp View File

@@ -1432,7 +1432,7 @@ public:
void handleMotionNotifyEvent (const XPointerMovedEvent* const movedEvent)
{
updateKeyModifiers (movedEvent->state);
const Point<int> mousePos (Desktop::getMousePosition());
const Point<int> mousePos (movedEvent->x_root, movedEvent->y_root);
if (lastMousePos != mousePos)
{
@@ -2806,7 +2806,7 @@ bool Desktop::canUseSemiTransparentWindows() throw()
&& (matchedDepth == desiredDepth);
}
const Point<int> Desktop::getMousePosition()
const Point<int> Desktop::getRawMousePosition()
{
Window root, child;
int x, y, winx, winy;


+ 1
- 1
src/native/mac/juce_iphone_UIViewComponentPeer.mm View File

@@ -978,7 +978,7 @@ bool Desktop::canUseSemiTransparentWindows() throw()
return true;
}
const Point<int> Desktop::getMousePosition()
const Point<int> Desktop::getRawMousePosition()
{
return juce_lastMousePos;
}


+ 1
- 1
src/native/mac/juce_mac_MiscUtilities.mm View File

@@ -143,7 +143,7 @@ bool Desktop::canUseSemiTransparentWindows() throw()
return true;
}
const Point<int> Desktop::getMousePosition()
const Point<int> Desktop::getRawMousePosition()
{
const ScopedAutoReleasePool pool;
const NSPoint p ([NSEvent mouseLocation]);


+ 613
- 1074
src/native/windows/juce_win32_AudioCDReader.cpp
File diff suppressed because it is too large
View File


+ 9
- 3
src/native/windows/juce_win32_DynamicLibraryLoader.cpp View File

@@ -29,16 +29,23 @@
#include "juce_win32_DynamicLibraryLoader.h"
//==============================================================================
DynamicLibraryLoader::DynamicLibraryLoader (const String& name)
: libHandle (0)
{
libHandle = LoadLibrary (name);
load (name);
}
DynamicLibraryLoader::~DynamicLibraryLoader()
{
load (String::empty);
}
bool DynamicLibraryLoader::load (const String& name)
{
FreeLibrary ((HMODULE) libHandle);
libHandle = name.isNotEmpty() ? LoadLibrary (name) : 0;
return libHandle != 0;
}
void* DynamicLibraryLoader::findProcAddress (const String& functionName)
@@ -46,5 +53,4 @@ void* DynamicLibraryLoader::findProcAddress (const String& functionName)
return (void*) GetProcAddress ((HMODULE) libHandle, functionName.toCString()); // (void* cast is required for mingw)
}
#endif

+ 3
- 1
src/native/windows/juce_win32_DynamicLibraryLoader.h View File

@@ -48,9 +48,11 @@
class JUCE_API DynamicLibraryLoader
{
public:
DynamicLibraryLoader (const String& name);
DynamicLibraryLoader (const String& name = String::empty);
~DynamicLibraryLoader();
bool load (const String& libraryName);
void* findProcAddress (const String& functionName);
private:


+ 1
- 1
src/native/windows/juce_win32_Windowing.cpp View File

@@ -2439,7 +2439,7 @@ void Desktop::createMouseInputSources()
mouseSources.add (new MouseInputSource (0, true));
}
const Point<int> Desktop::getMousePosition()
const Point<int> Desktop::getRawMousePosition()
{
POINT mousePos;
GetCursorPos (&mousePos);


+ 2
- 2
src/threads/juce_Thread.cpp View File

@@ -122,13 +122,13 @@ void Thread::threadEntryPoint()
JUCE_TRY
{
jassert (getCurrentThreadId() == threadId_);
if (threadName_.isNotEmpty())
setCurrentThreadName (threadName_);
if (startSuspensionEvent_.wait (10000))
{
jassert (getCurrentThreadId() == threadId_);
if (affinityMask_ != 0)
setCurrentThreadAffinityMask (affinityMask_);


Loading…
Cancel
Save