]> git.sesse.net Git - vlc/blobdiff - mozilla/vlcshell.cpp
Make sure that the progress bar dialog exists before updating its status.
[vlc] / mozilla / vlcshell.cpp
index 85ea49fb58577a6ede05458d713bcd44d88d413f..38f79e6458086981b942b257a5fe78bb4f769022 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * vlcshell.cpp: a VLC plugin for Mozilla
  *****************************************************************************
- * Copyright (C) 2002-2005 VideoLAN
+ * Copyright (C) 2002-2005 the VideoLAN team
  * $Id$
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /* XXX: disable VLC here */
@@ -47,7 +47,7 @@
 #include <npapi.h>
 
 /* This is from mozilla java, do we really need it? */
-#if 0 
+#if 0
 #include <jri.h>
 #endif
 
 ******************************************************************************/
 #ifdef XP_UNIX
 #   define VOUT_PLUGINS "xvideo,x11,dummy"
-#   define AOUT_PLUGINS "oss,dummy"
+#   define AOUT_PLUGINS "alsa,oss,dummy"
+
+static unsigned int i_previous_height = 100000;
+static unsigned int i_previous_width = 100000;
 
 static void Redraw( Widget w, XtPointer closure, XEvent *event );
 static void Resize( Widget w, XtPointer closure, XEvent *event );
@@ -292,7 +295,7 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
         home_user = strdup( getenv("HOME") );
         directory = strdup( "/Library/Internet Plug-Ins/VLC Plugin.plugin/"
                             "Contents/MacOS/modules" );
-        plugin_path = malloc( strlen( directory ) + strlen( home_user ) );
+        plugin_path = (char *)malloc( strlen( directory ) + strlen( home_user ) );
         memcpy( plugin_path , home_user , strlen(home_user) );
         memcpy( plugin_path + strlen( home_user ) , directory ,
                 strlen( directory ) );
@@ -531,7 +534,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
 #if USE_LIBVLC
 
 #ifdef XP_MACOSX
-    value.i_int = ((NP_Port*) (window->window))->port;
+    value.i_int = (int)(((NP_Port*) (window->window))->port);
     VLC_VariableSet( p_plugin->i_vlc, "drawable", value );
 
     valueportx.i_int = ((NP_Port*) (window->window))->portx;
@@ -566,7 +569,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
     black_rect.bottom = valueb.i_int - valuey.i_int;
     black_rect.right = valuer.i_int - valuex.i_int;
 
-    SetPort( value.i_int );
+    SetPort( (GrafPtr)value.i_int );
     SetOrigin( valueportx.i_int , valueporty.i_int );
     ForeColor(blackColor);
     PenMode( patCopy );
@@ -661,6 +664,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
     XResizeWindow( p_plugin->p_display, p_plugin->window,
                    p_plugin->i_width, p_plugin->i_height );
     Widget w = XtWindowToWidget( p_plugin->p_display, p_plugin->window );
+
     XtAddEventHandler( w, ExposureMask, FALSE,
                        (XtEventHandler)Redraw, p_plugin );
     XtAddEventHandler( w, StructureNotifyMask, FALSE,
@@ -945,6 +949,15 @@ static void Resize ( Widget w, XtPointer closure, XEvent *event )
     }
 #endif /* X11_RESIZE_DEBUG */
 
+    if( p_plugin->i_height == i_previous_height &&
+        p_plugin->i_width == i_previous_width )
+    {
+        return;
+    }
+    i_previous_height = p_plugin->i_height;
+    i_previous_width  = p_plugin->i_width;
+
+
     i_ret = XResizeWindow( p_plugin->p_display, p_plugin->window,
             p_plugin->i_width, p_plugin->i_height );