Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support video below html content.

This is activated by the "below-content" class name on the "video-view" element in the style. TV style is using it.
We can opt out if we want via a VLCFeature settings.
This is using a child window for the window view.
  • Loading branch information...
commit 57ded964caeb7b0565aebd226ac77b8cf4a0bb4f 1 parent 2fdaa66
@pdherbemont pdherbemont authored
View
2  Resources/Style/Default/base.js
@@ -218,7 +218,6 @@ windowController.mouseUpForWindowResize = function(event) {
document.removeEventListener('mousemove', windowController.mouseDraggedForWindowResize, false);
windowController.PlatformWindow().didEndLiveResize();
- windowController.windowResized();
}
windowController.mouseDraggedForWindowResize = function(event) {
@@ -229,6 +228,7 @@ windowController.mouseDraggedForWindowResize = function(event) {
var platformWindow = windowController.PlatformWindow();
platformWindow.setFrame____(mouseDownOrigin.x, mouseDownOrigin.y - dy, mouseDownSize.width + dx, mouseDownSize.height + dy);
+ windowController.windowResized();
}
// HUD autohidding
View
6 Resources/Style/TV/default.css
@@ -48,11 +48,11 @@ body {
#video .view {
position: absolute;
- background: black;
+ background: transparent;
bottom: 127px;
right: 61px;
- left: 59px;
- top: 70px;
+ left: 57px;
+ top: 68px;
}
/*
View
3  Sources/VLCFeatures.h
@@ -1,3 +1,4 @@
// Switch to enable or disable certain feature
-#define USE_STYLED_WINDOW 1
+#define SUPPORT_VIDEO_BELOW_CONTENT 1
View
1  Sources/VLCMediaDocument.m
@@ -22,7 +22,6 @@
#import "VLCMediaDocument.h"
#import "VLCStyledVideoWindowController.h"
#import "VLCVideoWindowController.h"
-#import "VLCFeatures.h"
@interface VLCMediaDocument ()
@property (readwrite,retain) VLCMediaListPlayer * mediaListPlayer;
View
9 Sources/VLCStyledVideoWindow.h
@@ -26,4 +26,13 @@
NSWindowController *_windowController;
}
+ (BOOL)debugStyledWindow;
+
+@end
+
+#ifdef SUPPORT_VIDEO_BELOW_CONTENT
+// In SL this is not the proper way to do it,
+// we have to switch to @protocol VLCStyledVideoWindow <NSWindowDelegate>
+@interface NSObject (VLCStyledVideoWindowDelegate)
+- (void)window:(NSWindow *)window didChangeAlphaValue:(CGFloat)alpha;
@end
+#endif
View
9 Sources/VLCStyledVideoWindow.m
@@ -96,6 +96,15 @@ - (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem
return [super validateUserInterfaceItem:anItem];
}
+#ifdef SUPPORT_VIDEO_BELOW_CONTENT
+- (void)setAlphaValue:(CGFloat)alpha
+{
+ [super setAlphaValue:alpha];
+ if ([_delegate respondsToSelector:@selector(window:didChangeAlphaValue:)])
+ [_delegate window:self didChangeAlphaValue:alpha];
+}
+#endif
+
#pragma mark -
#pragma mark Javascript bindings
/* Javascript bindings: We are not necessarily respecting Cocoa naming scheme convention. That's an exception */
View
5 Sources/VLCStyledVideoWindowController.m
@@ -121,6 +121,11 @@ - (void)windowDidResignMain:(NSNotification *)notification
[_styledWindowView setMainWindow:YES];
}
+- (void)window:(NSWindow *)window didChangeAlphaValue:(CGFloat)alpha
+{
+ [_styledWindowView windowDidChangeAlphaValue:alpha];
+}
+
#pragma mark -
#pragma mark First responder handler (Respond to menu)
View
5 Sources/VLCStyledVideoWindowView.h
@@ -58,10 +58,15 @@
NSTrackingArea *_contentTracking;
BOOL _wasPlayingBeforeChangingPosition;
BOOL _isUserChangingPosition;
+#ifdef SUPPORT_VIDEO_BELOW_CONTENT
NSWindow *_videoWindow;
+#endif
}
- (void)setKeyWindow:(BOOL)isKeyWindow;
- (void)setMainWindow:(BOOL)isMainWindow;
+#ifdef SUPPORT_VIDEO_BELOW_CONTENT
+- (void)windowDidChangeAlphaValue:(CGFloat)alpha;
+#endif
@end
View
16 Sources/VLCStyledVideoWindowView.m
@@ -40,9 +40,11 @@ - (void)dealloc
- (void)close
{
+#if SUPPORT_VIDEO_BELOW_CONTENT
[_videoWindow close];
[_videoWindow release];
_videoWindow = nil;
+#endif
[self removeTrackingArea:_contentTracking];
[_contentTracking release];
_contentTracking = nil;
@@ -74,6 +76,11 @@ - (void)didFinishLoadForFrame:(WebFrame *)frame
[window performSelector:@selector(invalidateShadow) withObject:self afterDelay:0.];
}
+- (void)windowDidChangeAlphaValue:(CGFloat)alpha
+{
+ [_videoWindow setAlphaValue:alpha];
+}
+
#pragma mark -
#pragma mark Core -> Javascript setters
@@ -113,8 +120,6 @@ - (void)pause
[[self mediaPlayer] pause];
}
-#define SUPPORT_VIDEO_BELOW_CONTENT 0
-
#if SUPPORT_VIDEO_BELOW_CONTENT
static NSRect screenRectForViewRect(NSView *view, NSRect rect)
{
@@ -144,21 +149,22 @@ - (void)videoDidResize
BOOL belowContent = [element.className rangeOfString:@"below-content"].length > 0;
NSWindow *window = [self window];
if (![videoView window]) {
-
+ NSAssert (!_videoWindow, @"There shouldn't be a video window at this point");
+
// Create the window now.
_videoWindow = [[NSWindow alloc] initWithContentRect:screenRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
[_videoWindow setBackgroundColor:[NSColor blackColor]];
[_videoWindow setLevel:VLCFullscreenHUDWindowLevel];
[_videoWindow setContentView:videoView];
[_videoWindow setIgnoresMouseEvents:YES];
+ [_videoWindow setHasShadow:NO];
[window addChildWindow:_videoWindow ordered:belowContent ? NSWindowBelow : NSWindowAbove];
}
else {
- //[[self window] removeChildWindow:_videoWindow];
BOOL videoWindowIsOnTop = [_videoWindow windowNumber] < [window windowNumber];
if (videoWindowIsOnTop ^ belowContent)
[window addChildWindow:_videoWindow ordered:belowContent ? NSWindowBelow : NSWindowAbove];
- [_videoWindow setFrame:screenRect display:NO];
+ [_videoWindow setFrame:screenRect display:YES];
}
#else
View
1  VLC_Prefix.pch
@@ -4,6 +4,7 @@
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
+ #import "VLCFeatures.h"
#endif
#define VLCLogDebug NSLog
Please sign in to comment.
Something went wrong with that request. Please try again.