Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
74fd152d
Commit
74fd152d
authored
Mar 02, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Zoom fullscreen effect on Mac OS X 10.4.
parent
bfae05be
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
3235 additions
and
2820 deletions
+3235
-2820
extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
...s/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
+1
-0
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
+2
-2
extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib
...OSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib
+2729
-2693
modules/gui/macosx/controls.m
modules/gui/macosx/controls.m
+2
-2
modules/gui/macosx/embeddedwindow.h
modules/gui/macosx/embeddedwindow.h
+13
-1
modules/gui/macosx/embeddedwindow.m
modules/gui/macosx/embeddedwindow.m
+278
-8
modules/gui/macosx/extended.m
modules/gui/macosx/extended.m
+1
-1
modules/gui/macosx/interaction.m
modules/gui/macosx/interaction.m
+1
-1
modules/gui/macosx/intf.m
modules/gui/macosx/intf.m
+0
-2
modules/gui/macosx/misc.h
modules/gui/macosx/misc.h
+16
-0
modules/gui/macosx/misc.m
modules/gui/macosx/misc.m
+30
-0
modules/gui/macosx/vout.h
modules/gui/macosx/vout.h
+12
-3
modules/gui/macosx/vout.m
modules/gui/macosx/vout.m
+33
-9
modules/gui/macosx/voutgl.m
modules/gui/macosx/voutgl.m
+42
-31
modules/gui/macosx/voutqt.m
modules/gui/macosx/voutqt.m
+75
-67
No files found.
extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
View file @
74fd152d
...
...
@@ -67,6 +67,7 @@
"o_btn_play" = id;
"o_slider" = id;
"o_time" = id;
"o_view" = id;
};
SUPERCLASS = NSWindow;
},
...
...
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
View file @
74fd152d
...
...
@@ -25,10 +25,10 @@
<array/>
<key>
IBOpenObjects
</key>
<array>
<integer>
29
</integer>
<integer>
21
</integer>
<integer>
2769
</integer>
<integer>
2730
</integer>
<integer>
29
</integer>
<integer>
2769
</integer>
</array>
<key>
IBSystem Version
</key>
<string>
8L2127
</string>
...
...
extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib
View file @
74fd152d
This source diff could not be displayed because it is too large. You can
view the blob
instead.
modules/gui/macosx/controls.m
View file @
74fd152d
...
...
@@ -99,7 +99,7 @@
o_vout_view
=
[
o_embedded_vout_list
getViewForWindow
:
o_window
];
}
/* We have a detached vout */
else
if
(
[[
o_window
className
]
isEqualToString
:
@"VLCWindow"
]
)
else
if
(
[[
o_window
className
]
isEqualToString
:
@"VLC
Vout
Window"
]
)
{
msg_Dbg
(
VLCIntf
,
"detached vout controls.m call getVoutView"
);
o_vout_view
=
[
o_window
getVoutView
];
...
...
@@ -894,7 +894,7 @@
while
(
(
o_window
=
[
o_enumerator
nextObject
]))
{
if
(
[[
o_window
className
]
isEqualToString
:
@"VLCWindow"
]
||
if
(
[[
o_window
className
]
isEqualToString
:
@"VLC
Vout
Window"
]
||
[[[
VLCMain
sharedInstance
]
getEmbeddedList
]
windowContainsEmbedded:
o_window
])
{
...
...
modules/gui/macosx/embeddedwindow.h
View file @
74fd152d
...
...
@@ -25,6 +25,7 @@
* VLCEmbeddedWindow interface
*****************************************************************************/
#import "misc.h"
@interface
VLCEmbeddedWindow
:
NSWindow
{
...
...
@@ -34,6 +35,7 @@
IBOutlet
id
o_btn_play
;
IBOutlet
id
o_slider
;
IBOutlet
id
o_time
;
IBOutlet
id
o_view
;
NSImage
*
o_img_play
;
NSImage
*
o_img_play_pressed
;
...
...
@@ -41,12 +43,22 @@
NSImage
*
o_img_pause_pressed
;
NSRect
o_saved_frame
;
VLCWindow
*
o_fullscreen_window
;
NSViewAnimation
*
o_fullscreen_anim1
;
NSViewAnimation
*
o_fullscreen_anim2
;
NSView
*
o_temp_view
;
}
-
(
void
)
setTime
:(
NSString
*
)
o_arg_ime
position
:(
float
)
f_position
;
-
(
void
)
playStatusUpdated
:(
int
)
i_status
;
-
(
void
)
setSeekable
:(
BOOL
)
b_seekable
;
-
(
void
)
setFullscreen
:(
BOOL
)
b_fullscreen
;
-
(
void
)
enterFullscreen
;
-
(
void
)
leaveFullscreen
;
/* private */
-
(
void
)
hasEndedFullscreen
;
-
(
void
)
hasBecomeFullscreen
;
@end
modules/gui/macosx/embeddedwindow.m
View file @
74fd152d
...
...
@@ -25,9 +25,14 @@
* Preamble
*****************************************************************************/
#include "intf.h"
#include "vout.h"
#include "embeddedwindow.h"
/* DisableScreenUpdates, SetSystemUIMode, ... */
#import <QuickTime/QuickTime.h>
#import "intf.h"
#import "controls.h"
#import "vout.h"
#import "embeddedwindow.h"
#import "fspanel.h"
/*****************************************************************************
* VLCEmbeddedWindow Implementation
...
...
@@ -51,6 +56,16 @@
o_img_pause_pressed
=
[
NSImage
imageNamed
:
@"pause_embedded_blue"
];
o_saved_frame
=
NSMakeRect
(
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
);
/* Useful to save o_view frame in fullscreen mode */
o_temp_view
=
[[
NSView
alloc
]
init
];
[
o_temp_view
setAutoresizingMask
:
NSViewHeightSizable
|
NSViewWidthSizable
];
o_fullscreen_window
=
nil
;
o_fullscreen_anim1
=
o_fullscreen_anim2
=
nil
;
/* Not fullscreen when we wake up */
[
o_btn_fullscreen
setState
:
NO
];
}
-
(
void
)
setTime
:(
NSString
*
)
o_arg_time
position
:(
float
)
f_position
...
...
@@ -82,11 +97,6 @@
[
o_slider
setEnabled
:
b_seekable
];
}
-
(
void
)
setFullscreen
:(
BOOL
)
b_fullscreen
{
[
o_btn_fullscreen
setState
:
b_fullscreen
];
}
-
(
void
)
zoom
:(
id
)
sender
{
if
(
!
[
self
isZoomed
]
)
...
...
@@ -116,4 +126,264 @@
return
YES
;
}
/*****************************************************************************
* Fullscreen support
*/
-
(
void
)
enterFullscreen
{
NSMutableDictionary
*
dict1
,
*
dict2
;
NSScreen
*
screen
;
NSRect
screen_rect
;
NSRect
rect
;
vout_thread_t
*
p_vout
=
vlc_object_find
(
VLCIntf
,
VLC_OBJECT_VOUT
,
FIND_ANYWHERE
);
BOOL
blackout_other_displays
=
var_GetBool
(
p_vout
,
"macosx-black"
);
/* We should get the screen pointed by var_GetInteger( p_vout, "video-device" ) */
screen
=
[
self
screen
];
vlc_object_release
(
p_vout
);
screen_rect
=
[
screen
frame
];
[
o_btn_fullscreen
setState
:
YES
];
[
NSCursor
setHiddenUntilMouseMoves
:
YES
];
if
(
blackout_other_displays
)
;
/* We should do something like [screen blackoutOtherScreens]; */
/* Only create the o_fullscreen_window if we are not in the middle of the zooming animation */
if
(
!
o_fullscreen_window
)
{
/* We can't change the styleMask of an already created NSWindow, so we create an other window, and do eye catching stuff */
rect
=
[[
o_view
superview
]
convertRect
:
[
o_view
frame
]
toView
:
nil
];
/* Convert to Window base coord */
rect
.
origin
.
x
+=
[
self
frame
].
origin
.
x
;
rect
.
origin
.
y
+=
[
self
frame
].
origin
.
y
;
o_fullscreen_window
=
[[
VLCWindow
alloc
]
initWithContentRect
:
rect
styleMask
:
NSBorderlessWindowMask
backing
:
NSBackingStoreBuffered
defer
:
YES
];
[
o_fullscreen_window
setBackgroundColor
:
[
NSColor
blackColor
]];
[
o_fullscreen_window
setCanBecomeKeyWindow
:
YES
];
if
(
!
[
self
isVisible
]
||
[
self
alphaValue
]
==
0
.
0
||
MACOS_VERSION
<
10
.
4
f
)
{
/* We don't animate if we are not visible or if we are running on
* Mac OS X <10.4 which doesn't support NSAnimation, instead we
* simply fade the display */
CGDisplayFadeReservationToken
token
;
[
o_fullscreen_window
setFrame
:
screen_rect
display
:
NO
];
CGAcquireDisplayFadeReservation
(
kCGMaxDisplayReservationInterval
,
&
token
);
CGDisplayFade
(
token
,
0
.
3
,
kCGDisplayBlendNormal
,
kCGDisplayBlendSolidColor
,
0
,
0
,
0
,
YES
);
if
(
screen
==
[
NSScreen
mainScreen
])
SetSystemUIMode
(
kUIModeAllHidden
,
kUIOptionAutoShowMenuBar
);
[[
self
contentView
]
replaceSubview
:
o_view
with
:
o_temp_view
];
[
o_temp_view
setFrame
:[
o_view
frame
]];
[
o_fullscreen_window
setContentView
:
o_view
];
[
o_fullscreen_window
makeKeyAndOrderFront
:
self
];
[
self
orderOut
:
self
];
CGDisplayFade
(
token
,
0
.
5
,
kCGDisplayBlendSolidColor
,
kCGDisplayBlendNormal
,
0
,
0
,
0
,
NO
);
CGReleaseDisplayFadeReservation
(
token
);
[
self
hasBecomeFullscreen
];
return
;
}
/* Make sure we don't see the o_view disappearing of the screen during this operation */
DisableScreenUpdates
();
[[
self
contentView
]
replaceSubview
:
o_view
with
:
o_temp_view
];
[
o_temp_view
setFrame
:[
o_view
frame
]];
[
o_fullscreen_window
setContentView
:
o_view
];
[
o_fullscreen_window
makeKeyAndOrderFront
:
self
];
EnableScreenUpdates
();
}
if
(
MACOS_VERSION
<
10
.
4
f
)
{
/* We were already fullscreen nothing to do when NSAnimation
* is not supported */
return
;
}
if
(
o_fullscreen_anim1
)
{
[
o_fullscreen_anim1
stopAnimation
];
[
o_fullscreen_anim1
release
];
}
if
(
o_fullscreen_anim2
)
{
[
o_fullscreen_anim2
stopAnimation
];
[
o_fullscreen_anim2
release
];
}
if
(
screen
==
[
NSScreen
mainScreen
])
SetSystemUIMode
(
kUIModeAllHidden
,
kUIOptionAutoShowMenuBar
);
dict1
=
[[
NSMutableDictionary
alloc
]
initWithCapacity
:
2
];
dict2
=
[[
NSMutableDictionary
alloc
]
initWithCapacity
:
3
];
[
dict1
setObject
:
self
forKey
:
NSViewAnimationTargetKey
];
[
dict1
setObject
:
NSViewAnimationFadeOutEffect
forKey
:
NSViewAnimationEffectKey
];
[
dict2
setObject
:
o_fullscreen_window
forKey
:
NSViewAnimationTargetKey
];
[
dict2
setObject
:[
NSValue
valueWithRect
:[
o_fullscreen_window
frame
]]
forKey
:
NSViewAnimationStartFrameKey
];
[
dict2
setObject
:[
NSValue
valueWithRect
:
screen_rect
]
forKey
:
NSViewAnimationEndFrameKey
];
/* Strategy with NSAnimation allocation:
- Keep at most 2 animation at a time
- leaveFullscreen/enterFullscreen are the only responsible for releasing and alloc-ing
*/
o_fullscreen_anim1
=
[[
NSViewAnimation
alloc
]
initWithViewAnimations
:[
NSArray
arrayWithObjects
:
dict1
,
nil
]];
o_fullscreen_anim2
=
[[
NSViewAnimation
alloc
]
initWithViewAnimations
:[
NSArray
arrayWithObjects
:
dict2
,
nil
]];
[
dict1
release
];
[
dict2
release
];
[
o_fullscreen_anim1
setAnimationBlockingMode
:
NSAnimationNonblocking
];
[
o_fullscreen_anim1
setDuration
:
0
.
3
];
[
o_fullscreen_anim1
setFrameRate
:
30
];
[
o_fullscreen_anim2
setAnimationBlockingMode
:
NSAnimationNonblocking
];
[
o_fullscreen_anim2
setDuration
:
0
.
2
];
[
o_fullscreen_anim2
setFrameRate
:
30
];
[
o_fullscreen_anim2
setDelegate
:
self
];
[
o_fullscreen_anim2
startWhenAnimation
:
o_fullscreen_anim1
reachesProgress
:
1
.
0
];
[
o_fullscreen_anim1
startAnimation
];
}
-
(
void
)
hasBecomeFullscreen
{
[
o_fullscreen_window
makeFirstResponder
:
[[[
VLCMain
sharedInstance
]
getControls
]
getVoutView
]];
[
o_fullscreen_window
makeKeyWindow
];
[
o_fullscreen_window
setAcceptsMouseMovedEvents
:
TRUE
];
/* tell the fspanel to move itself to front next time it's triggered */
[[[[
VLCMain
sharedInstance
]
getControls
]
getFSPanel
]
setVoutWasUpdated
:
0
/* Get this right */
];
[[[[
VLCMain
sharedInstance
]
getControls
]
getFSPanel
]
setActive
:
nil
];
}
-
(
void
)
leaveFullscreen
{
NSMutableDictionary
*
dict1
,
*
dict2
;
NSRect
frame
;
[
o_btn_fullscreen
setState
:
NO
];
/* Don't do anything if o_fullscreen_window is already closed */
if
(
!
o_fullscreen_window
)
return
;
if
(
MACOS_VERSION
<
10
.
4
f
)
{
/* We don't animate if we are not visible or if we are running on
* Mac OS X <10.4 which doesn't support NSAnimation, instead we
* simply fade the display */
CGDisplayFadeReservationToken
token
;
CGAcquireDisplayFadeReservation
(
kCGMaxDisplayReservationInterval
,
&
token
);
CGDisplayFade
(
token
,
0
.
3
,
kCGDisplayBlendNormal
,
kCGDisplayBlendSolidColor
,
0
,
0
,
0
,
YES
);
[[[[
VLCMain
sharedInstance
]
getControls
]
getFSPanel
]
setNonActive
:
nil
];
SetSystemUIMode
(
kUIModeNormal
,
kUIOptionAutoShowMenuBar
);
[
self
makeKeyAndOrderFront
:
self
];
[
self
hasEndedFullscreen
];
CGDisplayFade
(
token
,
0
.
5
,
kCGDisplayBlendSolidColor
,
kCGDisplayBlendNormal
,
0
,
0
,
0
,
NO
);
CGReleaseDisplayFadeReservation
(
token
);
return
;
}
[[[[
VLCMain
sharedInstance
]
getControls
]
getFSPanel
]
setNonActive
:
nil
];
SetSystemUIMode
(
kUIModeNormal
,
kUIOptionAutoShowMenuBar
);
if
(
o_fullscreen_anim1
)
{
[
o_fullscreen_anim1
stopAnimation
];
[
o_fullscreen_anim1
release
];
}
if
(
o_fullscreen_anim2
)
{
[
o_fullscreen_anim2
stopAnimation
];
[
o_fullscreen_anim2
release
];
}
frame
=
[[
o_temp_view
superview
]
convertRect
:
[
o_temp_view
frame
]
toView
:
nil
];
/* Convert to Window base coord */
frame
.
origin
.
x
+=
[
self
frame
].
origin
.
x
;
frame
.
origin
.
y
+=
[
self
frame
].
origin
.
y
;
dict2
=
[[
NSMutableDictionary
alloc
]
initWithCapacity
:
2
];
[
dict2
setObject
:
self
forKey
:
NSViewAnimationTargetKey
];
[
dict2
setObject
:
NSViewAnimationFadeInEffect
forKey
:
NSViewAnimationEffectKey
];
o_fullscreen_anim2
=
[[
NSViewAnimation
alloc
]
initWithViewAnimations
:[
NSArray
arrayWithObjects
:
dict2
,
nil
]];
[
dict2
release
];
[
o_fullscreen_anim2
setAnimationBlockingMode
:
NSAnimationNonblocking
];
[
o_fullscreen_anim2
setDuration
:
0
.
3
];
[
o_fullscreen_anim2
setFrameRate
:
30
];
[
o_fullscreen_anim2
setDelegate
:
self
];
dict1
=
[[
NSMutableDictionary
alloc
]
initWithCapacity
:
3
];
[
dict1
setObject
:
o_fullscreen_window
forKey
:
NSViewAnimationTargetKey
];
[
dict1
setObject
:[
NSValue
valueWithRect
:[
o_fullscreen_window
frame
]]
forKey
:
NSViewAnimationStartFrameKey
];
[
dict1
setObject
:[
NSValue
valueWithRect
:
frame
]
forKey
:
NSViewAnimationEndFrameKey
];
o_fullscreen_anim1
=
[[
NSViewAnimation
alloc
]
initWithViewAnimations
:[
NSArray
arrayWithObjects
:
dict1
,
nil
]];
[
dict1
release
];
[
o_fullscreen_anim1
setAnimationBlockingMode
:
NSAnimationNonblocking
];
[
o_fullscreen_anim1
setDuration
:
0
.
2
];
[
o_fullscreen_anim1
setFrameRate
:
30
];
[
o_fullscreen_anim2
startWhenAnimation
:
o_fullscreen_anim1
reachesProgress
:
1
.
0
];
[
o_fullscreen_anim1
startAnimation
];
}
-
(
void
)
hasEndedFullscreen
{
/* This function is private and should be only triggered at the end of the fullscreen change animation */
/* Make sure we don't see the o_view disappearing of the screen during this operation */
DisableScreenUpdates
();
[
o_view
retain
];
[
o_view
removeFromSuperviewWithoutNeedingDisplay
];
[[
self
contentView
]
replaceSubview
:
o_temp_view
with
:
o_view
];
[
o_view
release
];
[
o_view
setFrame
:[
o_temp_view
frame
]];
[
self
makeKeyAndOrderFront
:
self
];
[
o_fullscreen_window
orderOut
:
self
];
EnableScreenUpdates
();
[
o_fullscreen_window
release
];
o_fullscreen_window
=
nil
;
}
-
(
void
)
animationDidEnd
:(
NSAnimation
*
)
animation
{
NSArray
*
viewAnimations
;
if
([
animation
currentValue
]
<
1
.
0
)
return
;
/* Fullscreen ended or started (we are a delegate only for leaveFullscreen's/enterFullscren's anim2) */
viewAnimations
=
[
o_fullscreen_anim2
viewAnimations
];
if
([
viewAnimations
count
]
>=
1
&&
[[[
viewAnimations
objectAtIndex
:
0
]
objectForKey
:
NSViewAnimationEffectKey
]
isEqualToString
:
NSViewAnimationFadeInEffect
])
{
/* Fullscreen ended */
[
self
hasEndedFullscreen
];
}
else
{
/* Fullscreen started */
[
self
hasBecomeFullscreen
];
}
}
@end
modules/gui/macosx/extended.m
View file @
74fd152d
...
...
@@ -381,7 +381,7 @@ static VLCExtended *_o_sharedInstance = nil;
while
((
o_window
=
[
o_enumerator
nextObject
]))
{
if
(
[[
o_window
className
]
isEqualToString
:
@"VLCWindow"
]
||
if
(
[[
o_window
className
]
isEqualToString
:
@"VLC
Vout
Window"
]
||
[[[
VLCMain
sharedInstance
]
getEmbeddedList
]
windowContainsEmbedded:
o_window
])
{
...
...
modules/gui/macosx/interaction.m
View file @
74fd152d
...
...
@@ -159,7 +159,7 @@
while
(
(
o_window
=
[
o_enum
nextObject
]
)
)
{
if
(
[[
o_window
className
]
isEqualToString
:
@"VLCWindow"
]
)
if
(
[[
o_window
className
]
isEqualToString
:
@"VLC
Vout
Window"
]
)
{
vlc_object_release
(
(
vlc_object_t
*
)
p_vout
);
break
;
...
...
modules/gui/macosx/intf.m
View file @
74fd152d
...
...
@@ -472,8 +472,6 @@ static VLCMain *_o_sharedMainInstance = nil;
var_AddCallback
(
p_playlist
,
"fullscreen"
,
FullscreenChanged
,
self
);
var_AddCallback
(
p_playlist
,
"intf-show"
,
ShowController
,
self
);
[
o_embedded_window
setFullscreen
:
var_GetBool
(
p_playlist
,
"fullscreen"
)];
vlc_object_release
(
p_playlist
);
var_Create
(
p_intf
,
"interaction"
,
VLC_VAR_ADDRESS
);
...
...
modules/gui/macosx/misc.h
View file @
74fd152d
...
...
@@ -21,6 +21,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* VLCWindow
*
* Missing extension to NSWindow
*****************************************************************************/
@interface
VLCWindow
:
NSWindow
{
BOOL
b_canBecomeKeyWindow
;
BOOL
b_isset_canBecomeKeyWindow
;
}
-
(
void
)
setCanBecomeKeyWindow
:
(
BOOL
)
canBecomeKey
;
@end
/*****************************************************************************
* VLCControllerWindow
*****************************************************************************/
...
...
modules/gui/macosx/misc.m
View file @
74fd152d
...
...
@@ -28,6 +28,36 @@
#include "playlist.h"
#include "controls.h"
/*****************************************************************************
* VLCWindow
*
* Missing extension to NSWindow
*****************************************************************************/
@implementation
VLCWindow
-
(
id
)
initWithContentRect
:(
NSRect
)
contentRect
styleMask
:(
unsigned
int
)
styleMask
backing
:(
NSBackingStoreType
)
backingType
defer
:(
BOOL
)
flag
{
self
=
[
super
initWithContentRect
:
contentRect
styleMask
:
styleMask
backing
:
backingType
defer
:
flag
];
if
(
self
)
b_isset_canBecomeKeyWindow
=
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
];
}
@end
/*****************************************************************************
* VLCControllerWindow
*****************************************************************************/
...
...
modules/gui/macosx/vout.h
View file @
74fd152d
...
...
@@ -44,12 +44,17 @@
/*****************************************************************************
* VLCVoutView interface
*****************************************************************************/
@protocol
VLCVoutViewResetting
+
(
void
)
resetVout
:
(
vout_thread_t
*
)
p_vout
;
@end
@interface
VLCVoutView
:
NSView
{
vout_thread_t
*
p_vout
;
NSView
*
o_view
;
NSRect
*
s_frame
;
NSView
<
VLCVoutViewResetting
>
*
o_view
;
vout_thread_t
*
p_real_vout
;
id
o_window
;
}
...
...
@@ -70,6 +75,8 @@
frame
:
(
NSRect
*
)
s_frame
;
+
(
vout_thread_t
*
)
getRealVout
:
(
vout_thread_t
*
)
p_vout
;
-
(
void
)
enterFullscreen
;
-
(
void
)
leaveFullscreen
;
@end
/*****************************************************************************
...
...
@@ -102,17 +109,19 @@
/*****************************************************************************
* VLCDetachedEmbeddedView interface
*****************************************************************************/
@class
VLCEmbeddedWindow
;
@interface
VLCDetachedEmbeddedVoutView
:
VLCEmbeddedVoutView
{
id
o_embeddedwindow
;
}
@end
/*****************************************************************************
* VLCWindow interface
* VLC
Vout
Window interface
*****************************************************************************/
@interface
VLCWindow
:
NSWindow
@interface
VLC
Vout
Window
:
NSWindow
{
vout_thread_t
*
p_vout
;
VLCVoutView
*
o_view
;
...
...
modules/gui/macosx/vout.m
View file @
74fd152d
...
...
@@ -43,6 +43,7 @@
#include "fspanel.h"
#include "vout.h"
#import "controls.h"
#import "embeddedwindow.h"
/*****************************************************************************
* DeviceCallback: Callback triggered when the video-device variable is changed
...
...
@@ -113,9 +114,9 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
-
(
BOOL
)
windowContainsEmbedded
:
(
id
)
o_window
{
/* if( ![[o_window className] isEqualToString: @"VLCWindow"] )
/* if( ![[o_window className] isEqualToString: @"VLC
Vout
Window"] )
{
NSLog( @"We were not given a VLCWindow" );
NSLog( @"We were not given a VLC
Vout
Window" );
}*/
return
([
self
getViewForWindow
:
o_window
]
==
nil
?
NO
:
YES
);
}
...
...
@@ -392,10 +393,6 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
var_Get
(
p_real_vout
,
"fullscreen"
,
&
val
);
val
.
b_bool
=
!
val
.
b_bool
;
var_Set
(
p_real_vout
,
"fullscreen"
,
val
);
if
(
[
self
isFullscreen
]
)
[[[[
VLCMain
sharedInstance
]
getControls
]
getFSPanel
]
setActive
:
nil
];
else
[[[[
VLCMain
sharedInstance
]
getControls
]
getFSPanel
]
setNonActive
:
nil
];
}
-
(
BOOL
)
isFullscreen
...
...
@@ -732,6 +729,18 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
return
o_return
;
}
-
(
void
)
enterFullscreen
{
[[
o_view
class
]
resetVout
:
p_vout
];
[[[[
VLCMain
sharedInstance
]
getControls
]
getFSPanel
]
setActive
:
nil
];
}
-
(
void
)
leaveFullscreen
{
[[
o_view
class
]
resetVout
:
p_vout
];
[[[[
VLCMain
sharedInstance
]
getControls
]
getFSPanel
]
setNonActive
:
nil
];
}
@end
/*****************************************************************************
...
...
@@ -751,7 +760,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
{
BOOL
b_return
=
[
super
setVout
:
p_arg_vout
subView
:
view
frame
:
s_arg_frame
];
i_time_mouse_last_moved
=
mdate
();
o_window
=
[[
VLCWindow
alloc
]
initWithVout
:
p_arg_vout
view
:
self
o_window
=
[[
VLC
Vout
Window
alloc
]
initWithVout
:
p_arg_vout
view
:
self
frame:
s_arg_frame
];
[
self
updateTitle
];
[
view
setFrame
:
[
self
frame
]];
...
...
@@ -875,6 +884,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
@end
@implementation
VLCDetachedEmbeddedVoutView
-
(
void
)
awakeFromNib
{
o_embeddedwindow
=
[
self
window
];
}
-
(
BOOL
)
setVout
:
(
vout_thread_t
*
)
p_arg_vout
subView
:
(
NSView
*
)
view
frame
:
(
NSRect
*
)
s_arg_frame
...
...
@@ -897,12 +910,23 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
[
super
closeVout
];
}
-
(
void
)
enterFullscreen
{
/* We are in a VLCEmbeddedWindow */
[
o_embeddedwindow
performSelectorOnMainThread
:
@selector
(
enterFullscreen
)
withObject
:
NULL
waitUntilDone
:
YES
];
}
-
(
void
)
leaveFullscreen
{
/* We are in a VLCEmbeddedWindow */
[
o_embeddedwindow
performSelectorOnMainThread
:
@selector
(
leaveFullscreen
)
withObject
:
NULL
waitUntilDone
:
YES
];
}
@end
/*****************************************************************************
* VLCWindow implementation
* VLC
Vout
Window implementation
*****************************************************************************/
@implementation
VLCWindow
@implementation
VLC
Vout
Window
-
(
id
)
initWithVout
:
(
vout_thread_t
*
)
vout
view
:
(
VLCVoutView
*
)
view
frame
:
(
NSRect
*
)
frame
...
...
modules/gui/macosx/voutgl.m
View file @
74fd152d
...
...
@@ -44,13 +44,14 @@
#include <AGL/agl.h>
/*****************************************************************************
* VLCView interface
* VLC
GL
View interface
*****************************************************************************/
@interface
VLCGLView
:
NSOpenGLView
@interface
VLCGLView
:
NSOpenGLView
<
VLCVoutViewResetting
>
{
vout_thread_t
*
p_vout
;
}
+
(
void
)
resetVout
:
(
vout_thread_t
*
)
p_vout
;
-
(
id
)
initWithVout
:
(
vout_thread_t
*
)
p_vout
;
@end
...
...
@@ -241,38 +242,12 @@ static int Manage( vout_thread_t * p_vout )
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
if
(
!
p_vout
->
b_fullscreen
)
{
/* Save window size and position */
p_vout
->
p_sys
->
s_frame
.
size
=
[
p_vout
->
p_sys
->
o_vout_view
frame
].
size
;
p_vout
->
p_sys
->
s_frame
.
origin
=
[[
p_vout
->
p_sys
->
o_vout_view
getWindow
]
frame
].
origin
;
p_vout
->
p_sys
->
b_saved_frame
=
VLC_TRUE
;
}
[
p_vout
->
p_sys
->
o_vout_view
closeVout
];
p_vout
->
b_fullscreen
=
!
p_vout
->
b_fullscreen
;
#define o_glview p_vout->p_sys->o_glview
o_glview
=
[[
VLCGLView
alloc
]
initWithVout
:
p_vout
];
[
o_glview
autorelease
];
if
(
p_vout
->
p_sys
->
b_saved_frame
)
{
p_vout
->
p_sys
->
o_vout_view
=
[
VLCVoutView
getVoutView
:
p_vout
subView:
o_glview
frame:
&
p_vout
->
p_sys
->
s_frame
];
}
if
(
p_vout
->
b_fullscreen
)
[
p_vout
->
p_sys
->
o_vout_view
enterFullscreen
];
else
{
p_vout
->
p_sys
->
o_vout_view
=
[
VLCVoutView
getVoutView
:
p_vout
subView:
o_glview
frame
:
nil
];
}
[[
o_glview
openGLContext
]
makeCurrentContext
];
#undef o_glview
[
p_vout
->
p_sys
->
o_vout_view
leaveFullscreen
];
[
o_pool
release
];
...
...
@@ -327,6 +302,42 @@ static void Unlock( vout_thread_t * p_vout )
*****************************************************************************/
@implementation
VLCGLView
/* This function will reset the o_vout_view. It's useful to go fullscreen. */
+
(
void
)
resetVout
:
(
vout_thread_t
*
)
p_vout
{
if
(
p_vout
->
b_fullscreen
)
{
/* Save window size and position */
p_vout
->
p_sys
->
s_frame
.
size
=
[
p_vout
->
p_sys
->
o_vout_view
frame
].
size
;
p_vout
->
p_sys
->
s_frame
.
origin
=
[[
p_vout
->
p_sys
->
o_vout_view
getWindow
]
frame
].
origin
;
p_vout
->
p_sys
->
b_saved_frame
=
VLC_TRUE
;
}
[
p_vout
->
p_sys
->
o_vout_view
closeVout
];
#define o_glview p_vout->p_sys->o_glview
o_glview
=
[[
VLCGLView
alloc
]
initWithVout
:
p_vout
];
[
o_glview
autorelease
];
if
(
p_vout
->
p_sys
->
b_saved_frame
)
{
p_vout
->
p_sys
->
o_vout_view
=
[
VLCVoutView
getVoutView
:
p_vout
subView:
o_glview
frame:
&
p_vout
->
p_sys
->
s_frame
];
}
else
{
p_vout
->
p_sys
->
o_vout_view
=
[
VLCVoutView
getVoutView
:
p_vout
subView:
o_glview
frame
:
nil
];
}
[[
o_glview
openGLContext
]
makeCurrentContext
];
#undef o_glview
}
-
(
id
)
initWithVout
:
(
vout_thread_t
*
)
vout
{
p_vout
=
vout
;
...
...
modules/gui/macosx/voutqt.m
View file @
74fd152d
...
...
@@ -46,13 +46,13 @@
/*****************************************************************************
* VLCView interface
*****************************************************************************/
@interface
VLCQTView
:
NSQuickDrawView
@interface
VLCQTView
:
NSQuickDrawView
<
VLCVoutViewResetting
>
{
vout_thread_t
*
p_vout
;
}
+
(
void
)
resetVout
:
(
vout_thread_t
*
)
p_vout
;
-
(
id
)
initWithVout
:(
vout_thread_t
*
)
p_vout
;
@end
struct
vout_sys_t
...
...
@@ -479,74 +479,12 @@ static int CoToggleFullscreen( vout_thread_t *p_vout )
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
QTDestroySequence
(
p_vout
);
if
(
!
p_vout
->
b_fullscreen
)
{
if
(
!
p_vout
->
p_sys
->
b_embedded
)
{
/* Save window size and position */
p_vout
->
p_sys
->
s_frame
.
size
=
[
p_vout
->
p_sys
->
o_vout_view
frame
].
size
;
p_vout
->
p_sys
->
s_frame
.
origin
=
[[
p_vout
->
p_sys
->
o_vout_view
getWindow
]
frame
].
origin
;
p_vout
->
p_sys
->
b_saved_frame
=
VLC_TRUE
;
}
else
{
var_DelCallback
(
p_vout
->
p_libvlc
,
"drawableredraw"
,
DrawableRedraw
,
p_vout
);
DisposeRgn
(
p_vout
->
p_sys
->
clip_mask
);
}
}
[
p_vout
->
p_sys
->
o_vout_view
closeVout
];
p_vout
->
b_fullscreen
=
!
p_vout
->
b_fullscreen
;
if
(
p_vout
->
b_fullscreen
||
!
p_vout
->
p_sys
->
b_embedded
)
{
Rect
s_rect
;
p_vout
->
p_sys
->
clip_mask
=
NULL
;
#define o_qtview p_vout->p_sys->o_qtview
o_qtview
=
[[
VLCQTView
alloc
]
initWithVout
:
p_vout
];
[
o_qtview
autorelease
];
if
(
p_vout
->
p_sys
->
b_saved_frame
)
{
p_vout
->
p_sys
->
o_vout_view
=
[
VLCVoutView
getVoutView
:
p_vout
subView:
o_qtview
frame:
&
p_vout
->
p_sys
->
s_frame
];
}
else
{
p_vout
->
p_sys
->
o_vout_view
=
[
VLCVoutView
getVoutView
:
p_vout
subView:
o_qtview
frame
:
nil
];
}
/* Retrieve the QuickDraw port */
[
o_qtview
lockFocus
];
p_vout
->
p_sys
->
p_qdport
=
[
o_qtview
qdPort
];
[
o_qtview
unlockFocus
];
#undef o_qtview
GetPortBounds
(
p_vout
->
p_sys
->
p_qdport
,
&
s_rect
);
p_vout
->
p_sys
->
i_origx
=
s_rect
.
left
;
p_vout
->
p_sys
->
i_origy
=
s_rect
.
top
;
p_vout
->
p_sys
->
i_width
=
s_rect
.
right
-
s_rect
.
left
;
p_vout
->
p_sys
->
i_height
=
s_rect
.
bottom
-
s_rect
.
top
;
}
if
(
p_vout
->
b_fullscreen
)
[
p_vout
->
p_sys
->
o_vout_view
enterFullscreen
];
else
{
/* Create the clipping mask */
p_vout
->
p_sys
->
clip_mask
=
NewRgn
();
UpdateEmbeddedGeometry
(
p_vout
);
var_AddCallback
(
p_vout
->
p_libvlc
,
"drawableredraw"
,
DrawableRedraw
,
p_vout
);
}
QTScaleMatrix
(
p_vout
);
if
(
QTCreateSequence
(
p_vout
)
)
{
msg_Err
(
p_vout
,
"unable to initialize QT: QTCreateSequence failed"
);
return
(
1
);
}
[
p_vout
->
p_sys
->
o_vout_view
leaveFullscreen
];
[
o_pool
release
];
return
0
;
...
...
@@ -862,6 +800,76 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
*****************************************************************************/
@implementation
VLCQTView
/* This function will reset the o_vout_view. It's useful to go fullscreen. */
+
(
void
)
resetVout
:
(
vout_thread_t
*
)
p_vout
{
QTDestroySequence
(
p_vout
);
if
(
p_vout
->
b_fullscreen
)
{
if
(
!
p_vout
->
p_sys
->
b_embedded
)
{
/* Save window size and position */
p_vout
->
p_sys
->
s_frame
.
size
=
[
p_vout
->
p_sys
->
o_vout_view
frame
].
size
;
p_vout
->
p_sys
->
s_frame
.
origin
=
[[
p_vout
->
p_sys
->
o_vout_view
getWindow
]
frame
].
origin
;
p_vout
->
p_sys
->
b_saved_frame
=
VLC_TRUE
;
}
else
{
var_DelCallback
(
p_vout
->
p_libvlc
,
"drawableredraw"
,
DrawableRedraw
,
p_vout
);
DisposeRgn
(
p_vout
->
p_sys
->
clip_mask
);
}
}
if
(
p_vout
->
b_fullscreen
||
!
p_vout
->
p_sys
->
b_embedded
)
{
Rect
s_rect
;
p_vout
->
p_sys
->
clip_mask
=
NULL
;
#define o_qtview p_vout->p_sys->o_qtview
o_qtview
=
[[
VLCQTView
alloc
]
initWithVout
:
p_vout
];
[
o_qtview
autorelease
];
if
(
p_vout
->
p_sys
->
b_saved_frame
)
{
p_vout
->
p_sys
->
o_vout_view
=
[
VLCVoutView
getVoutView
:
p_vout
subView:
o_qtview
frame:
&
p_vout
->
p_sys
->
s_frame
];
}
else
{
p_vout
->
p_sys
->
o_vout_view
=
[
VLCVoutView
getVoutView
:
p_vout
subView:
o_qtview
frame
:
nil
];
}
/* Retrieve the QuickDraw port */
[
o_qtview
lockFocus
];
p_vout
->
p_sys
->
p_qdport
=
[
o_qtview
qdPort
];
[
o_qtview
unlockFocus
];
#undef o_qtview
GetPortBounds
(
p_vout
->
p_sys
->
p_qdport
,
&
s_rect
);
p_vout
->
p_sys
->
i_origx
=
s_rect
.
left
;
p_vout
->
p_sys
->
i_origy
=
s_rect
.
top
;
p_vout
->
p_sys
->
i_width
=
s_rect
.
right
-
s_rect
.
left
;
p_vout
->
p_sys
->
i_height
=
s_rect
.
bottom
-
s_rect
.
top
;
}
else
{
/* Create the clipping mask */
p_vout
->
p_sys
->
clip_mask
=
NewRgn
();
UpdateEmbeddedGeometry
(
p_vout
);
var_AddCallback
(
p_vout
->
p_libvlc
,
"drawableredraw"
,
DrawableRedraw
,
p_vout
);
}
QTScaleMatrix
(
p_vout
);
if
(
QTCreateSequence
(
p_vout
)
)
{
msg_Err
(
p_vout
,
"unable to initialize QT: QTCreateSequence failed"
);
return
;
}
}
-
(
id
)
initWithVout
:(
vout_thread_t
*
)
_p_vout
{
p_vout
=
_p_vout
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment