Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
0b001a07
Commit
0b001a07
authored
Oct 02, 2014
by
David Fuhrmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: implement native fullscreen behaviour for yosemite titlebar
parent
5647339c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
26 deletions
+106
-26
modules/gui/macosx/MainWindowTitle.h
modules/gui/macosx/MainWindowTitle.h
+11
-1
modules/gui/macosx/MainWindowTitle.m
modules/gui/macosx/MainWindowTitle.m
+81
-22
modules/gui/macosx/Windows.h
modules/gui/macosx/Windows.h
+2
-1
modules/gui/macosx/Windows.m
modules/gui/macosx/Windows.m
+12
-2
No files found.
modules/gui/macosx/MainWindowTitle.h
View file @
0b001a07
...
...
@@ -39,6 +39,10 @@
NSImage
*
o_green_img
;
NSImage
*
o_green_over_img
;
NSImage
*
o_green_on_img
;
// yosemite fullscreen images
NSImage
*
o_fullscreen_img
;
NSImage
*
o_fullscreen_over_img
;
NSImage
*
o_fullscreen_on_img
;
NSShadow
*
o_window_title_shadow
;
NSDictionary
*
o_window_title_attributes_dict
;
...
...
@@ -47,15 +51,21 @@
IBOutlet
id
o_green_btn
;
IBOutlet
id
o_fullscreen_btn
;
IBOutlet
id
o_title_lbl
;
BOOL
b_nativeFullscreenMode
;
// state to determine correct image for green bubble
BOOL
b_alt_pressed
;
BOOL
b_mouse_over
;
}
@property
(
readonly
)
NSButton
*
closeButton
;
@property
(
readonly
)
NSButton
*
minimizeButton
;
@property
(
readonly
)
NSButton
*
zoomButton
;
-
(
void
)
informModifierPressed
:(
BOOL
)
b_is_altkey
;
-
(
void
)
loadButtonIcons
;
-
(
IBAction
)
buttonAction
:(
id
)
sender
;
-
(
void
)
setWindowTitle
:(
NSString
*
)
title
;
-
(
void
)
setFullscreenButtonHidden
:(
BOOL
)
b_value
;
-
(
void
)
setWindowButtonOver
:(
BOOL
)
b_value
;
-
(
void
)
setWindowFullscreenButtonOver
:(
BOOL
)
b_value
;
...
...
modules/gui/macosx/MainWindowTitle.m
View file @
0b001a07
...
...
@@ -57,6 +57,9 @@
[
o_green_img
release
];
[
o_green_over_img
release
];
[
o_green_on_img
release
];
[
o_fullscreen_img
release
];
[
o_fullscreen_over_img
release
];
[
o_fullscreen_on_img
release
];
[
o_window_title_shadow
release
];
[
o_window_title_attributes_dict
release
];
...
...
@@ -66,6 +69,16 @@
-
(
void
)
awakeFromNib
{
b_nativeFullscreenMode
=
NO
;
#ifdef MAC_OS_X_VERSION_10_7
if
(
!
OSX_SNOW_LEOPARD
)
b_nativeFullscreenMode
=
var_InheritBool
(
VLCIntf
,
"macosx-nativefullscreenmode"
);
#endif
if
(
!
b_nativeFullscreenMode
||
OSX_YOSEMITE
)
{
[
o_fullscreen_btn
setHidden
:
YES
];
}
[
self
setAutoresizesSubviews
:
YES
];
[
self
setImagesLeft
:
imageFromRes
(
@"topbar-dark-left"
)
middle
:
imageFromRes
(
@"topbar-dark-center-fill"
)
right
:
imageFromRes
(
@"topbar-dark-right"
)];
...
...
@@ -75,16 +88,6 @@
-
(
void
)
controlTintChanged
:(
NSNotification
*
)
notification
{
[
o_red_img
release
];
[
o_red_over_img
release
];
[
o_red_on_img
release
];
[
o_yellow_img
release
];
[
o_yellow_over_img
release
];
[
o_yellow_on_img
release
];
[
o_green_img
release
];
[
o_green_over_img
release
];
[
o_green_on_img
release
];
[
self
loadButtonIcons
];
[
o_red_btn
setNeedsDisplay
];
...
...
@@ -92,6 +95,17 @@
[
o_green_btn
setNeedsDisplay
];
}
-
(
void
)
informModifierPressed
:(
BOOL
)
b_is_altkey
;
{
BOOL
b_state_changed
=
b_alt_pressed
!=
b_is_altkey
;
b_alt_pressed
=
b_is_altkey
;
if
(
b_state_changed
)
{
[
self
updateGreenButton
];
}
}
-
(
NSImage
*
)
getButtonImage
:(
NSString
*
)
o_id
{
NSString
*
o_name
=
@""
;
...
...
@@ -114,6 +128,19 @@
-
(
void
)
loadButtonIcons
{
[
o_red_img
release
];
[
o_red_over_img
release
];
[
o_red_on_img
release
];
[
o_yellow_img
release
];
[
o_yellow_over_img
release
];
[
o_yellow_on_img
release
];
[
o_green_img
release
];
[
o_green_over_img
release
];
[
o_green_on_img
release
];
[
o_fullscreen_img
release
];
[
o_fullscreen_over_img
release
];
[
o_fullscreen_on_img
release
];
o_red_img
=
[[
self
getButtonImage
:
@"window-close"
]
retain
];
o_red_over_img
=
[[
self
getButtonImage
:
@"window-close-over"
]
retain
];
o_red_on_img
=
[[
self
getButtonImage
:
@"window-close-on"
]
retain
];
...
...
@@ -124,6 +151,13 @@
o_green_over_img
=
[[
self
getButtonImage
:
@"window-zoom-over"
]
retain
];
o_green_on_img
=
[[
self
getButtonImage
:
@"window-zoom-on"
]
retain
];
// these files are only available in the yosemite variant
if
(
OSX_YOSEMITE
)
{
o_fullscreen_img
=
[[
self
getButtonImage
:
@"window-fullscreen"
]
retain
];
o_fullscreen_over_img
=
[[
self
getButtonImage
:
@"window-fullscreen-over"
]
retain
];
o_fullscreen_on_img
=
[[
self
getButtonImage
:
@"window-fullscreen-on"
]
retain
];
}
[
o_red_btn
setImage
:
o_red_img
];
[
o_red_btn
setAlternateImage
:
o_red_on_img
];
[[
o_red_btn
cell
]
setShowsBorderOnlyWhileMouseInside
:
YES
];
...
...
@@ -132,8 +166,8 @@
[
o_yellow_btn
setAlternateImage
:
o_yellow_on_img
];
[[
o_yellow_btn
cell
]
setShowsBorderOnlyWhileMouseInside
:
YES
];
[[
o_yellow_btn
cell
]
setTag
:
1
];
[
o_green_btn
setImage
:
o_green_img
];
[
o_green_btn
setAlternateImage
:
o_green_on_img
];
[
self
updateGreenButton
];
[[
o_green_btn
cell
]
setShowsBorderOnlyWhileMouseInside
:
YES
];
[[
o_green_btn
cell
]
setTag
:
2
];
[
o_fullscreen_btn
setImage
:
[
NSImage
imageNamed
:
@"window-fullscreen"
]];
...
...
@@ -142,6 +176,31 @@
[[
o_fullscreen_btn
cell
]
setTag
:
3
];
}
-
(
void
)
updateGreenButton
{
// default image for old version, or if native fullscreen is
// disabled on yosemite, or if alt key is pressed
if
(
!
OSX_YOSEMITE
||
!
b_nativeFullscreenMode
||
b_alt_pressed
)
{
if
(
b_mouse_over
)
{
[
o_green_btn
setImage
:
o_green_over_img
];
[
o_green_btn
setAlternateImage
:
o_green_on_img
];
}
else
{
[
o_green_btn
setImage
:
o_green_img
];
[
o_green_btn
setAlternateImage
:
o_green_on_img
];
}
}
else
{
if
(
b_mouse_over
)
{
[
o_green_btn
setImage
:
o_fullscreen_over_img
];
[
o_green_btn
setAlternateImage
:
o_fullscreen_on_img
];
}
else
{
[
o_green_btn
setImage
:
o_fullscreen_img
];
[
o_green_btn
setAlternateImage
:
o_fullscreen_on_img
];
}
}
}
-
(
BOOL
)
mouseDownCanMoveWindow
{
return
YES
;
...
...
@@ -153,9 +212,13 @@
[[
self
window
]
performClose
:
sender
];
else
if
(
sender
==
o_yellow_btn
)
[[
self
window
]
miniaturize
:
sender
];
else
if
(
sender
==
o_green_btn
)
[[
self
window
]
performZoom
:
sender
];
else
if
(
sender
==
o_fullscreen_btn
)
{
else
if
(
sender
==
o_green_btn
)
{
if
(
OSX_YOSEMITE
&&
b_nativeFullscreenMode
&&
!
b_alt_pressed
)
{
[[
self
window
]
toggleFullScreen
:
self
];
}
else
{
[[
self
window
]
performZoom
:
sender
];
}
}
else
if
(
sender
==
o_fullscreen_btn
)
{
// same action as native fs button
[[
self
window
]
toggleFullScreen
:
self
];
...
...
@@ -185,22 +248,18 @@
[
o_attributed_title
release
];
}
-
(
void
)
setFullscreenButtonHidden
:(
BOOL
)
b_value
{
[
o_fullscreen_btn
setHidden
:
b_value
];
}
-
(
void
)
setWindowButtonOver
:(
BOOL
)
b_value
{
b_mouse_over
=
b_value
;
if
(
b_value
)
{
[
o_red_btn
setImage
:
o_red_over_img
];
[
o_yellow_btn
setImage
:
o_yellow_over_img
];
[
o_green_btn
setImage
:
o_green_over_img
];
}
else
{
[
o_red_btn
setImage
:
o_red_img
];
[
o_yellow_btn
setImage
:
o_yellow_img
];
[
o_green_btn
setImage
:
o_green_img
];
}
[
self
updateGreenButton
];
}
-
(
void
)
setWindowFullscreenButtonOver
:(
BOOL
)
b_value
...
...
modules/gui/macosx/Windows.h
View file @
0b001a07
...
...
@@ -74,6 +74,7 @@
static
const
float
f_min_video_height
=
70
.
0
;
@class
VLCControlsBarCommon
;
@class
VLCMainWindowTitleView
;
/*****************************************************************************
* VLCVideoWindowCommon
...
...
@@ -86,7 +87,7 @@ static const float f_min_video_height = 70.0;
NSRect
previousSavedFrame
;
BOOL
b_dark_interface
;
IBOutlet
id
o_titlebar_view
;
// only set in main or detached window
IBOutlet
VLCMainWindowTitleView
*
o_titlebar_view
;
// only set in main or detached window
IBOutlet
VLCVoutView
*
o_video_view
;
IBOutlet
VLCControlsBarCommon
*
o_controls_bar
;
...
...
modules/gui/macosx/Windows.m
View file @
0b001a07
...
...
@@ -335,10 +335,9 @@
if
(
b_nativeFullscreenMode
)
{
[
self
setCollectionBehavior
:
NSWindowCollectionBehaviorFullScreenPrimary
];
}
else
{
[
o_titlebar_view
setFullscreenButtonHidden
:
YES
];
}
[
super
awakeFromNib
];
}
...
...
@@ -645,6 +644,17 @@
[
super
mouseMoved
:
theEvent
];
}
#pragma mark -
#pragma mark Key events
-
(
void
)
flagsChanged
:(
NSEvent
*
)
theEvent
{
BOOL
b_alt_pressed
=
([
theEvent
modifierFlags
]
&
NSAlternateKeyMask
)
!=
0
;
[
o_titlebar_view
informModifierPressed
:
b_alt_pressed
];
[
super
flagsChanged
:
theEvent
];
}
#pragma mark -
#pragma mark Lion native fullscreen handling
...
...
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