Skip to content

Commit

Permalink
Make the mousemove behaviour of OS X plug-ins the same as their Windo…
Browse files Browse the repository at this point in the history
…ws counterparts
  • Loading branch information
tpoole committed Aug 19, 2016
1 parent 48db4fa commit 08b2116
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,8 @@ void componentMovedOrResized (Component& component, bool /*wasMoved*/, bool /*wa
#else
setWantsKeyboardFocus (true);
#endif

ignoreUnused (fakeMouseGenerator);
}

~EditorCompHolder()
Expand Down Expand Up @@ -1259,6 +1261,8 @@ bool keyPressed (const KeyPress&) override
}

private:
FakeMouseMoveGenerator fakeMouseGenerator;

JUCE_DECLARE_NON_COPYABLE (EditorCompHolder)
};

Expand Down
2 changes: 1 addition & 1 deletion modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ class JuceVSTWrapper : public AudioEffectX,
addMouseListener (this, true);
#endif

ignoreUnused (fakeMouseGenerator);
ignoreUnused (fakeMouseGenerator);
}

~EditorCompWrapper()
Expand Down
4 changes: 4 additions & 0 deletions modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "../utility/juce_IncludeModuleHeaders.h"
#include "../utility/juce_WindowsHooks.h"
#include "../utility/juce_PluginBusUtilities.h"
#include "../utility/juce_FakeMouseMoveGenerator.h"
#include "../../juce_audio_processors/format_types/juce_VST3Common.h"

#ifndef JUCE_VST3_CAN_REPLACE_VST2
Expand Down Expand Up @@ -849,6 +850,8 @@ class JuceVST3EditController : public Vst::EditController,
setBounds (pluginEditor->getLocalBounds());
resizeHostWindow();
}

ignoreUnused (fakeMouseGenerator);
}

~ContentWrapperComponent()
Expand Down Expand Up @@ -910,6 +913,7 @@ class JuceVST3EditController : public Vst::EditController,

private:
JuceVST3Editor& owner;
FakeMouseMoveGenerator fakeMouseGenerator;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ContentWrapperComponent)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
#ifndef JUCE_FAKEMOUSEMOVEGENERATOR_H_INCLUDED
#define JUCE_FAKEMOUSEMOVEGENERATOR_H_INCLUDED

#if JUCE_MAC && JUCE_SUPPORT_CARBON
#if JUCE_MAC

//==============================================================================
// Helper class to workaround carbon windows not getting mouse-moves..
// Helper class to workaround windows not getting mouse-moves...
class FakeMouseMoveGenerator : private Timer
{
public:
Expand All @@ -39,7 +39,7 @@ class FakeMouseMoveGenerator : private Timer

void timerCallback() override
{
// workaround for carbon windows not getting mouse-moves..
// Workaround for windows not getting mouse-moves...
const Point<float> screenPos (Desktop::getInstance().getMainMouseSource().getScreenPosition());

if (screenPos != lastScreenPos)
Expand Down

0 comments on commit 08b2116

Please sign in to comment.