Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
126fb118
Commit
126fb118
authored
Jun 10, 2018
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: split windows file to have one class per file
parent
934390c9
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
280 additions
and
207 deletions
+280
-207
extras/package/macosx/VLC.xcodeproj/project.pbxproj
extras/package/macosx/VLC.xcodeproj/project.pbxproj
+22
-8
modules/gui/macosx/Makefile.am
modules/gui/macosx/Makefile.am
+2
-1
modules/gui/macosx/VLCFSPanelController.h
modules/gui/macosx/VLCFSPanelController.h
+1
-1
modules/gui/macosx/VLCMainWindow.h
modules/gui/macosx/VLCMainWindow.h
+1
-1
modules/gui/macosx/VLCVideoWindowCommon.h
modules/gui/macosx/VLCVideoWindowCommon.h
+2
-24
modules/gui/macosx/VLCVideoWindowCommon.m
modules/gui/macosx/VLCVideoWindowCommon.m
+4
-170
modules/gui/macosx/VLCWindow.h
modules/gui/macosx/VLCWindow.h
+49
-0
modules/gui/macosx/VLCWindow.m
modules/gui/macosx/VLCWindow.m
+195
-0
po/POTFILES.in
po/POTFILES.in
+4
-2
No files found.
extras/package/macosx/VLC.xcodeproj/project.pbxproj
View file @
126fb118
...
...
@@ -62,7 +62,6 @@
1C31140B1E508C8800D4DD76
/* SPInvocationGrabbing.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CCF0777A13659A8000AF19FD
/* SPInvocationGrabbing.m */
;
};
1C31140D1E508C8800D4DD76
/* SPMediaKeyTap.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CCF0777C13659A8000AF19FD
/* SPMediaKeyTap.m */
;
};
1C5716AC1F5B142200678627
/* coreaudio_common.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
1C5716AB1F5B142200678627
/* coreaudio_common.c */
;
};
1C69FDF61EAB30C7007724ED
/* Windows.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E06CF7F516020F6200C698B7
/* Windows.m */
;
};
1CAC3EE820CD1B3B00613DB2
/* VLCVideoOutputProvider.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
1CAC3EE620CD1B3B00613DB2
/* VLCVideoOutputProvider.m */
;
};
1CCC88EC2078A3D500E5626F
/* MainMenu.xib in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
6B8224091E4D2A9000833BE1
/* MainMenu.xib */
;
};
1CCC88ED2078A3D500E5626F
/* MainWindow.xib in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
6B82240A1E4D2A9000833BE1
/* MainWindow.xib */
;
};
...
...
@@ -113,6 +112,8 @@
6BF093F91EE0182B0049D8B0
/* VLCTimeField.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
6BF093F81EE0182B0049D8B0
/* VLCTimeField.m */
;
};
6BF5C5041EFE66EF008A9C12
/* VLCHUDTableView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
6BF5C5031EFE66EF008A9C12
/* VLCHUDTableView.m */
;
};
6BF5C5071EFE7E58008A9C12
/* VLCTintedImageButtonCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
6BF5C5061EFE7E58008A9C12
/* VLCTintedImageButtonCell.m */
;
};
7D2E0EDB20CD204D0033A221
/* VLCWindow.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7D2E0ED920CD204D0033A221
/* VLCWindow.m */
;
};
7D2E0EDE20CD206F0033A221
/* VLCVideoWindowCommon.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7D2E0EDD20CD206F0033A221
/* VLCVideoWindowCommon.m */
;
};
7DB40D2A20CBCEB500F63173
/* VLCMainMenu.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7DB40D2920CBCEB500F63173
/* VLCMainMenu.m */
;
};
7DB40D2D20CBCEC200F63173
/* VLCStatusBarIcon.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7DB40D2B20CBCEC200F63173
/* VLCStatusBarIcon.m */
;
};
7DB7F1EC20CC036D00C2CAED
/* AudioUnit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7DB7F1EB20CC036D00C2CAED
/* AudioUnit.framework */
;
};
...
...
@@ -395,6 +396,10 @@
6BF5C5051EFE7E58008A9C12
/* VLCTintedImageButtonCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
VLCTintedImageButtonCell.h
;
sourceTree
=
"<group>"
;
};
6BF5C5061EFE7E58008A9C12
/* VLCTintedImageButtonCell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
VLCTintedImageButtonCell.m
;
sourceTree
=
"<group>"
;
};
7D0A387820CBCC4D00D4BF3B
/* videotoolbox.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
videotoolbox.m
;
path
=
../../../modules/codec/videotoolbox.m
;
sourceTree
=
"<group>"
;
};
7D2E0ED920CD204D0033A221
/* VLCWindow.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
VLCWindow.m
;
sourceTree
=
"<group>"
;
};
7D2E0EDA20CD204D0033A221
/* VLCWindow.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
VLCWindow.h
;
sourceTree
=
"<group>"
;
};
7D2E0EDC20CD206F0033A221
/* VLCVideoWindowCommon.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
VLCVideoWindowCommon.h
;
sourceTree
=
"<group>"
;
};
7D2E0EDD20CD206F0033A221
/* VLCVideoWindowCommon.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
VLCVideoWindowCommon.m
;
sourceTree
=
"<group>"
;
};
7D5678EB1D5BA1DC002698F3
/* VLCApplication.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
VLCApplication.h
;
sourceTree
=
"<group>"
;
};
7D5678EC1D5BA1DC002698F3
/* VLCApplication.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
VLCApplication.m
;
sourceTree
=
"<group>"
;
};
7D5678EE1D5BA397002698F3
/* VLCMainWindowControlsBar.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
VLCMainWindowControlsBar.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -517,8 +522,6 @@
DCE7BD0708A5724D007B10AE
/* VLCBookmarksWindowController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
VLCBookmarksWindowController.h
;
sourceTree
=
"<group>"
;
};
E0382C00160BA09E0031D7FF
/* VLCControlsBarCommon.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
VLCControlsBarCommon.h
;
sourceTree
=
"<group>"
;
};
E0382C01160BA09E0031D7FF
/* VLCControlsBarCommon.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
VLCControlsBarCommon.m
;
sourceTree
=
"<group>"
;
};
E06CF7F416020F6200C698B7
/* Windows.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
Windows.h
;
sourceTree
=
"<group>"
;
};
E06CF7F516020F6200C698B7
/* Windows.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
Windows.m
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
...
...
@@ -918,9 +921,21 @@
name
=
"Streaming and Remote Playback"
;
sourceTree
=
"<group>"
;
};
7D2E0ED820CD201F0033A221
/* Windows */
=
{
isa
=
PBXGroup
;
children
=
(
7D2E0EDA20CD204D0033A221
/* VLCWindow.h */
,
7D2E0ED920CD204D0033A221
/* VLCWindow.m */
,
7D2E0EDC20CD206F0033A221
/* VLCVideoWindowCommon.h */
,
7D2E0EDD20CD206F0033A221
/* VLCVideoWindowCommon.m */
,
);
name
=
Windows
;
sourceTree
=
"<group>"
;
};
7D349C8920CBC5D8003359A1
/* Custom View Classes */
=
{
isa
=
PBXGroup
;
children
=
(
7D2E0ED820CD201F0033A221
/* Windows */
,
6B846FE81CF5D89500112E54
/* HUD UI Classes */
,
7D349C9E20CBC99D003359A1
/* Text Fields */
,
7D349C9F20CBC9AC003359A1
/* Further views */
,
...
...
@@ -1122,8 +1137,6 @@
7D349C9B20CBC8A6003359A1
/* Class Extensions */
=
{
isa
=
PBXGroup
;
children
=
(
E06CF7F416020F6200C698B7
/* Windows.h */
,
E06CF7F516020F6200C698B7
/* Windows.m */
,
6B4D50A51E7AB52C004479B5
/* NSScreen+VLCAdditions.h */
,
6B4D50A61E7AB52C004479B5
/* NSScreen+VLCAdditions.m */
,
6B4D50941E7A7D16004479B5
/* NSSound+VLCAdditions.h */
,
...
...
@@ -1483,7 +1496,7 @@
};
};
};
buildConfigurationList
=
C2F2A6EA09588F1B00018C74
/* Build configuration list for PBXProject "
vlc
" */
;
buildConfigurationList
=
C2F2A6EA09588F1B00018C74
/* Build configuration list for PBXProject "
VLC
" */
;
compatibilityVersion
=
"Xcode 6.3"
;
developmentRegion
=
English
;
hasScannedForEncodings
=
1
;
...
...
@@ -1539,7 +1552,6 @@
6B0AB0F11F1AC8B3003A1B4E
/* VLCSliderCell.m in Sources */
,
6B8166291EBFC34300C26F1B
/* VLCDefaultValueSlider.m in Sources */
,
6B81662A1EBFC34300C26F1B
/* VLCDefaultValueSliderCell.m in Sources */
,
1C69FDF61EAB30C7007724ED
/* Windows.m in Sources */
,
6B3BE42C1E6217CB008D098A
/* VLCImageButton.m in Sources */
,
6B4D50901E79781F004479B5
/* VLCHotkeyChangeWindow.m in Sources */
,
1C3114031E508C8800D4DD76
/* AppleRemote.m in Sources */
,
...
...
@@ -1558,6 +1570,7 @@
1C3113901E508C6900D4DD76
/* VLCHelpWindowController.m in Sources */
,
1C3113921E508C6900D4DD76
/* VLCAddonListItem.m in Sources */
,
1C3113941E508C6900D4DD76
/* VLCAddonsWindowController.m in Sources */
,
7D2E0EDE20CD206F0033A221
/* VLCVideoWindowCommon.m in Sources */
,
1C3113961E508C6900D4DD76
/* applescript.m in Sources */
,
1C3113981E508C6900D4DD76
/* VLCAudioEffectsWindowController.m in Sources */
,
6BBBF9851F7B257100B404CD
/* VLCLogMessage.m in Sources */
,
...
...
@@ -1603,6 +1616,7 @@
1C3113D71E508C6900D4DD76
/* VLCPopupPanelController.m in Sources */
,
1C3113D91E508C6900D4DD76
/* VLCSimplePrefsController.m in Sources */
,
6B2EFC601F2819F700F3C0EA
/* VLCVolumeSlider.m in Sources */
,
7D2E0EDB20CD204D0033A221
/* VLCWindow.m in Sources */
,
1C3113DB1E508C6900D4DD76
/* VLCStringUtility.m in Sources */
,
6B4D50A71E7AB52C004479B5
/* NSScreen+VLCAdditions.m in Sources */
,
1C3113DD1E508C6900D4DD76
/* VLCTrackSynchronizationWindowController.m in Sources */
,
...
...
@@ -1863,7 +1877,7 @@
defaultConfigurationIsVisible
=
0
;
defaultConfigurationName
=
Default
;
};
C2F2A6EA09588F1B00018C74
/* Build configuration list for PBXProject "
vlc
" */
=
{
C2F2A6EA09588F1B00018C74
/* Build configuration list for PBXProject "
VLC
" */
=
{
isa
=
XCConfigurationList
;
buildConfigurations
=
(
C2F2A6EB09588F1B00018C74
/* Development */
,
...
...
modules/gui/macosx/Makefile.am
View file @
126fb118
...
...
@@ -66,7 +66,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/VLCScrollingClipView.h gui/macosx/VLCScrollingClipView.m
\
gui/macosx/VLCStatusBarIcon.h gui/macosx/VLCStatusBarIcon.m
\
gui/macosx/VLCVideoOutputProvider.h gui/macosx/VLCVideoOutputProvider.m
\
gui/macosx/Windows.h gui/macosx/Windows.m
\
gui/macosx/VLCWindow.h gui/macosx/VLCWindow.m
\
gui/macosx/VLCVideoWindowCommon.h gui/macosx/VLCVideoWindowCommon.m
\
gui/macosx/VLCAudioEffectsWindowController.h gui/macosx/VLCAudioEffectsWindowController.m
\
gui/macosx/VLCBookmarksWindowController.h gui/macosx/VLCBookmarksWindowController.m
\
gui/macosx/VLCBottomBarView.h gui/macosx/VLCBottomBarView.m
\
...
...
modules/gui/macosx/VLCFSPanelController.h
View file @
126fb118
...
...
@@ -26,7 +26,7 @@
#import <Cocoa/Cocoa.h>
#import "Window
s
.h"
#import "
VLC
Window.h"
#import "VLCDefaultValueSlider.h"
#import "VLCTimeField.h"
...
...
modules/gui/macosx/VLCMainWindow.h
View file @
126fb118
...
...
@@ -30,7 +30,7 @@
#import <vlc_input.h>
#import <vlc_vout_window.h>
#import "
Windows
.h"
#import "
VLCVideoWindowCommon
.h"
#import "misc.h"
#import "VLCFSPanelController.h"
...
...
modules/gui/macosx/
Windows
.h
→
modules/gui/macosx/
VLCVideoWindowCommon
.h
View file @
126fb118
...
...
@@ -23,36 +23,14 @@
*****************************************************************************/
#import <Cocoa/Cocoa.h>
/*****************************************************************************
* VLCWindow
*
* Missing extension to NSWindow
*****************************************************************************/
#import "VLCWindow.h"
@class
VLCVoutView
;
@interface
VLCWindow
:
NSWindow
<
NSAnimationDelegate
>
@property
(
readwrite
)
BOOL
canBecomeKeyWindow
;
@property
(
readwrite
)
BOOL
canBecomeMainWindow
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasActiveVideo
;
@property
(
nonatomic
,
readwrite
)
BOOL
fullscreen
;
-
(
void
)
closeAndAnimate
:(
BOOL
)
animate
;
-
(
void
)
orderFront
:(
id
)
sender
animate
:(
BOOL
)
animate
;
-
(
void
)
orderOut
:(
id
)
sender
animate
:(
BOOL
)
animate
;
-
(
VLCVoutView
*
)
videoView
;
@end
@class
VLCControlsBarCommon
;
static
const
float
f_min_video_height
=
70
.
0
;
@class
VLCControlsBarCommon
;
/*****************************************************************************
* VLCVideoWindowCommon
*
...
...
modules/gui/macosx/
Windows
.m
→
modules/gui/macosx/
VLCVideoWindowCommon
.m
View file @
126fb118
/*****************************************************************************
* Windows.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2012-201
4
VLC authors and VideoLAN
* Copyright (C) 2012-201
8
VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
...
...
@@ -22,180 +22,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "Windows.h"
#import "VLCMain.h"
#import "VLCVideoWindowCommon.h"
#import "CompatibilityFixes.h"
#import "VLCCoreInteraction.h"
#import "VLCControlsBarCommon.h"
#import "VLCVoutView.h"
#import "CompatibilityFixes.h"
#import "VLCMainWindow.h"
#import "NSScreen+VLCAdditions.h"
/*****************************************************************************
* VLCWindow
*
* Missing extension to NSWindow
*****************************************************************************/
@interface
VLCWindow
()
{
BOOL
b_canBecomeKeyWindow
;
BOOL
b_isset_canBecomeKeyWindow
;
BOOL
b_canBecomeMainWindow
;
BOOL
b_isset_canBecomeMainWindow
;
}
@end
@implementation
VLCWindow
-
(
id
)
initWithContentRect
:(
NSRect
)
contentRect
styleMask
:(
NSWindowStyleMask
)
styleMask
backing
:(
NSBackingStoreType
)
backingType
defer
:(
BOOL
)
flag
{
self
=
[
super
initWithContentRect
:
contentRect
styleMask
:
styleMask
backing
:
backingType
defer
:
flag
];
if
(
self
)
{
/* we don't want this window to be restored on relaunch */
[
self
setRestorable
:
NO
];
}
return
self
;
}
-
(
void
)
setCanBecomeKeyWindow
:
(
BOOL
)
canBecomeKey
{
b_isset_canBecomeKeyWindow
=
YES
;
b_canBecomeKeyWindow
=
canBecomeKey
;
}
-
(
BOOL
)
canBecomeKeyWindow
{
if
(
b_isset_canBecomeKeyWindow
)
return
b_canBecomeKeyWindow
;
return
[
super
canBecomeKeyWindow
];
}
-
(
void
)
setCanBecomeMainWindow
:
(
BOOL
)
canBecomeMain
{
b_isset_canBecomeMainWindow
=
YES
;
b_canBecomeMainWindow
=
canBecomeMain
;
}
-
(
BOOL
)
canBecomeMainWindow
{
if
(
b_isset_canBecomeMainWindow
)
return
b_canBecomeMainWindow
;
return
[
super
canBecomeMainWindow
];
}
-
(
void
)
closeAndAnimate
:(
BOOL
)
animate
{
// No animation, just close
if
(
!
animate
)
{
[
super
close
];
return
;
}
// Animate window alpha value
[
self
setAlphaValue
:
1
.
0
];
__unsafe_unretained
typeof
(
self
)
this
=
self
;
[
NSAnimationContext
runAnimationGroup
:
^
(
NSAnimationContext
*
context
){
[[
NSAnimationContext
currentContext
]
setDuration
:
0
.
9
];
[[
this
animator
]
setAlphaValue
:
0
.
0
];
}
completionHandler
:
^
{
[
this
close
];
}];
}
-
(
void
)
orderOut
:(
id
)
sender
animate
:(
BOOL
)
animate
{
if
(
!
animate
)
{
[
super
orderOut
:
sender
];
return
;
}
if
([
self
alphaValue
]
==
0
.
0
)
{
[
super
orderOut
:
self
];
return
;
}
__unsafe_unretained
typeof
(
self
)
this
=
self
;
[
NSAnimationContext
runAnimationGroup
:
^
(
NSAnimationContext
*
context
){
[[
NSAnimationContext
currentContext
]
setDuration
:
0
.
5
];
[[
this
animator
]
setAlphaValue
:
0
.
0
];
}
completionHandler
:
^
{
[
this
orderOut
:
self
];
}];
}
-
(
void
)
orderFront
:(
id
)
sender
animate
:(
BOOL
)
animate
{
if
(
!
animate
)
{
[
super
orderFront
:
sender
];
[
self
setAlphaValue
:
1
.
0
];
return
;
}
if
(
!
[
self
isVisible
])
{
[
self
setAlphaValue
:
0
.
0
];
[
super
orderFront
:
sender
];
}
else
if
([
self
alphaValue
]
==
1
.
0
)
{
[
super
orderFront
:
self
];
return
;
}
[
NSAnimationContext
beginGrouping
];
[[
NSAnimationContext
currentContext
]
setDuration
:
0
.
5
];
[[
self
animator
]
setAlphaValue
:
1
.
0
];
[
NSAnimationContext
endGrouping
];
}
-
(
VLCVoutView
*
)
videoView
{
NSArray
*
o_subViews
=
[[
self
contentView
]
subviews
];
if
([
o_subViews
count
]
>
0
)
{
id
o_vout_view
=
[
o_subViews
firstObject
];
if
([
o_vout_view
class
]
==
[
VLCVoutView
class
])
return
(
VLCVoutView
*
)
o_vout_view
;
}
return
nil
;
}
-
(
NSRect
)
constrainFrameRect
:(
NSRect
)
frameRect
toScreen
:(
NSScreen
*
)
screen
{
if
(
!
screen
)
screen
=
[
self
screen
];
NSRect
screenRect
=
[
screen
frame
];
NSRect
constrainedRect
=
[
super
constrainFrameRect
:
frameRect
toScreen
:
screen
];
/*
* Ugly workaround!
* With Mavericks, there is a nasty bug resulting in grey bars on top in fullscreen mode.
* It looks like this is enforced by the os because the window is in the way for the menu bar.
*
* According to the documentation, this constraining can be changed by overwriting this
* method. But in this situation, even the received frameRect is already contrained with the
* menu bars height substracted. This case is detected here, and the full height is
* enforced again.
*
* See #9469 and radar://15583566
*/
BOOL
b_inFullscreen
=
[
self
fullscreen
]
||
([
self
respondsToSelector
:
@selector
(
inFullscreenTransition
)]
&&
[(
VLCVideoWindowCommon
*
)
self
inFullscreenTransition
]);
if
((
OSX_MAVERICKS_AND_HIGHER
&&
!
OSX_YOSEMITE_AND_HIGHER
)
&&
b_inFullscreen
&&
constrainedRect
.
size
.
width
==
screenRect
.
size
.
width
&&
constrainedRect
.
size
.
height
!=
screenRect
.
size
.
height
&&
fabs
(
screenRect
.
size
.
height
-
constrainedRect
.
size
.
height
)
<=
25
.)
{
msg_Dbg
(
getIntf
(),
"Contrain window height %.1f to screen height %.1f"
,
constrainedRect
.
size
.
height
,
screenRect
.
size
.
height
);
constrainedRect
.
size
.
height
=
screenRect
.
size
.
height
;
}
return
constrainedRect
;
}
@end
/*****************************************************************************
* VLCVideoWindowCommon
*
...
...
modules/gui/macosx/VLCWindow.h
0 → 100644
View file @
126fb118
/*****************************************************************************
* Windows.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2012-2018 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
/*****************************************************************************
* VLCWindow
*
* Missing extension to NSWindow
*****************************************************************************/
@class
VLCVoutView
;
@interface
VLCWindow
:
NSWindow
<
NSAnimationDelegate
>
@property
(
readwrite
)
BOOL
canBecomeKeyWindow
;
@property
(
readwrite
)
BOOL
canBecomeMainWindow
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasActiveVideo
;
@property
(
nonatomic
,
readwrite
)
BOOL
fullscreen
;
-
(
void
)
closeAndAnimate
:(
BOOL
)
animate
;
-
(
void
)
orderFront
:(
id
)
sender
animate
:(
BOOL
)
animate
;
-
(
void
)
orderOut
:(
id
)
sender
animate
:(
BOOL
)
animate
;
-
(
VLCVoutView
*
)
videoView
;
@end
modules/gui/macosx/VLCWindow.m
0 → 100644
View file @
126fb118
/*****************************************************************************
* Windows.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2012-2018 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "VLCMain.h"
#import "VLCWindow.h"
#import "VLCVideoWindowCommon.h"
#import "CompatibilityFixes.h"
/*****************************************************************************
* VLCWindow
*
* Missing extension to NSWindow
*****************************************************************************/
@interface
VLCWindow
()
{
BOOL
b_canBecomeKeyWindow
;
BOOL
b_isset_canBecomeKeyWindow
;
BOOL
b_canBecomeMainWindow
;
BOOL
b_isset_canBecomeMainWindow
;
}
@end
@implementation
VLCWindow
-
(
id
)
initWithContentRect
:(
NSRect
)
contentRect
styleMask
:(
NSWindowStyleMask
)
styleMask
backing
:(
NSBackingStoreType
)
backingType
defer
:(
BOOL
)
flag
{
self
=
[
super
initWithContentRect
:
contentRect
styleMask
:
styleMask
backing
:
backingType
defer
:
flag
];
if
(
self
)
{
/* we don't want this window to be restored on relaunch */
[
self
setRestorable
:
NO
];
}
return
self
;
}
-
(
void
)
setCanBecomeKeyWindow
:
(
BOOL
)
canBecomeKey
{
b_isset_canBecomeKeyWindow
=
YES
;
b_canBecomeKeyWindow
=
canBecomeKey
;
}
-
(
BOOL
)
canBecomeKeyWindow
{
if
(
b_isset_canBecomeKeyWindow
)
return
b_canBecomeKeyWindow
;
return
[
super
canBecomeKeyWindow
];
}
-
(
void
)
setCanBecomeMainWindow
:
(
BOOL
)
canBecomeMain
{
b_isset_canBecomeMainWindow
=
YES
;
b_canBecomeMainWindow
=
canBecomeMain
;
}
-
(
BOOL
)
canBecomeMainWindow
{
if
(
b_isset_canBecomeMainWindow
)
return
b_canBecomeMainWindow
;
return
[
super
canBecomeMainWindow
];
}
-
(
void
)
closeAndAnimate
:(
BOOL
)
animate
{
// No animation, just close
if
(
!
animate
)
{
[
super
close
];
return
;
}
// Animate window alpha value
[
self
setAlphaValue
:
1
.
0
];
__unsafe_unretained
typeof
(
self
)
this
=
self
;
[
NSAnimationContext
runAnimationGroup
:
^
(
NSAnimationContext
*
context
){
[[
NSAnimationContext
currentContext
]
setDuration
:
0
.
9
];
[[
this
animator
]
setAlphaValue
:
0
.
0
];
}
completionHandler
:
^
{
[
this
close
];
}];
}
-
(
void
)
orderOut
:(
id
)
sender
animate
:(
BOOL
)
animate
{
if
(
!
animate
)
{
[
super
orderOut
:
sender
];
return
;
}
if
([
self
alphaValue
]
==
0
.
0
)
{
[
super
orderOut
:
self
];
return
;
}
__unsafe_unretained
typeof
(
self
)
this
=
self
;
[
NSAnimationContext
runAnimationGroup
:
^
(
NSAnimationContext
*
context
){
[[
NSAnimationContext
currentContext
]
setDuration
:
0
.
5
];
[[
this
animator
]
setAlphaValue
:
0
.
0
];
}
completionHandler
:
^
{
[
this
orderOut
:
self
];
}];
}
-
(
void
)
orderFront
:(
id
)
sender
animate
:(
BOOL
)
animate
{
if
(
!
animate
)
{
[
super
orderFront
:
sender
];
[
self
setAlphaValue
:
1
.
0
];
return
;
}
if
(
!
[
self
isVisible
])
{
[
self
setAlphaValue
:
0
.
0
];
[
super
orderFront
:
sender
];
}
else
if
([
self
alphaValue
]
==
1
.
0
)
{
[
super
orderFront
:
self
];
return
;
}
[
NSAnimationContext
beginGrouping
];
[[
NSAnimationContext
currentContext
]
setDuration
:
0
.
5
];
[[
self
animator
]
setAlphaValue
:
1
.
0
];
[
NSAnimationContext
endGrouping
];
}
-
(
VLCVoutView
*
)
videoView
{
NSArray
*
o_subViews
=
[[
self
contentView
]
subviews
];
if
([
o_subViews
count
]
>
0
)
{
id
o_vout_view
=
[
o_subViews
firstObject
];
if
([
o_vout_view
class
]
==
[
VLCVoutView
class
])
return
(
VLCVoutView
*
)
o_vout_view
;
}
return
nil
;
}
-
(
NSRect
)
constrainFrameRect
:(
NSRect
)
frameRect
toScreen
:(
NSScreen
*
)
screen
{
if
(
!
screen
)
screen
=
[
self
screen
];
NSRect
screenRect
=
[
screen
frame
];
NSRect
constrainedRect
=
[
super
constrainFrameRect
:
frameRect
toScreen
:
screen
];
/*
* Ugly workaround!
* With Mavericks, there is a nasty bug resulting in grey bars on top in fullscreen mode.
* It looks like this is enforced by the os because the window is in the way for the menu bar.
*
* According to the documentation, this constraining can be changed by overwriting this
* method. But in this situation, even the received frameRect is already contrained with the
* menu bars height substracted. This case is detected here, and the full height is
* enforced again.
*
* See #9469 and radar://15583566
*/