Browse Source

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

tags/2021-05-28
jules 7 years ago
parent
commit
ecbc07b855
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      modules/juce_gui_basics/windows/juce_ComponentPeer.cpp

+ 6
- 5
modules/juce_gui_basics/windows/juce_ComponentPeer.cpp 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)


Loading…
Cancel
Save