[vlc-commits] Deprecated 'fullscreen' embed tag attribute in favour of 'allowfullscreen', which specifies whether the user is allowed to switch into fullscreen mode .

Cheng Sun git at videolan.org
Thu Jan 5 21:28:03 CET 2012


npapi-vlc | branch: master | Cheng Sun <chengsun9 at gmail.com> | Thu Jan  5 20:11:36 2012 +0000| [74799815317065491482137c60c892a8cadae0d0] | committer: Cheng Sun

Deprecated 'fullscreen' embed tag attribute in favour of 'allowfullscreen', which specifies whether the user is allowed to switch into fullscreen mode.

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=74799815317065491482137c60c892a8cadae0d0
---

 npapi/vlcplugin_base.cpp |   15 +++++----------
 npapi/vlcplugin_base.h   |    1 +
 npapi/vlcplugin_gtk.cpp  |   11 +++++++----
 npapi/vlcplugin_mac.cpp  |    2 ++
 npapi/vlcplugin_win.cpp  |    2 ++
 npapi/vlcplugin_xlib.cpp |    2 ++
 npapi/vlcshell.cpp       |   40 +++++++++++++++++++---------------------
 7 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp
index 30397c7..3e83ede 100644
--- a/npapi/vlcplugin_base.cpp
+++ b/npapi/vlcplugin_base.cpp
@@ -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
diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h
index 696426b..253cc69 100644
--- a/npapi/vlcplugin_base.h
+++ b/npapi/vlcplugin_base.h
@@ -224,6 +224,7 @@ public:
     int      b_stream;
     int      b_autoplay;
     int      b_toolbar;
+    int      b_allowfullscreen;
     char *   psz_text;
     char *   psz_target;
 
diff --git a/npapi/vlcplugin_gtk.cpp b/npapi/vlcplugin_gtk.cpp
index 182fd16..77247ac 100644
--- a/npapi/vlcplugin_gtk.cpp
+++ b/npapi/vlcplugin_gtk.cpp
@@ -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);
diff --git a/npapi/vlcplugin_mac.cpp b/npapi/vlcplugin_mac.cpp
index b37b68b..1c79d39 100644
--- a/npapi/vlcplugin_mac.cpp
+++ b/npapi/vlcplugin_mac.cpp
@@ -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);
 }
diff --git a/npapi/vlcplugin_win.cpp b/npapi/vlcplugin_win.cpp
index d500551..726e87a 100644
--- a/npapi/vlcplugin_win.cpp
+++ b/npapi/vlcplugin_win.cpp
@@ -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();
     }
diff --git a/npapi/vlcplugin_xlib.cpp b/npapi/vlcplugin_xlib.cpp
index b556220..835fcaa 100644
--- a/npapi/vlcplugin_xlib.cpp
+++ b/npapi/vlcplugin_xlib.cpp
@@ -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);
 }
diff --git a/npapi/vlcshell.cpp b/npapi/vlcshell.cpp
index f21aef7..de74420 100644
--- a/npapi/vlcshell.cpp
+++ b/npapi/vlcshell.cpp
@@ -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;
 }
 



More information about the vlc-commits mailing list