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

Prevvented ComponentPeer from trying to send the keyboard focus to components that don't want it

This commit is contained in:
jules 2018-02-07 12:35:54 +00:00
parent 506425fdbe
commit ecbc07b855

View file

@ -344,6 +344,8 @@ void ComponentPeer::handleFocusGain()
ModifierKeys::updateCurrentModifiers();
if (component.isParentOf (lastFocusedComponent))
&& lastFocusedComponent->isShowing()
&& lastFocusedComponent->getWantsKeyboardFocus())
{
Component::currentlyFocusedComponent = lastFocusedComponent;
Desktop::getInstance().triggerFocusCallback();
@ -424,7 +426,7 @@ namespace DragHelpers
{
static bool isFileDrag (const ComponentPeer::DragInfo& info)
{
return info.files.size() > 0;
return ! info.files.isEmpty();
}
static bool isSuitableTarget (const ComponentPeer::DragInfo& info, Component* target)
@ -439,7 +441,7 @@ namespace DragHelpers
: dynamic_cast<TextDragAndDropTarget*> (target)->isInterestedInTextDrag (info.text);
}
static Component* findDragAndDropTarget (Component* c, const ComponentPeer::DragInfo& info, Component* const lastOne)
static Component* findDragAndDropTarget (Component* c, const ComponentPeer::DragInfo& info, Component* lastOne)
{
for (; c != nullptr; c = c->getParentComponent())
if (isSuitableTarget (info, c) && (c == lastOne || isInterested (info, c)))
@ -453,9 +455,8 @@ bool ComponentPeer::handleDragMove (const ComponentPeer::DragInfo& info)
{
ModifierKeys::updateCurrentModifiers();
Component* const compUnderMouse = component.getComponentAt (info.position);
Component* const lastTarget = dragAndDropTargetComponent;
auto* compUnderMouse = component.getComponentAt (info.position);
auto* lastTarget = dragAndDropTargetComponent;
Component* newTarget = nullptr;
if (compUnderMouse != lastDragAndDropCompUnderMouse)