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
c1a89c64
Commit
c1a89c64
authored
Jul 13, 2008
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: Fix aspect ratio.
This might requires some other adjustements.
parent
4ad2f8dc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
22 deletions
+55
-22
modules/gui/macosx/embeddedwindow.h
modules/gui/macosx/embeddedwindow.h
+4
-0
modules/gui/macosx/embeddedwindow.m
modules/gui/macosx/embeddedwindow.m
+22
-0
modules/gui/macosx/vout.m
modules/gui/macosx/vout.m
+29
-22
No files found.
modules/gui/macosx/embeddedwindow.h
View file @
c1a89c64
...
...
@@ -51,6 +51,8 @@
NSRecursiveLock
*
o_animation_lock
;
BOOL
b_window_is_invisible
;
NSSize
videoRatio
;
}
-
(
void
)
controlTintChanged
;
...
...
@@ -59,6 +61,8 @@
-
(
void
)
playStatusUpdated
:
(
int
)
i_status
;
-
(
void
)
setSeekable
:
(
BOOL
)
b_seekable
;
-
(
void
)
setVideoRatio
:(
NSSize
)
ratio
;
-
(
NSView
*
)
mainView
;
-
(
BOOL
)
isFullscreen
;
...
...
modules/gui/macosx/embeddedwindow.m
View file @
c1a89c64
...
...
@@ -70,9 +70,12 @@
[
o_btn_fullscreen
setState
:
NO
];
b_fullscreen
=
NO
;
[
self
setDelegate
:
self
];
/* Make sure setVisible: returns NO */
[
self
orderOut
:
self
];
b_window_is_invisible
=
YES
;
videoRatio
=
NSMakeSize
(
0
.,
0
.
);
}
-
(
void
)
controlTintChanged
...
...
@@ -167,6 +170,25 @@
return
o_view
;
}
-
(
void
)
setVideoRatio
:(
NSSize
)
ratio
{
videoRatio
=
ratio
;
}
-
(
NSSize
)
windowWillResize
:(
NSWindow
*
)
window
toSize
:(
NSSize
)
proposedFrameSize
{
if
(
videoRatio
.
height
==
0
.
||
videoRatio
.
width
==
0
.
)
return
proposedFrameSize
;
NSRect
viewRect
=
[
o_view
convertRect
:[
o_view
bounds
]
toView
:
nil
];
NSRect
contentRect
=
[
self
contentRectForFrameRect
:[
self
frame
]];
float
marginy
=
viewRect
.
origin
.
y
+
[
self
frame
].
size
.
height
-
contentRect
.
size
.
height
;
float
marginx
=
contentRect
.
size
.
width
-
viewRect
.
size
.
width
;
proposedFrameSize
.
height
=
(
proposedFrameSize
.
width
-
marginx
)
*
videoRatio
.
height
/
videoRatio
.
width
+
marginy
;
return
proposedFrameSize
;
}
/*****************************************************************************
* Fullscreen support
*/
...
...
modules/gui/macosx/vout.m
View file @
c1a89c64
...
...
@@ -343,20 +343,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
}
}
-
(
void
)
scaleWindowWithFactor
:
(
float
)
factor
animate
:
(
BOOL
)
animate
-
(
NSSize
)
voutSizeForFactor
:
(
float
)
factor
{
NSSize
newsize
;
int
i_corrected_height
,
i_corrected_width
;
NSPoint
topleftbase
;
NSPoint
topleftscreen
;
if
(
!
p_vout
->
b_fullscreen
)
{
NSView
*
mainView
;
NSRect
new_frame
;
topleftbase
.
x
=
0
;
topleftbase
.
y
=
[
o_window
frame
].
size
.
height
;
topleftscreen
=
[
o_window
convertBaseToScreen
:
topleftbase
];
NSSize
newsize
;
if
(
p_vout
->
render
.
i_height
*
p_vout
->
render
.
i_aspect
>
p_vout
->
render
.
i_width
*
VOUT_ASPECT_FACTOR
)
...
...
@@ -374,6 +364,24 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
newsize
.
height
=
(
int
)
(
i_corrected_height
*
factor
);
}
return
newsize
;
}
-
(
void
)
scaleWindowWithFactor
:
(
float
)
factor
animate
:
(
BOOL
)
animate
{
if
(
!
p_vout
->
b_fullscreen
)
{
NSSize
newsize
;
NSPoint
topleftbase
;
NSPoint
topleftscreen
;
NSView
*
mainView
;
NSRect
new_frame
;
topleftbase
.
x
=
0
;
topleftbase
.
y
=
[
o_window
frame
].
size
.
height
;
topleftscreen
=
[
o_window
convertBaseToScreen
:
topleftbase
];
newsize
=
[
self
voutSizeForFactor
:
factor
];
/* In fullscreen mode we need to use a view that is different from
* ourselves, with the VLCEmbeddedWindow */
if
([
o_window
isKindOfClass
:[
VLCEmbeddedWindow
class
]])
...
...
@@ -390,8 +398,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
new_frame
.
origin
.
x
=
topleftscreen
.
x
;
new_frame
.
origin
.
y
=
topleftscreen
.
y
-
new_frame
.
size
.
height
;
[
o_window
setFrame
:
new_frame
display
:
animate
animate
:
animate
];
[
o_window
setFrame
:
new_frame
display
:
animate
animate
:
animate
];
p_vout
->
i_changes
|=
VOUT_SIZE_CHANGE
;
}
}
...
...
@@ -958,7 +965,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
[
self
scaleWindowWithFactor
:
1
.
0
animate
:
[
o_window
isVisible
]
&&
(
!
[
o_window
isFullscreen
])];
[
o_
window
setAspectRatio
:
NSMakeSize
([
o_window
frame
].
size
.
width
,
[
o_window
frame
].
size
.
height
)
];
[
o_
embeddedwindow
setVideoRatio
:[
self
voutSizeForFactor
:
1
.
0
]
];
/* Make sure our window is visible, if we are not in fullscreen */
if
(
!
[
o_window
isFullscreen
])
...
...
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