1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Windows touch with CallOutBox bug fix

This commit is contained in:
ed 2016-08-11 11:02:04 +01:00
parent c7b347242d
commit cbdf707116
3 changed files with 24 additions and 4 deletions

View file

@ -1967,8 +1967,7 @@ private:
{
bool isCancel = false;
// touchIndex zero is reserved for the mouse
const int touchIndex = currentTouches.getIndexOfTouch (touch.dwID) + 1;
const int touchIndex = currentTouches.getIndexOfTouch (touch.dwID);
const int64 time = getMouseEventTime();
const Point<float> pos (globalToLocal (Point<float> (touch.x / 100.0f,
touch.y / 100.0f)));

View file

@ -41,7 +41,11 @@ CallOutBox::CallOutBox (Component& c, const Rectangle<int>& area, Component* con
.getDisplayContaining (area.getCentre()).userArea);
addToDesktop (ComponentPeer::windowIsTemporary);
startTimer (100);
}
creationTime = Time::getCurrentTime();
}
CallOutBox::~CallOutBox()
@ -129,7 +133,14 @@ void CallOutBox::inputAttemptWhenModal()
// if you click on the area that originally popped-up the callout, you expect it
// to get rid of the box, but deleting the box here allows the click to pass through and
// probably re-trigger it, so we need to dismiss the box asynchronously to consume the click..
dismiss();
// For touchscreens, we make sure not to dismiss the CallOutBox immediately,
// as Windows still sends touch events before the CallOutBox had a chance
// to really open.
RelativeTime elapsed = Time::getCurrentTime() - creationTime;
if (elapsed.inMilliseconds() > 200)
dismiss();
}
else
{
@ -240,3 +251,9 @@ void CallOutBox::refreshPath()
targetPoint - getPosition().toFloat(),
9.0f, arrowSize * 0.7f);
}
void CallOutBox::timerCallback()
{
toFront (true);
stopTimer();
}

View file

@ -53,7 +53,8 @@
The call-out will resize and position itself when the content changes size.
*/
class JUCE_API CallOutBox : public Component
class JUCE_API CallOutBox : public Component,
private Timer
{
public:
//==============================================================================
@ -173,7 +174,10 @@ private:
Image background;
bool dismissalMouseClicksAreAlwaysConsumed;
Time creationTime;
void refreshPath();
void timerCallback() override;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CallOutBox)
};