Commit 74799815 authored by Cheng Sun's avatar Cheng Sun

Deprecated 'fullscreen' embed tag attribute in favour of 'allowfullscreen',...

Deprecated 'fullscreen' embed tag attribute in favour of 'allowfullscreen', which specifies whether the user is allowed to switch into fullscreen mode.
parent c2f75bf4
......@@ -352,6 +352,7 @@ VlcPluginBase::VlcPluginBase( NPP instance, NPuint16_t mode ) :
b_stream(0),
b_autoplay(1),
b_toolbar(1),
b_allowfullscreen(1),
psz_text(NULL),
psz_target(NULL),
psz_bgcolor("#000000"),
......@@ -464,16 +465,10 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[])
{
b_autoplay = boolValue(argv[i]);
}
else if( !strcmp( argn[i], "fullscreen" ) )
else if( !strcmp( argn[i], "fullscreen" )
|| !strcmp( argn[i], "allowfullscreen" ) )
{
if( boolValue(argv[i]) )
{
ppsz_argv[ppsz_argc++] = "--fullscreen";
}
else
{
ppsz_argv[ppsz_argc++] = "--no-fullscreen";
}
b_allowfullscreen = boolValue(argv[i]);
}
else if( !strcmp( argn[i], "mute" ) )
{
......@@ -587,7 +582,7 @@ VlcPluginBase::~VlcPluginBase()
void VlcPluginBase::setWindow(const NPWindow &window)
{
npwindow = window;
};
}
/*****************************************************************************
* VlcPluginBase playlist replacement methods
......
......@@ -224,6 +224,7 @@ public:
int b_stream;
int b_autoplay;
int b_toolbar;
int b_allowfullscreen;
char * psz_text;
char * psz_target;
......
......@@ -104,6 +104,7 @@ void VlcPluginGtk::do_set_fullscreen(bool yes)
void VlcPluginGtk::set_fullscreen(int yes)
{
if (!b_allowfullscreen) return;
if (yes == is_fullscreen) return;
if (yes) {
gtk_widget_show(fullscreen_win);
......@@ -212,10 +213,12 @@ void VlcPluginGtk::popup_menu()
g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menu_handler), this);
gtk_menu_shell_append(GTK_MENU_SHELL(popupmenu), menuitem);
/* set fullscreen */
menuitem = gtk_image_menu_item_new_from_stock(
GTK_STOCK_FULLSCREEN, NULL);
g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menu_handler), this);
gtk_menu_shell_append(GTK_MENU_SHELL(popupmenu), menuitem);
if (b_allowfullscreen) {
menuitem = gtk_image_menu_item_new_from_stock(
GTK_STOCK_FULLSCREEN, NULL);
g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menu_handler), this);
gtk_menu_shell_append(GTK_MENU_SHELL(popupmenu), menuitem);
}
/* toolbar */
menuitem = gtk_check_menu_item_new_with_label(
VLCPLUGINGTK_MENU_TOOLBAR);
......
......@@ -42,12 +42,14 @@ void VlcPluginMac::set_player_window()
void VlcPluginMac::toggle_fullscreen()
{
if (!b_allowfullscreen) return;
if (playlist_isplaying())
libvlc_toggle_fullscreen(libvlc_media_player);
}
void VlcPluginMac::set_fullscreen(int yes)
{
if (!b_allowfullscreen) return;
if (playlist_isplaying())
libvlc_set_fullscreen(libvlc_media_player, yes);
}
......
......@@ -98,11 +98,13 @@ VlcPluginWin::~VlcPluginWin()
void VlcPluginWin::toggle_fullscreen()
{
if (!b_allowfullscreen) return;
_WindowsManager.ToggleFullScreen();
}
void VlcPluginWin::set_fullscreen(int yes)
{
if (!b_allowfullscreen) return;
if(yes){
_WindowsManager.StartFullScreen();
}
......
......@@ -51,12 +51,14 @@ void VlcPluginXlib::set_player_window()
void VlcPluginXlib::toggle_fullscreen()
{
if (!b_allowfullscreen) return;
if (playlist_isplaying())
libvlc_toggle_fullscreen(libvlc_media_player);
}
void VlcPluginXlib::set_fullscreen(int yes)
{
if (!b_allowfullscreen) return;
if (playlist_isplaying())
libvlc_set_fullscreen(libvlc_media_player,yes);
}
......
......@@ -348,6 +348,25 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
p_plugin->setWindow(*window);
p_plugin->create_windows();
p_plugin->resize_windows();
/* now set plugin state to that requested in parameters */
p_plugin->set_toolbar_visible( p_plugin->b_toolbar );
/* handle streams properly */
if( !p_plugin->b_stream )
{
if( p_plugin->psz_target )
{
if( p_plugin->playlist_add( p_plugin->psz_target ) != -1 )
{
if( p_plugin->b_autoplay )
{
p_plugin->playlist_play();
}
}
p_plugin->b_stream = true;
}
}
} else {
if (window->window == curr_window.window) {
/* resize / move notification */
......@@ -370,27 +389,6 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
}
}
/* now display toolbar if asked through parameters */
if( p_plugin->b_toolbar )
{
p_plugin->set_toolbar_visible(true);
}
if( !p_plugin->b_stream )
{
if( p_plugin->psz_target )
{
if( p_plugin->playlist_add( p_plugin->psz_target ) != -1 )
{
if( p_plugin->b_autoplay )
{
p_plugin->playlist_play();
}
}
p_plugin->b_stream = true;
}
}
return NPERR_NO_ERROR;
}
......
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