Commit 41f6ced2 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: resizing fixes for the minimized state. additionally, make sure we...

macosx: resizing fixes for the minimized state. additionally, make sure we restore the state last present on quit. (close #6122)
(cherry picked from commit fa9bc462)
parent f80f7642
...@@ -21,16 +21,16 @@ ...@@ -21,16 +21,16 @@
</object> </object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<integer value="4722"/> <integer value="2770"/>
<integer value="4850"/> <integer value="21"/>
<integer value="1617"/>
<integer value="283"/> <integer value="283"/>
<integer value="4722"/>
<integer value="915"/>
<integer value="29"/>
<integer value="4596"/> <integer value="4596"/>
<integer value="1617"/>
<integer value="2730"/> <integer value="2730"/>
<integer value="29"/> <integer value="4850"/>
<integer value="2770"/>
<integer value="4682"/>
<integer value="915"/>
</object> </object>
<object class="NSArray" key="IBDocument.PluginDependencies"> <object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
<nil key="NSViewClass"/> <nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/> <nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string> <string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSWindowContentMinSize">{604, 310}</string>
<object class="NSView" key="NSWindowView" id="429932428"> <object class="NSView" key="NSWindowView" id="429932428">
<reference key="NSNextResponder"/> <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int> <int key="NSvFlags">256</int>
...@@ -342,6 +341,39 @@ ...@@ -342,6 +341,39 @@
<int key="NSMaximumRecents">10</int> <int key="NSMaximumRecents">10</int>
</object> </object>
</object> </object>
<object class="NSImageView" id="447614808">
<reference key="NSNextResponder" ref="440594360"/>
<int key="NSvFlags">266</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="set.sortedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Apple PDF pasteboard type</string>
<string>Apple PICT pasteboard type</string>
<string>Apple PNG pasteboard type</string>
<string>NSFilenamesPboardType</string>
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
<string>NeXT TIFF v4.0 pasteboard type</string>
</object>
</object>
<string key="NSFrame">{{0, 251}, {403, 23}}</string>
<reference key="NSSuperview" ref="440594360"/>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="660513772">
<int key="NSCellFlags">130560</int>
<int key="NSCellFlags2">33554432</int>
<object class="NSCustomResource" key="NSContents">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">topbar_background</string>
</object>
<int key="NSAlign">0</int>
<int key="NSScale">1</int>
<int key="NSStyle">0</int>
<bool key="NSAnimates">NO</bool>
</object>
<bool key="NSEditable">YES</bool>
</object>
<object class="NSScrollView" id="915491793"> <object class="NSScrollView" id="915491793">
<reference key="NSNextResponder" ref="440594360"/> <reference key="NSNextResponder" ref="440594360"/>
<int key="NSvFlags">4370</int> <int key="NSvFlags">4370</int>
...@@ -559,39 +591,6 @@ ...@@ -559,39 +591,6 @@
<reference key="NSHeaderClipView" ref="576307303"/> <reference key="NSHeaderClipView" ref="576307303"/>
<bytes key="NSScrollAmts">QSAAAEEgAABBiAAAQYgAAA</bytes> <bytes key="NSScrollAmts">QSAAAEEgAABBiAAAQYgAAA</bytes>
</object> </object>
<object class="NSImageView" id="447614808">
<reference key="NSNextResponder" ref="440594360"/>
<int key="NSvFlags">266</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="set.sortedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Apple PDF pasteboard type</string>
<string>Apple PICT pasteboard type</string>
<string>Apple PNG pasteboard type</string>
<string>NSFilenamesPboardType</string>
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
<string>NeXT TIFF v4.0 pasteboard type</string>
</object>
</object>
<string key="NSFrame">{{0, 251}, {403, 23}}</string>
<reference key="NSSuperview" ref="440594360"/>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="660513772">
<int key="NSCellFlags">130560</int>
<int key="NSCellFlags2">33554432</int>
<object class="NSCustomResource" key="NSContents">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">topbar_background</string>
</object>
<int key="NSAlign">0</int>
<int key="NSScale">1</int>
<int key="NSStyle">0</int>
<bool key="NSAnimates">NO</bool>
</object>
<bool key="NSEditable">YES</bool>
</object>
</object> </object>
<string key="NSFrame">{{201, 0}, {403, 274}}</string> <string key="NSFrame">{{201, 0}, {403, 274}}</string>
<reference key="NSSuperview" ref="302568132"/> <reference key="NSSuperview" ref="302568132"/>
...@@ -1151,7 +1150,6 @@ ...@@ -1151,7 +1150,6 @@
<int key="NSViewLayerContentsRedrawPolicy">2</int> <int key="NSViewLayerContentsRedrawPolicy">2</int>
</object> </object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string> <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMinSize">{604, 332}</string>
<string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string> <string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSFrameAutosaveName">mainwindow</string> <string key="NSFrameAutosaveName">mainwindow</string>
<bool key="NSWindowIsRestorable">YES</bool> <bool key="NSWindowIsRestorable">YES</bool>
...@@ -11207,8 +11205,8 @@ LCAuLi4</string> ...@@ -11207,8 +11205,8 @@ LCAuLi4</string>
<string>{{364, 446}, {604, 310}}</string> <string>{{364, 446}, {604, 310}}</string>
<boolean value="YES"/> <boolean value="YES"/>
<boolean value="NO"/> <boolean value="NO"/>
<boolean value="YES"/> <boolean value="NO"/>
<string>{604, 310}</string> <string>{604, 36}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/> <boolean value="YES"/>
<string>{{816, 490}, {64, 6}}</string> <string>{{816, 490}, {64, 6}}</string>
......
...@@ -142,6 +142,8 @@ ...@@ -142,6 +142,8 @@
- (void)showDropZone; - (void)showDropZone;
- (void)hideDropZone; - (void)hideDropZone;
- (void)showSplitView;
- (void)hideSplitView;
- (void)updateTimeSlider; - (void)updateTimeSlider;
- (void)updateVolumeSlider; - (void)updateVolumeSlider;
- (void)updateWindow; - (void)updateWindow;
......
...@@ -122,6 +122,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -122,6 +122,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)awakeFromNib - (void)awakeFromNib
{ {
BOOL b_splitviewShouldBeHidden = NO;
/* setup the styled interface */ /* setup the styled interface */
b_nativeFullscreenMode = NO; b_nativeFullscreenMode = NO;
#ifdef MAC_OS_X_VERSION_10_7 #ifdef MAC_OS_X_VERSION_10_7
...@@ -244,6 +245,8 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -244,6 +245,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_volume_up_btn setEnabled: b_mute]; [o_volume_up_btn setEnabled: b_mute];
/* interface builder action */ /* interface builder action */
if ([self frame].size.height < 100)
b_splitviewShouldBeHidden = YES;
[self setDelegate: self]; [self setDelegate: self];
[self setExcludedFromWindowsMenu: YES]; [self setExcludedFromWindowsMenu: YES];
[self setAcceptsMouseMovedEvents: YES]; [self setAcceptsMouseMovedEvents: YES];
...@@ -430,10 +433,14 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -430,10 +433,14 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_titlebar_view setFrame: NSMakeRect( 0, winrect.size.height - f_titleBarHeight, [o_titlebar_view setFrame: NSMakeRect( 0, winrect.size.height - f_titleBarHeight,
winrect.size.width, f_titleBarHeight )]; winrect.size.width, f_titleBarHeight )];
[[self contentView] addSubview: o_titlebar_view]; [[self contentView] addSubview: o_titlebar_view positioned: NSWindowAbove relativeTo: o_split_view];
if (winrect.size.height > 100)
{
[self setFrame: winrect display:YES animate:YES];
previousSavedFrame = winrect;
}
[self setFrame: winrect display:YES animate:YES];
previousSavedFrame = winrect;
winrect = [o_split_view frame]; winrect = [o_split_view frame];
winrect.size.height = winrect.size.height - f_titleBarHeight; winrect.size.height = winrect.size.height - f_titleBarHeight;
[o_split_view setFrame: winrect]; [o_split_view setFrame: winrect];
...@@ -469,6 +476,12 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -469,6 +476,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
[[VLCMain sharedInstance] playbackModeUpdated]; [[VLCMain sharedInstance] playbackModeUpdated];
if (b_splitviewShouldBeHidden)
{
i_lastSplitViewHeight = [o_split_view frame].size.height;
[self hideSplitView];
}
} }
#pragma mark - #pragma mark -
...@@ -566,7 +579,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -566,7 +579,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
NSRect plrect; NSRect plrect;
plrect = [[o_playlist_table animator] frame]; plrect = [[o_playlist_table animator] frame];
plrect.size.height = i_lastSplitViewHeight - 22.0; // actual pl top bar height, which differs from its frame plrect.size.height = i_lastSplitViewHeight - 19.0; // actual pl top bar height, which differs from its frame
[[o_playlist_table animator] setFrame: plrect]; [[o_playlist_table animator] setFrame: plrect];
} }
...@@ -574,31 +587,13 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -574,31 +587,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
if ((([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0) && !b_splitview_removed) if ((([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0) && !b_splitview_removed)
{ {
NSRect winrect = [self frame]; [self hideSplitView];
i_lastSplitViewHeight = [o_split_view frame].size.height;
winrect.size.height = winrect.size.height - i_lastSplitViewHeight;
winrect.origin.y = winrect.origin.y + i_lastSplitViewHeight;
[self setFrame: winrect display: YES animate: YES];
[self performSelector:@selector(hideDropZone) withObject:nil afterDelay:0.1];
b_splitview_removed = YES;
} }
else else
{ {
if (b_splitview_removed) if (b_splitview_removed)
{ {
NSRect winrect; [self showSplitView];
winrect = [self frame];
winrect.size.height = winrect.size.height + i_lastSplitViewHeight;
winrect.origin.y = winrect.origin.y - i_lastSplitViewHeight;
[self setFrame: winrect display: YES animate: YES];
[self performSelector:@selector(resizePlaylistAfterCollapse) withObject: nil afterDelay:0.75];
if (b_dropzone_active)
[self performSelector:@selector(showDropZone) withObject: nil afterDelay:0.3];
b_splitview_removed = NO;
return;
} }
if (b_dropzone_active && ![[VLCMain sharedInstance] activeVideoPlayback]) if (b_dropzone_active && ![[VLCMain sharedInstance] activeVideoPlayback])
...@@ -992,6 +987,49 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -992,6 +987,49 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[o_playlist_table animator] setHidden: NO]; [[o_playlist_table animator] setHidden: NO];
} }
- (void)hideSplitView
{
NSRect winrect = [self frame];
i_lastSplitViewHeight = [o_split_view frame].size.height;
winrect.size.height = winrect.size.height - i_lastSplitViewHeight;
winrect.origin.y = winrect.origin.y + i_lastSplitViewHeight;
[self setFrame: winrect display: YES animate: YES];
[self performSelector:@selector(hideDropZone) withObject:nil afterDelay:0.1];
if (b_dark_interface)
{
[self setContentMinSize: NSMakeSize( 604., [o_bottombar_view frame].size.height + [o_titlebar_view frame].size.height )];
[self setContentMaxSize: NSMakeSize( FLT_MAX, [o_bottombar_view frame].size.height + [o_titlebar_view frame].size.height )];
}
else
{
[self setContentMinSize: NSMakeSize( 604., [o_bottombar_view frame].size.height )];
[self setContentMaxSize: NSMakeSize( FLT_MAX, [o_bottombar_view frame].size.height )];
}
if (i_lastSplitViewHeight < 100)
i_lastSplitViewHeight = 300; // random reasonable size
b_splitview_removed = YES;
}
- (void)showSplitView
{
if (b_dark_interface)
[self setContentMinSize:NSMakeSize( 604., 288. + [o_titlebar_view frame].size.height )];
else
[self setContentMinSize:NSMakeSize( 604., 288. )];
[self setContentMaxSize: NSMakeSize( FLT_MAX, FLT_MAX )];
NSRect winrect;
winrect = [self frame];
winrect.size.height = winrect.size.height + i_lastSplitViewHeight;
winrect.origin.y = winrect.origin.y - i_lastSplitViewHeight;
[self setFrame: winrect display: YES animate: YES];
[self performSelector:@selector(resizePlaylistAfterCollapse) withObject: nil afterDelay:0.75];
[self performSelector:@selector(updateWindow) withObject: nil afterDelay:0.3];
b_splitview_removed = NO;
}
- (void)updateTimeSlider - (void)updateTimeSlider
{ {
input_thread_t * p_input; input_thread_t * p_input;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment