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
8b2171ce
Commit
8b2171ce
authored
Jun 10, 2018
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: reorder mainwindow code
parent
1eb5cbd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
54 deletions
+51
-54
modules/gui/macosx/VLCMainWindow.m
modules/gui/macosx/VLCMainWindow.m
+51
-54
No files found.
modules/gui/macosx/VLCMainWindow.m
View file @
8b2171ce
...
...
@@ -45,7 +45,6 @@
#import "VLCVoutView.h"
#import "VLCVideoOutputProvider.h"
@interface
VLCMainWindow
()
<
NSWindowDelegate
,
NSAnimationDelegate
>
{
BOOL
videoPlaybackEnabled
;
...
...
@@ -57,7 +56,6 @@
NSRect
frameBeforePlayback
;
}
@end
static
const
float
f_min_window_height
=
307
.;
...
...
@@ -67,52 +65,6 @@ static const float f_min_window_height = 307.;
#pragma mark -
#pragma mark Initialization
-
(
BOOL
)
isEvent
:(
NSEvent
*
)
o_event
forKey
:(
const
char
*
)
keyString
{
char
*
key
;
NSString
*
o_key
;
key
=
config_GetPsz
(
keyString
);
o_key
=
[
NSString
stringWithFormat
:
@"%s"
,
key
];
FREENULL
(
key
);
unsigned
int
i_keyModifiers
=
[[
VLCStringUtility
sharedInstance
]
VLCModifiersToCocoa
:
o_key
];
NSString
*
characters
=
[
o_event
charactersIgnoringModifiers
];
if
([
characters
length
]
>
0
)
{
return
[[
characters
lowercaseString
]
isEqualToString
:
[[
VLCStringUtility
sharedInstance
]
VLCKeyToString
:
o_key
]]
&&
(
i_keyModifiers
&
NSShiftKeyMask
)
==
([
o_event
modifierFlags
]
&
NSShiftKeyMask
)
&&
(
i_keyModifiers
&
NSControlKeyMask
)
==
([
o_event
modifierFlags
]
&
NSControlKeyMask
)
&&
(
i_keyModifiers
&
NSAlternateKeyMask
)
==
([
o_event
modifierFlags
]
&
NSAlternateKeyMask
)
&&
(
i_keyModifiers
&
NSCommandKeyMask
)
==
([
o_event
modifierFlags
]
&
NSCommandKeyMask
);
}
return
NO
;
}
-
(
BOOL
)
performKeyEquivalent
:(
NSEvent
*
)
o_event
{
BOOL
b_force
=
NO
;
// these are key events which should be handled by vlc core, but are attached to a main menu item
if
(
!
[
self
isEvent
:
o_event
forKey
:
"key-vol-up"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-vol-down"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-vol-mute"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-prev"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-next"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-jump+short"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-jump-short"
])
{
/* We indeed want to prioritize some Cocoa key equivalent against libvlc,
so we perform the menu equivalent now. */
if
([[
NSApp
mainMenu
]
performKeyEquivalent
:
o_event
])
return
TRUE
;
}
else
b_force
=
YES
;
VLCCoreInteraction
*
coreInteraction
=
[
VLCCoreInteraction
sharedInstance
];
return
[
coreInteraction
hasDefinedShortcutKey
:
o_event
force
:
b_force
]
||
[
coreInteraction
keyEvent
:
o_event
];
}
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
...
...
@@ -129,7 +81,6 @@ static const float f_min_window_height = 307.;
NSNotificationCenter
*
defaultCenter
=
[
NSNotificationCenter
defaultCenter
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
[
self
setDelegate
:
self
];
[
self
setRestorable
:
NO
];
[
self
setExcludedFromWindowsMenu
:
YES
];
...
...
@@ -145,10 +96,6 @@ static const float f_min_window_height = 307.;
// Window title
[
self
setTitle
:
_NS
(
"VLC media player"
)];
/* interface builder action */
CGFloat
f_threshold_height
=
f_min_video_height
+
[
self
.
controlsBar
height
];
// Set that here as IB seems to be buggy
[
self
setContentMinSize
:
NSMakeSize
(
604
.,
f_min_window_height
)];
...
...
@@ -187,6 +134,56 @@ static const float f_min_window_height = 307.;
[
self
.
controlsBar
setFullscreenState
:
YES
];
}
#pragma mark - key and event handling
-
(
BOOL
)
isEvent
:(
NSEvent
*
)
o_event
forKey
:(
const
char
*
)
keyString
{
char
*
key
;
NSString
*
o_key
;
key
=
config_GetPsz
(
keyString
);
o_key
=
[
NSString
stringWithFormat
:
@"%s"
,
key
];
FREENULL
(
key
);
unsigned
int
i_keyModifiers
=
[[
VLCStringUtility
sharedInstance
]
VLCModifiersToCocoa
:
o_key
];
NSString
*
characters
=
[
o_event
charactersIgnoringModifiers
];
if
([
characters
length
]
>
0
)
{
return
[[
characters
lowercaseString
]
isEqualToString
:
[[
VLCStringUtility
sharedInstance
]
VLCKeyToString
:
o_key
]]
&&
(
i_keyModifiers
&
NSShiftKeyMask
)
==
([
o_event
modifierFlags
]
&
NSShiftKeyMask
)
&&
(
i_keyModifiers
&
NSControlKeyMask
)
==
([
o_event
modifierFlags
]
&
NSControlKeyMask
)
&&
(
i_keyModifiers
&
NSAlternateKeyMask
)
==
([
o_event
modifierFlags
]
&
NSAlternateKeyMask
)
&&
(
i_keyModifiers
&
NSCommandKeyMask
)
==
([
o_event
modifierFlags
]
&
NSCommandKeyMask
);
}
return
NO
;
}
-
(
BOOL
)
performKeyEquivalent
:(
NSEvent
*
)
o_event
{
BOOL
b_force
=
NO
;
// these are key events which should be handled by vlc core, but are attached to a main menu item
if
(
!
[
self
isEvent
:
o_event
forKey
:
"key-vol-up"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-vol-down"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-vol-mute"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-prev"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-next"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-jump+short"
]
&&
!
[
self
isEvent
:
o_event
forKey
:
"key-jump-short"
])
{
/* We indeed want to prioritize some Cocoa key equivalent against libvlc,
so we perform the menu equivalent now. */
if
([[
NSApp
mainMenu
]
performKeyEquivalent
:
o_event
])
return
TRUE
;
}
else
b_force
=
YES
;
VLCCoreInteraction
*
coreInteraction
=
[
VLCCoreInteraction
sharedInstance
];
return
[
coreInteraction
hasDefinedShortcutKey
:
o_event
force
:
b_force
]
||
[
coreInteraction
keyEvent
:
o_event
];
}
#pragma mark - data view vs video output handling
-
(
void
)
makeCollectionViewVisible
{
[
self
setContentMinSize
:
NSMakeSize
(
604
.,
f_min_window_height
)];
...
...
@@ -320,7 +317,7 @@ static const float f_min_window_height = 307.;
}
#pragma mark -
#pragma mark overwritten default functionality
#pragma mark overwritten default
window
functionality
-
(
void
)
windowResizedOrMoved
:(
NSNotification
*
)
notification
{
...
...
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