Commit df9f6b43 authored by David Fuhrmann's avatar David Fuhrmann Committed by Felix Paul Kühne

macosx: Add own callback path for item-change

The item-change callback might be called very often, and thus an
own code path is better, with only necessary updates.

Additionally, this fixes multiple resume playback dialogs occuring
at once when starting playback in certain situations.

refs #11981

(cherry picked from commit 293ed5e2ce38aa632a47206ff260a49771e9f67b)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent b486cba4
......@@ -152,6 +152,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force;
- (void)PlaylistItemChanged;
- (void)plItemUpdated;
- (void)playbackStatusUpdated;
- (void)sendDistributedNotificationWithUpdatedPlaybackStatus;
- (void)playbackModeUpdated;
......
......@@ -85,6 +85,8 @@ static int InputEvent(vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void *);
static int PLItemChanged(vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void *);
static int PLItemUpdated(vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void *);
static int PlaylistUpdated(vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void *);
static int PlaybackModeUpdated(vlc_object_t *, const char *,
......@@ -392,6 +394,20 @@ static int PLItemChanged(vlc_object_t *p_this, const char *psz_var,
return VLC_SUCCESS;
}
/**
* Callback for item-change variable. Is triggered after update of duration or metadata.
*/
static int PLItemUpdated(vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param)
{
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(plItemUpdated) withObject:nil waitUntilDone:NO];
[o_pool release];
return VLC_SUCCESS;
}
static int PlaylistUpdated(vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param)
{
......@@ -658,7 +674,7 @@ static VLCMain *_o_sharedMainInstance = nil;
var_AddCallback(p_intf->p_libvlc, "intf-toggle-fscontrol", ShowController, self);
var_AddCallback(p_intf->p_libvlc, "intf-show", ShowController, self);
var_AddCallback(p_intf->p_libvlc, "intf-boss", BossCallback, self);
var_AddCallback(p_playlist, "item-change", PLItemChanged, self);
var_AddCallback(p_playlist, "item-change", PLItemUpdated, self);
var_AddCallback(p_playlist, "activity", PLItemChanged, self);
var_AddCallback(p_playlist, "leaf-to-parent", PlaylistUpdated, self);
var_AddCallback(p_playlist, "playlist-item-append", PlaylistUpdated, self);
......@@ -832,7 +848,7 @@ static bool f_appExit = false;
var_DelCallback(p_intf, "dialog-login", DialogCallback, self);
var_DelCallback(p_intf, "dialog-question", DialogCallback, self);
var_DelCallback(p_intf, "dialog-progress-bar", DialogCallback, self);
var_DelCallback(p_playlist, "item-change", PLItemChanged, self);
var_DelCallback(p_playlist, "item-change", PLItemUpdated, self);
var_DelCallback(p_playlist, "activity", PLItemChanged, self);
var_DelCallback(p_playlist, "leaf-to-parent", PlaylistUpdated, self);
var_DelCallback(p_playlist, "playlist-item-append", PlaylistUpdated, self);
......@@ -1302,7 +1318,6 @@ static bool f_appExit = false;
[o_playlist updateRowSelection];
[o_mainwindow updateWindow];
[o_mainwindow updateName];
[self updateDelays];
[self updateMainMenu];
......@@ -1318,6 +1333,11 @@ static bool f_appExit = false;
});
}
- (void)plItemUpdated
{
[o_mainwindow updateName];
}
- (void)updateMainMenu
{
[o_mainmenu setupMenus];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment