Browse Source

Changes for win32 modal component mouse events (toolbar customisation fix)

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
fb80724977
4 changed files with 3242 additions and 3234 deletions
  1. +9
    -5
      src/gui/components/juce_Component.cpp
  2. +5
    -3
      src/gui/components/juce_ModalComponentManager.cpp
  3. +1
    -1
      src/gui/components/juce_ModalComponentManager.h
  4. +3227
    -3225
      src/native/windows/juce_win32_Windowing.cpp

+ 9
- 5
src/gui/components/juce_Component.cpp View File

@@ -1012,6 +1012,10 @@ void Component::setBounds (const int x, const int y, int w, int h)
else if (! flags.hasHeavyweightPeerFlag)
repaintParent();
}
else
{
bufferedImage = Image::null;
}
if (flags.hasHeavyweightPeerFlag)
{
@@ -1642,10 +1646,8 @@ bool Component::isCurrentlyBlockedByAnotherModalComponent() const
{
Component* const mc = getCurrentlyModalComponent();
return mc != 0
&& mc != this
&& (! mc->isParentOf (this))
&& ! mc->canModalEventBeSentToComponent (this);
return ! (mc == 0 || mc == this || mc->isParentOf (this)
|| mc->canModalEventBeSentToComponent (this));
}
int JUCE_CALLTYPE Component::getNumCurrentlyModalComponents() throw()
@@ -2630,7 +2632,9 @@ void Component::internalBroughtToFront()
Component* const cm = getCurrentlyModalComponent();
if (cm != 0 && cm->getTopLevelComponent() != getTopLevelComponent())
ModalComponentManager::getInstance()->bringModalComponentsToFront();
ModalComponentManager::getInstance()->bringModalComponentsToFront (false); // very important that this is false, otherwise in win32,
// non-front components can't get focus when another modal comp is
// active, and therefore can't receive mouse-clicks
}
void Component::focusGained (FocusChangeType)


+ 5
- 3
src/gui/components/juce_ModalComponentManager.cpp View File

@@ -208,7 +208,7 @@ void ModalComponentManager::handleAsyncUpdate()
}
}
void ModalComponentManager::bringModalComponentsToFront()
void ModalComponentManager::bringModalComponentsToFront (bool topOneShouldGrabFocus)
{
ComponentPeer* lastOne = 0;
@@ -225,8 +225,10 @@ void ModalComponentManager::bringModalComponentsToFront()
{
if (lastOne == 0)
{
peer->toFront (true);
peer->grabFocus();
peer->toFront (topOneShouldGrabFocus);
if (topOneShouldGrabFocus)
peer->grabFocus();
}
else
peer->toBehind (lastOne);


+ 1
- 1
src/gui/components/juce_ModalComponentManager.h View File

@@ -110,7 +110,7 @@ public:
void attachCallback (Component* component, Callback* callback);
/** Brings any modal components to the front. */
void bringModalComponentsToFront();
void bringModalComponentsToFront (bool topOneShouldGrabFocus = true);
#if JUCE_MODAL_LOOPS_PERMITTED
/** Runs the event loop until the currently topmost modal component is dismissed, and


+ 3227
- 3225
src/native/windows/juce_win32_Windowing.cpp
File diff suppressed because it is too large
View File


Loading…
Cancel
Save