[vlc-devel] Dynamic resize of VLC plugin (using Javascript)

Jean-Paul Saman jpsaman at videolan.org
Sun Oct 12 18:11:31 CEST 2008


y.brehon at qiplay.com wrote:
> 
> In the last 0.9.3 stable release of VLC, a bug would occur when trying to
> resize the plugin with a javascript call to plugin.width or .height. 
> 
> Instead of properly resizing it would simply crop the video to the new
> size. 
> 
> Here is a patch for this issue, which has been developed at our company.
> This is diffed against the 0.93 stable release. I would have liked to
> submit it via trac, but apparently this is not possible. 

The patch below is broken and won't compile. After correcting 
compilation the solution even crashed firefox-2.0.0.17-1. Next time test 
your final patch before sending it by e-mail.

Please correct send the proper fix.

> 
> Cheers, 
> 
> Yannick 
> 
> --- tmp/vlc-0.9.3/projects/mozilla/vlcshell.cpp 2008-09-18
> 23:03:36.000000000 +0200
> +++ vlcshell.cpp 2008-10-10 17:09:51.000000000 +0200
> @@ -7,6 +7,9 @@
>  * Authors: Samuel Hocevar 
>  * Jean-Paul Saman 
>  *

Looks like the patch is not created against a clean tree. Since the 
author block is different from what is in vlc git archive. Maybe it is 
an idea to use git.videolan.org/vlc.git to do your modifications in next 
time. See wiki.videolan.org/Git.

> + *
> + * Patch for dynamic (Javascript) resize of Mozilla VLC plugin: Frederic
> Anger  and Yannick Brhon 
> + *
>  * This program is free software; you can redistribute it and/or modify
>  * it under the terms of the GNU General Public License as published by
>  * the Free Software Foundation; either version 2 of the License, or
> @@ -948,6 +951,9 @@
> 
> unsigned int i_nchildren;
>  unsigned int i_control_height, i_control_width;
> 
> + int i_new_height = 0;
> + int i_new_width = 0;
> +
>  if( p_plugin->b_toolbar )
>  {
>  p_plugin->getToolbarSize( &i_control_width, 
> @@ -969,15 +975,25 @@
>  }
>  #endif /* X11_RESIZE_DEBUG */
> 
> - if( ! p_plugin->setSize(window.width, (window.height -
> i_control_height)) )
> + if( event &
^^^ missing part of check on this line ^^^

> + i_new_height = event->xconfigure.height - i_control_height;
> + i_new_width = event->xconfigure.width - i_control_width;
> + }
> + else
> + {
> + i_new_height = window.height - i_control_height;
> + i_new_width = window.width - i_control_width;
>  }
^^ missing indentation in the above block. This is a violation of VLC 
coding style.

> 
> - i_ret = XResizeWindow( p_display, drawable,
> - window.width, (window.height - i_control_height) );
> + if( ! p_plugin->setSize(i_new_width, i_new_height) )
> + {
> + /* size already set */
> + return;
> + }
missing indentation

> 
> + i_ret = XResizeWindow( p_display, drawable, i_new_width, i_new_height );
> + 
>  #ifdef X11_RESIZE_DEBUG
>  fprintf( stderr,
>  "vlcshell::Resize() XResizeWindow(owner) returned %dn", i_ret );
> @@ -1008,7 +1024,7 @@
> 
> #endif /* X11_RESIZE_DEBUG */
> 
>  i_ret = XResizeWindow( p_display, base_window,
> - window.width, ( window.height - i_control_height ) );
> + i_new_width , i_new_height );
> 
>  #ifdef X11_RESIZE_DEBUG
>  fprintf( stderr,

Gtz
Jean-Paul Saman.



More information about the vlc-devel mailing list