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

UIViewComponentPeer: Simplify view transition reporting

This commit is contained in:
reuk 2021-01-12 16:22:18 +00:00
parent 6c353f8d03
commit 04f2ca61e2
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -86,23 +86,6 @@ namespace Orientations
}
}
struct AsyncBoundsUpdater : public AsyncUpdater
{
AsyncBoundsUpdater (UIViewController* vc)
: viewController (vc)
{
}
~AsyncBoundsUpdater() override
{
cancelPendingUpdate();
}
void handleAsyncUpdate() override;
UIViewController* viewController;
};
//==============================================================================
} // namespace juce
@ -136,8 +119,6 @@ using namespace juce;
//==============================================================================
@interface JuceUIViewController : UIViewController
{
@public
std::unique_ptr<AsyncBoundsUpdater> boundsUpdater;
}
- (JuceUIViewController*) init;
@ -287,11 +268,6 @@ static void sendScreenBoundsUpdate (JuceUIViewController* c)
juceView->owner->updateScreenBounds();
}
void AsyncBoundsUpdater::handleAsyncUpdate()
{
sendScreenBoundsUpdate ((JuceUIViewController*) viewController);
}
static bool isKioskModeView (JuceUIViewController* c)
{
JuceUIView* juceView = (JuceUIView*) [c view];
@ -312,8 +288,6 @@ MultiTouchMapper<UITouch*> UIViewComponentPeer::currentTouches;
{
self = [super init];
boundsUpdater = std::make_unique<AsyncBoundsUpdater> (self);
return self;
}
@ -345,12 +319,10 @@ MultiTouchMapper<UITouch*> UIViewComponentPeer::currentTouches;
- (void) viewWillTransitionToSize: (CGSize) size withTransitionCoordinator: (id<UIViewControllerTransitionCoordinator>) coordinator
{
[super viewWillTransitionToSize: size withTransitionCoordinator: coordinator];
sendScreenBoundsUpdate (self);
// On some devices the screen-size isn't yet updated at this point, so also trigger another
// async update to double-check..
if (boundsUpdater != nullptr)
boundsUpdater->triggerAsyncUpdate();
[coordinator animateAlongsideTransition: nil completion: ^void (id<UIViewControllerTransitionCoordinatorContext>)
{
sendScreenBoundsUpdate (self);
}];
}
- (BOOL) prefersStatusBarHidden
@ -580,8 +552,6 @@ UIViewComponentPeer::~UIViewComponentPeer()
currentTouches.deleteAllTouchesForPeer (this);
Desktop::getInstance().removeFocusChangeListener (this);
((JuceUIViewController*) controller)->boundsUpdater = nullptr;
view->owner = nullptr;
[view removeFromSuperview];
[view release];