[vlc-commits] mac plugin: hack to fix controller bar in fullscreen in firefox
Felix Paul Kühne
git at videolan.org
Mon Feb 9 22:51:06 CET 2015
npapi-vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Feb 9 22:50:01 2015 +0100| [aab8600053b156c465e5b4f5fb5d97c6fe6833b6] | committer: Felix Paul Kühne
mac plugin: hack to fix controller bar in fullscreen in firefox
For Firefox, Retina screens don't seem to exist yet, so it will give pixels instead of points
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=aab8600053b156c465e5b4f5fb5d97c6fe6833b6
---
npapi/vlcplugin_mac.h | 1 +
npapi/vlcplugin_mac.mm | 25 ++++++++++++++++++-------
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/npapi/vlcplugin_mac.h b/npapi/vlcplugin_mac.h
index c807b64..0a554e8 100644
--- a/npapi/vlcplugin_mac.h
+++ b/npapi/vlcplugin_mac.h
@@ -57,6 +57,7 @@ public:
float m_media_height;
void *_perInstanceStorage;
+ bool runningWithinFirefox;
private:
diff --git a/npapi/vlcplugin_mac.mm b/npapi/vlcplugin_mac.mm
index 5e50e35..a18ffc7 100644
--- a/npapi/vlcplugin_mac.mm
+++ b/npapi/vlcplugin_mac.mm
@@ -295,16 +295,17 @@ NPError VlcPluginMac::get_root_layer(void *value)
if (strstr(userAgent, "Safari") && strstr(userAgent, "Version/5")) {
NSLog(@"Safari 5 detected, deploying UI update timer");
[[(VLCPerInstanceStorage *)this->_perInstanceStorage browserRootLayer] performSelector:@selector(startUIUpdateTimer) withObject:nil afterDelay:1.];
- }
+ } else if (strstr(userAgent, "Firefox"))
+ this->runningWithinFirefox = true;
[(VLCPerInstanceStorage *)this->_perInstanceStorage setNoMediaLayer:[[VLCNoMediaLayer alloc] init]];
[(VLCPerInstanceStorage *)this->_perInstanceStorage noMediaLayer].opaque = 1.;
- [[(VLCPerInstanceStorage *)this->_perInstanceStorage noMediaLayer] setCppPlugin: this];
- [[(VLCPerInstanceStorage *)this->_perInstanceStorage browserRootLayer] addSublayer: [(VLCPerInstanceStorage *)this->_perInstanceStorage noMediaLayer]];
+ [[(VLCPerInstanceStorage *)this->_perInstanceStorage noMediaLayer] setCppPlugin:this];
+ [[(VLCPerInstanceStorage *)this->_perInstanceStorage browserRootLayer] addSublayer:[(VLCPerInstanceStorage *)this->_perInstanceStorage noMediaLayer]];
[(VLCPerInstanceStorage *)this->_perInstanceStorage setControllerLayer:[[VLCControllerLayer alloc] init]];
- [[(VLCPerInstanceStorage *)this->_perInstanceStorage browserRootLayer] addSublayer: [(VLCPerInstanceStorage *)this->_perInstanceStorage controllerLayer]];
- [[(VLCPerInstanceStorage *)this->_perInstanceStorage controllerLayer] setCppPlugin: this];
+ [[(VLCPerInstanceStorage *)this->_perInstanceStorage browserRootLayer] addSublayer:[(VLCPerInstanceStorage *)this->_perInstanceStorage controllerLayer]];
+ [[(VLCPerInstanceStorage *)this->_perInstanceStorage controllerLayer] setCppPlugin:this];
[[(VLCPerInstanceStorage *)this->_perInstanceStorage browserRootLayer] setNeedsDisplay];
}
@@ -961,7 +962,12 @@ bool VlcPluginMac::handle_event(void *event)
_cppPlugin->toggle_fullscreen();
else {
NSPoint point = [NSEvent mouseLocation];
- [[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage controllerLayer] handleMouseDown:[[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage browserRootLayer] convertPoint:CGPointMake(point.x, point.y) toLayer:[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage controllerLayer]]];
+ /* for Firefox, retina doesn't exist yet so it will return pixels instead of points when doing the conversation
+ * so don't convert for Firefox */
+ if (!_cppPlugin->runningWithinFirefox)
+ [[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage controllerLayer] handleMouseDown:[[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage browserRootLayer] convertPoint:CGPointMake(point.x, point.y) toLayer:[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage controllerLayer]]];
+ else
+ [[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage controllerLayer] handleMouseDown:CGPointMake(point.x, point.y)];
}
}
if ([(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage playbackLayer] != nil) {
@@ -983,7 +989,12 @@ bool VlcPluginMac::handle_event(void *event)
NSPoint point = [NSEvent mouseLocation];
NSEventType eventType = [theEvent type];
- [[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage controllerLayer] handleMouseUp:[[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage browserRootLayer] convertPoint:CGPointMake(point.x, point.y) toLayer:[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage controllerLayer]]];
+ /* for Firefox, retina doesn't exist yet so it will return pixels instead of points when doing the conversation
+ * so don't convert for Firefox */
+ if (!_cppPlugin->runningWithinFirefox)
+ [[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage controllerLayer] handleMouseUp:[[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage browserRootLayer] convertPoint:CGPointMake(point.x, point.y) toLayer:[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage controllerLayer]]];
+ else
+ [[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage controllerLayer] handleMouseUp:CGPointMake(point.x, point.y)];
if ([(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage playbackLayer] != nil) {
if ([[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage playbackLayer] respondsToSelector:@selector(mouseButtonUp:)]) {
More information about the vlc-commits
mailing list