Skip to content

Commit

Permalink
Merge pull request #33 from imchoi/master
Browse files Browse the repository at this point in the history
[Fix][iOS]:fix click  invaild  in home page
  • Loading branch information
hxxft authored May 9, 2018
2 parents a39c052 + d90073c commit 4a7c520
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 4 deletions.
2 changes: 1 addition & 1 deletion iOS/lynx/app/application_info.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ @implementation LynxApplicationInfo
- (id) initWithManifest:(NSDictionary*)manifest {
self = [super init];
if(self) {
_debugable = [manifest objectForKey:@"debug"];
_debugable = [[manifest objectForKey:@"debug"] boolValue];
NSDictionary* appInfo = [manifest objectForKey:@"application"];
_packageName = [appInfo objectForKey:@"packageName"];
_mainPage = [[appInfo objectForKey:@"mainPage"] stringByDeletingPathExtension];
Expand Down
58 changes: 55 additions & 3 deletions iOS/lynx/base/framerate_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,75 @@

#include "base/framerate_controller.h"

@interface LynxWeakProxy : NSProxy

@property (weak, nonatomic) id target;

+ (LynxWeakProxy*)weakProxyWithTarget:(id)target;

@end

@implementation LynxWeakProxy

+ (LynxWeakProxy*)weakProxyWithTarget:(id)target
{
LynxWeakProxy* proxy = [LynxWeakProxy alloc];
proxy.target = target;
return proxy;
}

- (BOOL)respondsToSelector:(SEL)sel
{
return [_target respondsToSelector:sel];
}

- (id)forwardingTargetForSelector:(SEL)sel
{
return _target;
}

- (void)forwardInvocation:(NSInvocation *)invocation {
[invocation invokeWithTarget:self.target];
}

- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector {
NSMethodSignature *sig;
sig = [self.target methodSignatureForSelector:aSelector];
return sig;
}

@end



@interface LynxFrameRateController ()

@property (nonatomic, strong) LynxWeakProxy * proxyTarget;

@end

@implementation LynxFrameRateController

-(instancetype)initWithVSyncListener:(RenderTreeHostImplBridge *)vsync_listener
{
self = [super init];
if (self) {
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onVSync)];
_proxyTarget = [LynxWeakProxy weakProxyWithTarget:self];
_displayLink = [CADisplayLink displayLinkWithTarget:_proxyTarget selector:@selector(onVSync)];
_vsync_listener = vsync_listener;
[_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
}
return self;
}

-(void)start
{
_displayLink.paused = NO;
[_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
}

-(void)stop
{
_displayLink.paused = YES;
[_displayLink removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
}

-(void)onVSync
Expand All @@ -34,4 +80,10 @@ -(void)onVSync
_displayLink.paused = NO;
}

-(void)dealloc
{
[_displayLink invalidate];
_displayLink = nil;
}

@end

0 comments on commit 4a7c520

Please sign in to comment.