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
5289253f
Commit
5289253f
authored
Jul 21, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: fix extension rendering and clean the code a bit
parent
985ad1a4
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
102 deletions
+69
-102
modules/gui/macosx/ExtensionsDialogProvider.h
modules/gui/macosx/ExtensionsDialogProvider.h
+1
-4
modules/gui/macosx/ExtensionsDialogProvider.m
modules/gui/macosx/ExtensionsDialogProvider.m
+32
-47
modules/gui/macosx/ExtensionsManager.h
modules/gui/macosx/ExtensionsManager.h
+1
-2
modules/gui/macosx/ExtensionsManager.m
modules/gui/macosx/ExtensionsManager.m
+29
-26
modules/gui/macosx/InputManager.m
modules/gui/macosx/InputManager.m
+1
-1
modules/gui/macosx/MainMenu.m
modules/gui/macosx/MainMenu.m
+5
-22
No files found.
modules/gui/macosx/ExtensionsDialogProvider.h
View file @
5289253f
...
@@ -38,10 +38,7 @@
...
@@ -38,10 +38,7 @@
*****************************************************************************/
*****************************************************************************/
@interface
ExtensionsDialogProvider
:
NSObject
<
NSWindowDelegate
>
@interface
ExtensionsDialogProvider
:
NSObject
<
NSWindowDelegate
>
+
(
ExtensionsDialogProvider
*
)
sharedInstance
:(
intf_thread_t
*
)
_p_intf
;
+
(
ExtensionsDialogProvider
*
)
sharedInstance
;
+
(
void
)
killInstance
;
-
(
id
)
initWithIntf
:(
intf_thread_t
*
)
_p_intf
;
-
(
void
)
performEventWithObject
:
(
NSValue
*
)
o_value
ofType
:(
const
char
*
)
type
;
-
(
void
)
performEventWithObject
:
(
NSValue
*
)
o_value
ofType
:(
const
char
*
)
type
;
...
...
modules/gui/macosx/ExtensionsDialogProvider.m
View file @
5289253f
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
* VLCExtensionsDialogProvider implementation
* VLCExtensionsDialogProvider implementation
*****************************************************************************/
*****************************************************************************/
static
int
d
ialogCallback
(
vlc_object_t
*
p_this
,
const
char
*
psz_variable
,
static
int
extensionD
ialogCallback
(
vlc_object_t
*
p_this
,
const
char
*
psz_variable
,
vlc_value_t
old_val
,
vlc_value_t
new_val
,
vlc_value_t
old_val
,
vlc_value_t
new_val
,
void
*
param
);
void
*
param
);
...
@@ -155,11 +155,10 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
...
@@ -155,11 +155,10 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
// Get the web view
// Get the web view
assert
([
control
isKindOfClass
:[
WebView
class
]]);
assert
([
control
isKindOfClass
:[
WebView
class
]]);
WebView
*
webView
=
(
WebView
*
)
control
;
WebView
*
webView
=
(
WebView
*
)
control
;
NSString
*
string
=
[
NSString
stringWithUTF8String
:
widget
->
psz_text
]
;
NSString
*
string
=
toNSStr
(
widget
->
psz_text
)
;
[[
webView
mainFrame
]
loadHTMLString
:
string
baseURL
:[
NSURL
URLWithString
:
@""
]];
[[
webView
mainFrame
]
loadHTMLString
:
string
baseURL
:[
NSURL
URLWithString
:
@""
]];
[
webView
setNeedsDisplay
:
YES
];
[
webView
setNeedsDisplay
:
YES
];
break
;
break
;
}
}
case
EXTENSION_WIDGET_LABEL
:
case
EXTENSION_WIDGET_LABEL
:
case
EXTENSION_WIDGET_PASSWORD
:
case
EXTENSION_WIDGET_PASSWORD
:
...
@@ -169,7 +168,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
...
@@ -169,7 +168,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
break
;
break
;
assert
([
control
isKindOfClass
:[
NSControl
class
]]);
assert
([
control
isKindOfClass
:[
NSControl
class
]]);
NSControl
*
field
=
(
NSControl
*
)
control
;
NSControl
*
field
=
(
NSControl
*
)
control
;
NSString
*
string
=
[
NSString
stringWithCString
:
widget
->
psz_text
encoding
:
NSUTF8StringEncoding
]
;
NSString
*
string
=
toNSStr
(
widget
->
psz_text
)
;
NSAttributedString
*
attrString
=
[[
NSAttributedString
alloc
]
initWithHTML
:[
string
dataUsingEncoding
:
NSISOLatin1StringEncoding
]
documentAttributes
:
NULL
];
NSAttributedString
*
attrString
=
[[
NSAttributedString
alloc
]
initWithHTML
:[
string
dataUsingEncoding
:
NSISOLatin1StringEncoding
]
documentAttributes
:
NULL
];
[
field
setAttributedStringValue
:
attrString
];
[
field
setAttributedStringValue
:
attrString
];
break
;
break
;
...
@@ -246,7 +245,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
...
@@ -246,7 +245,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
/**
/**
* Ask the dialogs provider to create a new dialog
* Ask the dialogs provider to create a new dialog
**/
**/
static
int
d
ialogCallback
(
vlc_object_t
*
p_this
,
const
char
*
psz_variable
,
static
int
extensionD
ialogCallback
(
vlc_object_t
*
p_this
,
const
char
*
psz_variable
,
vlc_value_t
old_val
,
vlc_value_t
new_val
,
vlc_value_t
old_val
,
vlc_value_t
new_val
,
void
*
param
)
void
*
param
)
{
{
...
@@ -256,71 +255,59 @@ static int dialogCallback(vlc_object_t *p_this, const char *psz_variable,
...
@@ -256,71 +255,59 @@ static int dialogCallback(vlc_object_t *p_this, const char *psz_variable,
(
void
)
old_val
;
(
void
)
old_val
;
(
void
)
param
;
(
void
)
param
;
ExtensionsDialogProvider
*
p_edp
=
[
ExtensionsDialogProvider
sharedInstance
:(
intf_thread_t
*
)
p_this
];
ExtensionsDialogProvider
*
extensionDialogProvider
=
[
ExtensionsDialogProvider
sharedInstance
];
if
(
!
p_edp
)
if
(
!
extensionDialogProvider
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
if
(
!
new_val
.
p_address
)
if
(
!
new_val
.
p_address
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
extension_dialog_t
*
p_dialog
=
(
extension_dialog_t
*
)
new_val
.
p_address
;
extension_dialog_t
*
p_dialog
=
(
extension_dialog_t
*
)
new_val
.
p_address
;
[
p_edp
manageDialog
:
p_dialog
];
[
extensionDialogProvider
manageDialog
:
p_dialog
];
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
}
}
@interface
ExtensionsDialogProvider
()
@interface
ExtensionsDialogProvider
()
{
intf_thread_t
*
p_intf
;
}
@end
@end
@implementation
ExtensionsDialogProvider
@implementation
ExtensionsDialogProvider
static
ExtensionsDialogProvider
*
sharedInstance
=
nil
;
+
(
ExtensionsDialogProvider
*
)
sharedInstance
+
(
ExtensionsDialogProvider
*
)
sharedInstance
:(
intf_thread_t
*
)
_p_intf
{
{
static
ExtensionsDialogProvider
*
sharedInstance
=
nil
;
static
dispatch_once_t
pred
;
static
dispatch_once_t
pred
;
dispatch_once
(
&
pred
,
^
{
dispatch_once
(
&
pred
,
^
{
sharedInstance
=
[[
ExtensionsDialogProvider
alloc
]
init
WithIntf
:
_p_intf
];
sharedInstance
=
[[
ExtensionsDialogProvider
alloc
]
init
];
});
});
return
sharedInstance
;
return
sharedInstance
;
}
}
+
(
void
)
killInstance
-
(
id
)
init
{
sharedInstance
=
nil
;
}
-
(
id
)
initWithIntf
:(
intf_thread_t
*
)
_p_intf
{
{
self
=
[
super
init
];
self
=
[
super
init
];
if
(
self
)
{
if
(
self
)
{
p_intf
=
_p_intf
;
intf_thread_t
*
p_intf
=
VLCIntf
;
// The Cocoa interface already called dialog_Register()
var_Create
(
p_intf
,
"dialog-extension"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_intf
,
"dialog-extension"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_intf
,
"dialog-extension"
,
dialogCallback
,
NULL
);
var_AddCallback
(
p_intf
,
"dialog-extension"
,
extensionDialogCallback
,
(
__bridge
void
*
)
self
);
dialog_Register
(
p_intf
);
}
}
return
self
;
return
self
;
}
}
-
(
void
)
dealloc
-
(
void
)
dealloc
{
{
msg_Dbg
(
p_intf
,
"ExtensionsDialogProvider is quitting..."
)
;
intf_thread_t
*
p_intf
=
VLCIntf
;
var_DelCallback
(
p_intf
,
"dialog-extension"
,
dialogCallback
,
NULL
);
var_DelCallback
(
p_intf
,
"dialog-extension"
,
extensionDialogCallback
,
(
__bridge
void
*
)
self
);
}
}
-
(
void
)
performEventWithObject
:
(
NSValue
*
)
o_value
ofType
:
(
const
char
*
)
type
-
(
void
)
performEventWithObject
:
(
NSValue
*
)
objectValue
ofType
:
(
const
char
*
)
type
{
{
NSString
*
o_type
=
[
NSString
stringWithUTF8String
:
type
];
NSString
*
typeString
=
[
NSString
stringWithUTF8String
:
type
];
if
([
o_type
isEqualToString
:
@"dialog-extension"
])
{
if
([
typeString
isEqualToString
:
@"dialog-extension"
])
{
[
self
performSelectorOnMainThread
:
@selector
(
updateExtensionDialog
:)
[
self
performSelectorOnMainThread
:
@selector
(
updateExtensionDialog
:)
withObject:
o
_v
alue
withObject:
o
bjectV
alue
waitUntilDone:
YES
];
waitUntilDone:
YES
];
}
}
...
@@ -413,13 +400,13 @@ static ExtensionsDialogProvider *sharedInstance = nil;
...
@@ -413,13 +400,13 @@ static ExtensionsDialogProvider *sharedInstance = nil;
continue
;
/* Some widgets may be NULL@this point */
continue
;
/* Some widgets may be NULL@this point */
BOOL
shouldDestroy
=
widget
->
b_kill
;
BOOL
shouldDestroy
=
widget
->
b_kill
;
NSView
*
control
=
(
__bridge
NSView
*
)
(
widget
->
p_sys_intf
);
NSView
*
control
=
CFBridgingRelease
(
widget
->
p_sys_intf
);
BOOL
update
=
widget
->
b_update
;
BOOL
update
=
widget
->
b_update
;
if
(
!
control
&&
!
shouldDestroy
)
{
if
(
!
control
&&
!
shouldDestroy
)
{
control
=
createControlFromWidget
(
widget
,
self
);
control
=
createControlFromWidget
(
widget
,
self
);
updateControlFromWidget
(
control
,
widget
,
self
);
updateControlFromWidget
(
control
,
widget
,
self
);
widget
->
p_sys_intf
=
(
__bridge
void
*
)
(
control
);
widget
->
p_sys_intf
=
(
void
*
)
CFBridgingRetain
(
control
);
update
=
YES
;
// Force update and repositionning
update
=
YES
;
// Force update and repositionning
[
control
setHidden
:
widget
->
b_hide
];
[
control
setHidden
:
widget
->
b_hide
];
}
}
...
@@ -456,7 +443,7 @@ static ExtensionsDialogProvider *sharedInstance = nil;
...
@@ -456,7 +443,7 @@ static ExtensionsDialogProvider *sharedInstance = nil;
* Note: Lock on p_dialog->lock must be held. */
* Note: Lock on p_dialog->lock must be held. */
-
(
VLCDialogWindow
*
)
createExtensionDialog
:(
extension_dialog_t
*
)
p_dialog
-
(
VLCDialogWindow
*
)
createExtensionDialog
:(
extension_dialog_t
*
)
p_dialog
{
{
VLCDialogWindow
*
dialogWindow
=
nil
;
VLCDialogWindow
*
dialogWindow
;
BOOL
shouldDestroy
=
p_dialog
->
b_kill
;
BOOL
shouldDestroy
=
p_dialog
->
b_kill
;
if
(
!
shouldDestroy
)
{
if
(
!
shouldDestroy
)
{
...
@@ -467,13 +454,13 @@ static ExtensionsDialogProvider *sharedInstance = nil;
...
@@ -467,13 +454,13 @@ static ExtensionsDialogProvider *sharedInstance = nil;
defer:
NO
];
defer:
NO
];
[
dialogWindow
setDelegate
:
self
];
[
dialogWindow
setDelegate
:
self
];
[
dialogWindow
setDialog
:
p_dialog
];
[
dialogWindow
setDialog
:
p_dialog
];
[
dialogWindow
setTitle
:
[
NSString
stringWithUTF8String
:
p_dialog
->
psz_title
]
];
[
dialogWindow
setTitle
:
toNSStr
(
p_dialog
->
psz_title
)
];
VLCDialogGridView
*
gridView
=
[[
VLCDialogGridView
alloc
]
init
];
VLCDialogGridView
*
gridView
=
[[
VLCDialogGridView
alloc
]
init
];
[
gridView
setAutoresizingMask
:
NSViewHeightSizable
|
NSViewWidthSizable
];
[
gridView
setAutoresizingMask
:
NSViewHeightSizable
|
NSViewWidthSizable
];
[
dialogWindow
setContentView
:
gridView
];
[
dialogWindow
setContentView
:
gridView
];
p_dialog
->
p_sys_intf
=
(
__bridge
void
*
)
dialogWindow
;
p_dialog
->
p_sys_intf
=
(
void
*
)
CFBridgingRetain
(
dialogWindow
)
;
}
}
[
self
updateWidgets
:
p_dialog
];
[
self
updateWidgets
:
p_dialog
];
...
@@ -494,14 +481,13 @@ static ExtensionsDialogProvider *sharedInstance = nil;
...
@@ -494,14 +481,13 @@ static ExtensionsDialogProvider *sharedInstance = nil;
{
{
assert
(
p_dialog
);
assert
(
p_dialog
);
VLCDialogWindow
*
dialogWindow
=
(
__bridge
VLCDialogWindow
*
)
p_dialog
->
p_sys_intf
;
VLCDialogWindow
*
dialogWindow
=
CFBridgingRelease
(
p_dialog
->
p_sys_intf
)
;
if
(
!
dialogWindow
)
{
if
(
!
dialogWindow
)
{
msg_Warn
(
VLCIntf
,
"dialog window not found"
);
msg_Warn
(
VLCIntf
,
"dialog window not found"
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
[
dialogWindow
setDelegate
:
nil
];
[
dialogWindow
setDelegate
:
nil
];
[
dialogWindow
close
];
dialogWindow
=
nil
;
dialogWindow
=
nil
;
p_dialog
->
p_sys_intf
=
NULL
;
p_dialog
->
p_sys_intf
=
NULL
;
...
@@ -541,8 +527,7 @@ static ExtensionsDialogProvider *sharedInstance = nil;
...
@@ -541,8 +527,7 @@ static ExtensionsDialogProvider *sharedInstance = nil;
[
self
updateWidgets
:
p_dialog
];
[
self
updateWidgets
:
p_dialog
];
if
(
strcmp
([[
dialogWindow
title
]
UTF8String
],
if
(
strcmp
([[
dialogWindow
title
]
UTF8String
],
p_dialog
->
psz_title
)
!=
0
)
{
p_dialog
->
psz_title
)
!=
0
)
{
NSString
*
titleString
=
[
NSString
stringWithCString
:
p_dialog
->
psz_title
NSString
*
titleString
=
toNSStr
(
p_dialog
->
psz_title
);
encoding:
NSUTF8StringEncoding
];
[
dialogWindow
setTitle
:
titleString
];
[
dialogWindow
setTitle
:
titleString
];
}
}
...
@@ -569,7 +554,7 @@ static ExtensionsDialogProvider *sharedInstance = nil;
...
@@ -569,7 +554,7 @@ static ExtensionsDialogProvider *sharedInstance = nil;
-
(
void
)
manageDialog
:(
extension_dialog_t
*
)
p_dialog
-
(
void
)
manageDialog
:(
extension_dialog_t
*
)
p_dialog
{
{
assert
(
p_dialog
);
assert
(
p_dialog
);
ExtensionsManager
*
extMgr
=
[
ExtensionsManager
getInstance
:
p_intf
];
ExtensionsManager
*
extMgr
=
[
ExtensionsManager
sharedInstance
];
assert
(
extMgr
!=
NULL
);
assert
(
extMgr
!=
NULL
);
NSValue
*
o_value
=
[
NSValue
valueWithPointer
:
p_dialog
];
NSValue
*
o_value
=
[
NSValue
valueWithPointer
:
p_dialog
];
...
...
modules/gui/macosx/ExtensionsManager.h
View file @
5289253f
...
@@ -40,9 +40,8 @@
...
@@ -40,9 +40,8 @@
@interface
ExtensionsManager
:
NSObject
@interface
ExtensionsManager
:
NSObject
+
(
ExtensionsManager
*
)
getInstance
:(
intf_thread_t
*
)
_p_intf
;
+
(
ExtensionsManager
*
)
sharedInstance
;
-
(
id
)
initWithIntf
:(
intf_thread_t
*
)
_p_intf
;
-
(
void
)
buildMenu
:(
NSMenu
*
)
extMenu
;
-
(
void
)
buildMenu
:(
NSMenu
*
)
extMenu
;
-
(
BOOL
)
loadExtensions
;
-
(
BOOL
)
loadExtensions
;
...
...
modules/gui/macosx/ExtensionsManager.m
View file @
5289253f
...
@@ -35,9 +35,8 @@
...
@@ -35,9 +35,8 @@
@interface
ExtensionsManager
()
@interface
ExtensionsManager
()
{
{
intf_thread_t
*
p_intf
;
extensions_manager_t
*
p_extensions_manager
;
extensions_manager_t
*
p_extensions_manager
;
ExtensionsDialogProvider
*
p_edp
;
ExtensionsDialogProvider
*
_extensionDialogProvider
;
NSMutableDictionary
*
p_extDict
;
NSMutableDictionary
*
p_extDict
;
...
@@ -51,19 +50,20 @@
...
@@ -51,19 +50,20 @@
static
ExtensionsManager
*
instance
=
nil
;
static
ExtensionsManager
*
instance
=
nil
;
+
(
ExtensionsManager
*
)
getInstance
:(
intf_thread_t
*
)
_p_intf
+
(
ExtensionsManager
*
)
sharedInstance
{
{
if
(
!
instance
)
if
(
!
instance
)
instance
=
[[
ExtensionsManager
alloc
]
init
WithIntf
:
_p_intf
];
instance
=
[[
ExtensionsManager
alloc
]
init
];
return
instance
;
return
instance
;
}
}
-
(
id
)
init
WithIntf
:(
intf_thread_t
*
)
_p_intf
-
(
id
)
init
{
{
if
((
self
=
[
super
init
]))
{
self
=
[
super
init
];
p_intf
=
_p_intf
;
if
(
self
)
{
p_extensions_manager
=
NULL
;
p_extensions_manager
=
NULL
;
p_edp
=
NULL
;
_extensionDialogProvider
=
[
ExtensionsDialogProvider
sharedInstance
]
;
p_extDict
=
[[
NSMutableDictionary
alloc
]
init
];
p_extDict
=
[[
NSMutableDictionary
alloc
]
init
];
...
@@ -79,19 +79,24 @@ static ExtensionsManager* instance = nil;
...
@@ -79,19 +79,24 @@ static ExtensionsManager* instance = nil;
-
(
void
)
buildMenu
:(
NSMenu
*
)
extMenu
-
(
void
)
buildMenu
:(
NSMenu
*
)
extMenu
{
{
assert
(
extMenu
!=
nil
);
assert
(
extMenu
!=
nil
);
if
(
!
[
self
isLoaded
])
// This case can happen: do nothing
/* check if stuff was loaded, which can fail */
if
(
!
[
self
isLoaded
])
{
BOOL
b_ret
=
[
self
loadExtensions
];
if
(
b_ret
==
NO
)
return
;
return
;
}
intf_thread_t
*
p_intf
=
VLCIntf
;
vlc_mutex_lock
(
&
p_extensions_manager
->
lock
);
vlc_mutex_lock
(
&
p_extensions_manager
->
lock
);
extension_t
*
p_ext
=
NULL
;
extension_t
*
p_ext
=
NULL
;
int
i_ext
=
0
;
int
i_ext
=
0
;
FOREACH_ARRAY
(
p_ext
,
p_extensions_manager
->
extensions
)
{
FOREACH_ARRAY
(
p_ext
,
p_extensions_manager
->
extensions
)
{
bool
b_Active
=
extension_IsActivated
(
p_extensions_manager
,
p_ext
);
bool
b_Active
=
extension_IsActivated
(
p_extensions_manager
,
p_ext
);
NSString
*
titleString
=
[
NSString
stringWithCString
:
p_ext
->
psz_title
NSString
*
titleString
=
toNSStr
(
p_ext
->
psz_title
);
encoding:
NSUTF8StringEncoding
];
if
(
b_Active
&&
extension_HasMenu
(
p_extensions_manager
,
p_ext
))
{
if
(
b_Active
&&
extension_HasMenu
(
p_extensions_manager
,
p_ext
))
{
NSMenu
*
submenu
=
[[
NSMenu
alloc
]
initWithTitle
:
titleString
];
NSMenu
*
submenu
=
[[
NSMenu
alloc
]
initWithTitle
:
titleString
];
...
@@ -105,12 +110,10 @@ static ExtensionsManager* instance = nil;
...
@@ -105,12 +110,10 @@ static ExtensionsManager* instance = nil;
uint16_t
*
pi_ids
=
NULL
;
uint16_t
*
pi_ids
=
NULL
;
size_t
i_num
=
0
;
size_t
i_num
=
0
;
if
(
extension_GetMenu
(
p_extensions_manager
,
p_ext
,
if
(
extension_GetMenu
(
p_extensions_manager
,
p_ext
,
&
ppsz_titles
,
&
pi_ids
)
==
VLC_SUCCESS
)
{
&
ppsz_titles
,
&
pi_ids
)
==
VLC_SUCCESS
)
{
for
(
int
i
=
0
;
ppsz_titles
[
i
]
!=
NULL
;
++
i
)
{
for
(
int
i
=
0
;
ppsz_titles
[
i
]
!=
NULL
;
++
i
)
{
++
i_num
;
++
i_num
;
titleString
=
[
NSString
stringWithCString
:
ppsz_titles
[
i
]
titleString
=
toNSStr
(
ppsz_titles
[
i
]);
encoding:
NSUTF8StringEncoding
];
NSMenuItem
*
menuItem
=
[
submenu
addItemWithTitle
:
titleString
NSMenuItem
*
menuItem
=
[
submenu
addItemWithTitle
:
titleString
action:
@selector
(
triggerMenu
:)
action:
@selector
(
triggerMenu
:)
keyEquivalent:
@""
];
keyEquivalent:
@""
];
...
@@ -166,17 +169,16 @@ static ExtensionsManager* instance = nil;
...
@@ -166,17 +169,16 @@ static ExtensionsManager* instance = nil;
-
(
BOOL
)
loadExtensions
-
(
BOOL
)
loadExtensions
{
{
intf_thread_t
*
p_intf
=
VLCIntf
;
if
(
!
p_extensions_manager
)
{
if
(
!
p_extensions_manager
)
{
p_extensions_manager
=
(
extensions_manager_t
*
)
p_extensions_manager
=
(
extensions_manager_t
*
)
vlc_object_create
(
p_intf
,
sizeof
(
extensions_manager_t
));
vlc_object_create
(
p_intf
,
sizeof
(
extensions_manager_t
));
if
(
!
p_extensions_manager
)
{
if
(
!
p_extensions_manager
)
{
b_failed
=
true
;
b_failed
=
true
;
[
delegate
extensionsUpdated
];
[
delegate
extensionsUpdated
];
return
false
;
return
false
;
}
}
p_extensions_manager
->
p_module
=
p_extensions_manager
->
p_module
=
module_need
(
p_extensions_manager
,
"extension"
,
NULL
,
false
);
module_need
(
p_extensions_manager
,
"extension"
,
NULL
,
false
);
if
(
!
p_extensions_manager
->
p_module
)
{
if
(
!
p_extensions_manager
->
p_module
)
{
msg_Err
(
p_intf
,
"Unable to load extensions module"
);
msg_Err
(
p_intf
,
"Unable to load extensions module"
);
...
@@ -188,12 +190,11 @@ static ExtensionsManager* instance = nil;
...
@@ -188,12 +190,11 @@ static ExtensionsManager* instance = nil;
}
}
/* Initialize dialog provider */
/* Initialize dialog provider */
p_edp
=
[
ExtensionsDialogProvider
sharedInstance
:
p_intf
];
_extensionDialogProvider
=
[
ExtensionsDialogProvider
sharedInstance
];
if
(
!
p_edp
)
{
if
(
!
_extensionDialogProvider
)
{
msg_Err
(
p_intf
,
"Unable to create dialogs provider for extensions"
);
msg_Err
(
p_intf
,
"Unable to create dialogs provider for extensions"
);
module_unneed
(
p_extensions_manager
,
module_unneed
(
p_extensions_manager
,
p_extensions_manager
->
p_module
);
p_extensions_manager
->
p_module
);
vlc_object_release
(
p_extensions_manager
);
vlc_object_release
(
p_extensions_manager
);
p_extensions_manager
=
NULL
;
p_extensions_manager
=
NULL
;
b_failed
=
true
;
b_failed
=
true
;
...
@@ -228,6 +229,8 @@ static ExtensionsManager* instance = nil;
...
@@ -228,6 +229,8 @@ static ExtensionsManager* instance = nil;
-
(
void
)
triggerMenu
:(
id
)
sender
-
(
void
)
triggerMenu
:(
id
)
sender
{
{
NSLog
(
@"%s"
,
__PRETTY_FUNCTION__
);
intf_thread_t
*
p_intf
=
VLCIntf
;
uint32_t
identifier
=
[(
NSMenuItem
*
)
sender
tag
];
uint32_t
identifier
=
[(
NSMenuItem
*
)
sender
tag
];
uint16_t
i_ext
=
MENU_GET_EXTENSION
(
identifier
);
uint16_t
i_ext
=
MENU_GET_EXTENSION
(
identifier
);
...
@@ -319,8 +322,8 @@ static ExtensionsManager* instance = nil;
...
@@ -319,8 +322,8 @@ static ExtensionsManager* instance = nil;
-
(
void
)
dealloc
-
(
void
)
dealloc
{
{
intf_thread_t
*
p_intf
=
VLCIntf
;
msg_Dbg
(
p_intf
,
"Killing extension dialog provider"
);
msg_Dbg
(
p_intf
,
"Killing extension dialog provider"
);
[
ExtensionsDialogProvider
killInstance
];
if
(
p_extensions_manager
)
if
(
p_extensions_manager
)
vlc_object_release
(
p_extensions_manager
);
vlc_object_release
(
p_extensions_manager
);
...
...
modules/gui/macosx/InputManager.m
View file @
5289253f
...
@@ -230,7 +230,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
...
@@ -230,7 +230,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
* The serial queue ensures that changed inputs are propagated in the same order as they arrive.
* The serial queue ensures that changed inputs are propagated in the same order as they arrive.
*/
*/
dispatch_async
(
informInputChangedQueue
,
^
{
dispatch_async
(
informInputChangedQueue
,
^
{
[[
ExtensionsManager
getInstance
:
VLCIntf
]
inputChanged
:
p_input_changed
];
[[
ExtensionsManager
sharedInstance
]
inputChanged
:
p_input_changed
];
if
(
p_input_changed
)
if
(
p_input_changed
)
vlc_object_release
(
p_input_changed
);
vlc_object_release
(
p_input_changed
);
});
});
...
...
modules/gui/macosx/MainMenu.m
View file @
5289253f
...
@@ -53,7 +53,6 @@
...
@@ -53,7 +53,6 @@
@interface
VLCMainMenu
()
@interface
VLCMainMenu
()
{
{
BOOL
b_mainMenu_setup
;
BOOL
b_nib_videoeffects_loaded
;
BOOL
b_nib_videoeffects_loaded
;
BOOL
b_nib_audioeffects_loaded
;
BOOL
b_nib_audioeffects_loaded
;
BOOL
b_nib_tracksynchrloaded
;
BOOL
b_nib_tracksynchrloaded
;
...
@@ -117,11 +116,6 @@
...
@@ -117,11 +116,6 @@
-
(
void
)
awakeFromNib
-
(
void
)
awakeFromNib
{
{
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector:
@selector
(
applicationWillFinishLaunching
:)
name:
NSApplicationWillFinishLaunchingNotification
object:
nil
];
/* check whether the user runs OSX with a RTL language */
/* check whether the user runs OSX with a RTL language */
NSArray
*
languages
=
[
NSLocale
preferredLanguages
];
NSArray
*
languages
=
[
NSLocale
preferredLanguages
];
NSString
*
preferredLanguage
=
[
languages
firstObject
];
NSString
*
preferredLanguage
=
[
languages
firstObject
];
...
@@ -130,10 +124,7 @@
...
@@ -130,10 +124,7 @@
msg_Dbg
(
VLCIntf
,
"adapting interface since '%s' is a RTL language"
,
[
preferredLanguage
UTF8String
]);
msg_Dbg
(
VLCIntf
,
"adapting interface since '%s' is a RTL language"
,
[
preferredLanguage
UTF8String
]);
[
_rateTextField
setAlignment
:
NSLeftTextAlignment
];
[
_rateTextField
setAlignment
:
NSLeftTextAlignment
];
}
}
}
-
(
void
)
applicationWillFinishLaunching
:(
NSNotification
*
)
notification
{
[
self
setRateControlsEnabled
:
NO
];
[
self
setRateControlsEnabled
:
NO
];
#ifdef HAVE_SPARKLE
#ifdef HAVE_SPARKLE
...
@@ -149,14 +140,9 @@
...
@@ -149,14 +140,9 @@
VLCStringUtility
*
stringUtility
=
[
VLCStringUtility
sharedInstance
];
VLCStringUtility
*
stringUtility
=
[
VLCStringUtility
sharedInstance
];
char
*
key
;
char
*
key
;
/* Check if we already did this once. Opening the other nibs calls it too,
because VLCMain is the owner */
if
(
b_mainMenu_setup
)
return
;
/* Get ExtensionsManager */
/* Get ExtensionsManager */
intf_thread_t
*
p_intf
=
VLCIntf
;
intf_thread_t
*
p_intf
=
VLCIntf
;
_extensionManager
=
[
ExtensionsManager
getInstance
:
p_intf
];
_extensionManager
=
[
ExtensionsManager
sharedInstance
];
[
self
initStrings
];
[
self
initStrings
];
...
@@ -259,21 +245,18 @@
...
@@ -259,21 +245,18 @@
name:
NSApplicationDidChangeScreenParametersNotification
name:
NSApplicationDidChangeScreenParametersNotification
object:
nil
];
object:
nil
];
/* we're done */
b_mainMenu_setup
=
YES
;
[
self
setupVarMenuItem
:
_add_intf
target
:
(
vlc_object_t
*
)
p_intf
[
self
setupVarMenuItem
:
_add_intf
target
:
(
vlc_object_t
*
)
p_intf
var:
"intf-add"
selector
:
@selector
(
toggleVar
:
)];
var:
"intf-add"
selector
:
@selector
(
toggleVar
:
)];
/* setup extensions menu */
/* setup extensions menu */
// FIXME: Implement preference for autoloading extensions on mac
if
(
!
[
_extensionManager
isLoaded
]
&&
!
[
_extensionManager
cannotLoad
])
[
_extensionManager
loadExtensions
];
/* Let the ExtensionsManager itself build the menu */
/* Let the ExtensionsManager itself build the menu */
[
_extensionManager
buildMenu
:
_extensionsMenu
];
[
_extensionManager
buildMenu
:
_extensionsMenu
];
[
_extensions
setEnabled
:
([
_extensionsMenu
numberOfItems
]
>
0
)];
[
_extensions
setEnabled
:
([
_extensionsMenu
numberOfItems
]
>
0
)];
// FIXME: Implement preference for autoloading extensions on mac
if
(
!
[
_extensionManager
isLoaded
]
&&
!
[
_extensionManager
cannotLoad
])
[
_extensionManager
loadExtensions
];
/* setup post-proc menu */
/* setup post-proc menu */
NSUInteger
count
=
(
NSUInteger
)
[
_postprocessingMenu
numberOfItems
];
NSUInteger
count
=
(
NSUInteger
)
[
_postprocessingMenu
numberOfItems
];
if
(
count
>
0
)
if
(
count
>
0
)
...
...
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