1 /*****************************************************************************
2 * vlcshell.cpp: a VLC plugin for Mozilla
3 *****************************************************************************
4 * Copyright (C) 2002-2009 the VideoLAN team
7 * Authors: Samuel Hocevar <sam@zoy.org>
8 * Jean-Paul Saman <jpsaman@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
35 #ifdef HAVE_MOZILLA_CONFIG_H
36 # include <mozilla-config.h>
39 /* This is from mozilla java, do we really need it? */
44 #include "vlcplugin.h"
47 /* Enable/disable debugging printf's for X11 resizing */
48 #undef X11_RESIZE_DEBUG
50 #define WINDOW_TEXT "Waiting for video"
52 /*****************************************************************************
53 * Unix-only declarations
54 ******************************************************************************/
57 static void Redraw( Widget w, XtPointer closure, XEvent *event );
58 static void ControlHandler( Widget w, XtPointer closure, XEvent *event );
59 static void Resize( Widget w, XtPointer closure, XEvent *event );
63 /*****************************************************************************
64 * MacOS-only declarations
65 ******************************************************************************/
69 /*****************************************************************************
70 * Windows-only declarations
71 *****************************************************************************/
74 static LRESULT CALLBACK Manage( HWND p_hwnd, UINT i_msg, WPARAM wpar, LPARAM lpar );
78 /******************************************************************************
80 *****************************************************************************/
81 char * NPP_GetMIMEDescription( void )
83 static char mimetype[] = PLUGIN_MIMETYPES;
87 NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
89 static char psz_name[] = PLUGIN_NAME;
90 static char psz_desc[1000];
92 /* plugin class variables */
95 case NPPVpluginNameString:
96 *((char **)value) = psz_name;
97 return NPERR_NO_ERROR;
99 case NPPVpluginDescriptionString:
100 snprintf( psz_desc, sizeof(psz_desc), PLUGIN_DESCRIPTION,
101 libvlc_get_version() );
102 *((char **)value) = psz_desc;
103 return NPERR_NO_ERROR;
106 /* move on to instance variables ... */
110 if( instance == NULL )
112 return NPERR_INVALID_INSTANCE_ERROR;
115 /* plugin instance variables */
117 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
118 if( NULL == p_plugin )
120 // plugin has not been initialized yet !
121 return NPERR_INVALID_INSTANCE_ERROR;
126 case NPPVpluginScriptableNPObject:
128 /* retrieve plugin root class */
129 NPClass *scriptClass = p_plugin->getScriptClass();
132 /* create an instance and return it */
133 *(NPObject**)value = NPN_CreateObject(instance, scriptClass);
134 return NPERR_NO_ERROR;
142 return NPERR_GENERIC_ERROR;
146 * there is some confusion in gecko headers regarding definition of this API
147 * NPPVariable is wrongly defined as NPNVariable, which sounds incorrect.
150 NPError NPP_SetValue( NPP instance, NPNVariable variable, void *value )
152 return NPERR_GENERIC_ERROR;
155 /******************************************************************************
157 *****************************************************************************/
159 int16 NPP_HandleEvent( NPP instance, void * event )
161 static UInt32 lastMouseUp = 0;
162 libvlc_exception_t ex;
163 libvlc_exception_init(&ex);
165 if( instance == NULL )
170 VlcPlugin *p_plugin = (VlcPlugin*)instance->pdata;
172 if( p_plugin == NULL )
177 EventRecord *myEvent = (EventRecord*)event;
179 switch( myEvent->what )
185 if( (myEvent->when - lastMouseUp) < GetDblTime() )
188 p_plugin->toggle_fullscreen(&ex);
189 libvlc_exception_clear(&ex);
194 lastMouseUp = myEvent->when;
202 const NPWindow& npwindow = p_plugin->getWindow();
203 if( npwindow.window )
207 if( p_plugin->playlist_isplaying(&ex) )
209 hasVout = p_plugin->player_has_vout(NULL);
212 libvlc_rectangle_t area;
215 area.right = npwindow.width;
216 area.bottom = npwindow.height;
217 libvlc_video_redraw_rectangle(p_plugin->getMD(&ex), &area, NULL);
220 libvlc_exception_clear(&ex);
224 /* draw the beautiful "No Picture" */
226 ForeColor(blackColor);
229 /* seems that firefox forgets to set the following
230 * on occasion (reload) */
231 SetOrigin(((NP_Port *)npwindow.window)->portx,
232 ((NP_Port *)npwindow.window)->porty);
237 rect.right = npwindow.width;
238 rect.bottom = npwindow.height;
241 ForeColor(whiteColor);
242 MoveTo( (npwindow.width-80)/ 2 , npwindow.height / 2 );
243 DrawText( WINDOW_TEXT , 0 , strlen(WINDOW_TEXT) );
250 case NPEventType_GetFocusEvent:
251 case NPEventType_LoseFocusEvent:
253 case NPEventType_AdjustCursorEvent:
255 case NPEventType_MenuCommandEvent:
257 case NPEventType_ClippingChangedEvent:
259 case NPEventType_ScrollingBeginsEvent:
261 case NPEventType_ScrollingEndsEvent:
268 #endif /* XP_MACOSX */
270 /******************************************************************************
271 * General Plug-in Calls
272 *****************************************************************************/
273 NPError NPP_Initialize( void )
275 return NPERR_NO_ERROR;
278 jref NPP_GetJavaClass( void )
283 void NPP_Shutdown( void )
288 NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
289 char* argn[], char* argv[], NPSavedData* saved )
293 if( instance == NULL )
295 return NPERR_INVALID_INSTANCE_ERROR;
298 VlcPlugin * p_plugin = new VlcPlugin( instance, mode );
299 if( NULL == p_plugin )
301 return NPERR_OUT_OF_MEMORY_ERROR;
304 status = p_plugin->init(argc, argn, argv);
305 if( NPERR_NO_ERROR == status )
307 instance->pdata = reinterpret_cast<void*>(p_plugin);
309 NPN_SetValue(instance, NPPVpluginWindowBool, (void *)false);
310 NPN_SetValue(instance, NPPVpluginTransparentBool, (void *)false);
320 NPError NPP_Destroy( NPP instance, NPSavedData** save )
322 if( NULL == instance )
323 return NPERR_INVALID_INSTANCE_ERROR;
325 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
326 if( NULL == p_plugin )
327 return NPERR_NO_ERROR;
329 instance->pdata = NULL;
332 HWND win = (HWND)p_plugin->getWindow().window;
333 WNDPROC winproc = p_plugin->getWindowProc();
337 SetWindowLong( win, GWL_WNDPROC, (LONG)winproc );
343 return NPERR_NO_ERROR;
346 NPError NPP_SetWindow( NPP instance, NPWindow* window )
348 #if defined(XP_UNIX) && !defined(__APPLE__)
350 unsigned int i_control_height = 0, i_control_width = 0;
355 return NPERR_INVALID_INSTANCE_ERROR;
358 /* NPP_SetWindow may be called before NPP_New (Opera) */
359 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
360 if( NULL == p_plugin )
362 /* we should probably show a splash screen here */
363 return NPERR_NO_ERROR;
366 #if defined(XP_UNIX) && !defined(__APPLE__)
367 control = p_plugin->getControlWindow();
370 libvlc_exception_t ex;
371 libvlc_exception_init(&ex);
373 libvlc_instance_t *p_vlc = p_plugin->getVLC();
377 * Before setting window to point to the
378 * new window, you may wish to compare the new window
379 * info to the previous window (if any) to note window
383 /* retrieve current window */
384 NPWindow& curwin = p_plugin->getWindow();
387 if( window && window->window )
389 /* check if plugin has a new parent window */
390 CGrafPtr drawable = (((NP_Port*) (window->window))->port);
391 if( !curwin.window || drawable != (((NP_Port*) (curwin.window))->port) )
393 /* set/change parent window */
394 libvlc_video_set_parent(p_vlc, (libvlc_drawable_t)drawable, &ex);
395 libvlc_exception_clear(&ex);
398 /* as MacOS X video output is windowless, set viewport */
399 libvlc_rectangle_t view, clip;
402 ** browser sets port origin to top-left location of plugin
403 ** relative to GrafPort window origin is set relative to document,
404 ** which of little use for drawing
406 view.top = ((NP_Port*) (window->window))->porty;
407 view.left = ((NP_Port*) (window->window))->portx;
408 view.bottom = window->height+view.top;
409 view.right = window->width+view.left;
411 /* clipRect coordinates are also relative to GrafPort */
412 clip.top = window->clipRect.top;
413 clip.left = window->clipRect.left;
414 clip.bottom = window->clipRect.bottom;
415 clip.right = window->clipRect.right;
417 libvlc_video_set_viewport(p_vlc, p_plugin->getMD(&ex), &view, &clip, &ex);
418 libvlc_exception_clear(&ex);
420 /* remember new window */
421 p_plugin->setWindow(*window);
423 else if( curwin.window )
425 /* change/set parent */
426 libvlc_video_set_parent(p_vlc, 0, &ex);
427 libvlc_exception_clear(&ex);
429 curwin.window = NULL;
431 #endif /* XP_MACOSX */
434 if( window && window->window )
436 /* check if plugin has a new parent window */
437 HWND drawable = (HWND) (window->window);
438 if( !curwin.window || drawable != curwin.window )
440 /* reset previous window settings */
441 HWND oldwin = (HWND)p_plugin->getWindow().window;
442 WNDPROC oldproc = p_plugin->getWindowProc();
446 SetWindowLong( oldwin, GWL_WNDPROC, (LONG)oldproc );
448 /* attach our plugin object */
449 SetWindowLongPtr((HWND)drawable, GWLP_USERDATA,
450 reinterpret_cast<LONG_PTR>(p_plugin));
452 /* install our WNDPROC */
453 p_plugin->setWindowProc( (WNDPROC)SetWindowLong( drawable,
454 GWL_WNDPROC, (LONG)Manage ) );
456 /* change window style to our liking */
457 LONG style = GetWindowLong((HWND)drawable, GWL_STYLE);
458 style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
459 SetWindowLong((HWND)drawable, GWL_STYLE, style);
461 /* change/set parent */
462 libvlc_video_set_parent(p_vlc, (libvlc_drawable_t)drawable, &ex);
463 libvlc_exception_clear(&ex);
465 /* remember new window */
466 p_plugin->setWindow(*window);
469 InvalidateRect( (HWND)drawable, NULL, TRUE );
470 UpdateWindow( (HWND)drawable );
473 else if( curwin.window )
476 HWND oldwin = (HWND)curwin.window;
477 SetWindowLong( oldwin, GWL_WNDPROC, (LONG)(p_plugin->getWindowProc()) );
478 p_plugin->setWindowProc(NULL);
480 /* change/set parent */
481 libvlc_video_set_parent(p_vlc, 0, &ex);
482 libvlc_exception_clear(&ex);
484 curwin.window = NULL;
489 /* default to hidden toolbar, shown at the end of this method if asked *
490 * developers note : getToolbarSize need to wait the end of this method
492 i_control_height = 0;
493 i_control_width = window->width;
495 if( window && window->window )
497 Window parent = (Window) window->window;
498 if( !curwin.window || (parent != (Window)curwin.window) )
500 Display *p_display = ( (NPSetWindowCallbackStruct *)
501 window->ws_info )->display;
503 XResizeWindow( p_display, parent, window->width, window->height );
505 int i_blackColor = BlackPixel(p_display, DefaultScreen(p_display));
508 Window video = XCreateSimpleWindow( p_display, parent, 0, 0,
509 window->width, window->height - i_control_height,
510 0, i_blackColor, i_blackColor );
511 Window controls = (Window) NULL;
512 controls = XCreateSimpleWindow( p_display, parent,
513 0, window->height - i_control_height-1,
514 window->width, i_control_height-1,
515 0, i_blackColor, i_blackColor );
517 XMapWindow( p_display, parent );
518 XMapWindow( p_display, video );
519 if( controls ) { XMapWindow( p_display, controls ); }
524 Widget w = XtWindowToWidget( p_display, parent );
526 XtAddEventHandler( w, ExposureMask, FALSE,
527 (XtEventHandler)Redraw, p_plugin );
528 XtAddEventHandler( w, StructureNotifyMask, FALSE,
529 (XtEventHandler)Resize, p_plugin );
530 XtAddEventHandler( w, ButtonReleaseMask, FALSE,
531 (XtEventHandler)ControlHandler, p_plugin );
533 /* set/change parent window */
534 libvlc_video_set_parent( p_vlc, (libvlc_drawable_t) video, &ex );
535 libvlc_exception_clear(&ex);
537 /* remember window */
538 p_plugin->setWindow( *window );
539 p_plugin->setVideoWindow( video );
543 p_plugin->setControlWindow( controls );
546 Redraw( w, (XtPointer)p_plugin, NULL );
548 /* now display toolbar if asked through parameters */
549 if( p_plugin->b_toolbar )
551 p_plugin->showToolbar();
555 else if( curwin.window )
557 /* change/set parent */
558 libvlc_video_set_parent(p_vlc, 0, &ex);
559 libvlc_exception_clear(&ex);
560 curwin.window = NULL;
564 if( !p_plugin->b_stream )
566 if( p_plugin->psz_target )
568 if( p_plugin->playlist_add( p_plugin->psz_target, NULL ) != -1 )
570 if( p_plugin->b_autoplay )
572 p_plugin->playlist_play(NULL);
575 p_plugin->b_stream = true;
578 return NPERR_NO_ERROR;
581 NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream *stream,
582 NPBool seekable, uint16 *stype )
584 if( NULL == instance )
586 return NPERR_INVALID_INSTANCE_ERROR;
589 VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(instance->pdata);
590 if( NULL == p_plugin )
592 return NPERR_INVALID_INSTANCE_ERROR;
596 ** Firefox/Mozilla may decide to open a stream from the URL specified
597 ** in the SRC parameter of the EMBED tag and pass it to us
599 ** since VLC will open the SRC URL as well, we're not interested in
600 ** that stream. Otherwise, we'll take it and queue it up in the playlist
602 if( !p_plugin->psz_target || strcmp(stream->url, p_plugin->psz_target) )
604 /* TODO: use pipes !!!! */
605 *stype = NP_ASFILEONLY;
606 return NPERR_NO_ERROR;
608 return NPERR_GENERIC_ERROR;
611 int32 NPP_WriteReady( NPP instance, NPStream *stream )
617 int32 NPP_Write( NPP instance, NPStream *stream, int32 offset,
618 int32 len, void *buffer )
624 NPError NPP_DestroyStream( NPP instance, NPStream *stream, NPError reason )
626 if( instance == NULL )
628 return NPERR_INVALID_INSTANCE_ERROR;
630 return NPERR_NO_ERROR;
633 void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname )
635 if( instance == NULL )
640 VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(instance->pdata);
641 if( NULL == p_plugin )
646 if( p_plugin->playlist_add( stream->url, NULL ) != -1 )
648 if( p_plugin->b_autoplay )
650 p_plugin->playlist_play(NULL);
655 void NPP_URLNotify( NPP instance, const char* url,
656 NPReason reason, void* notifyData )
658 /***** Insert NPP_URLNotify code here *****\
659 PluginInstance* p_plugin;
660 if (instance != NULL)
661 p_plugin = (PluginInstance*) instance->pdata;
662 \*********************************************/
665 void NPP_Print( NPP instance, NPPrint* printInfo )
667 if( printInfo == NULL )
672 if( instance != NULL )
674 /***** Insert NPP_Print code here *****\
675 PluginInstance* p_plugin = (PluginInstance*) instance->pdata;
676 \**************************************/
678 if( printInfo->mode == NP_FULL )
682 * If your plugin would like to take over
683 * printing completely when it is in full-screen mode,
684 * set printInfo->pluginPrinted to TRUE and print your
685 * plugin as you see fit. If your plugin wants Netscape
686 * to handle printing in this case, set
687 * printInfo->pluginPrinted to FALSE (the default) and
688 * do nothing. If you do want to handle printing
689 * yourself, printOne is true if the print button
690 * (as opposed to the print menu) was clicked.
691 * On the Macintosh, platformPrint is a THPrint; on
692 * Windows, platformPrint is a structure
693 * (defined in npapi.h) containing the printer name, port,
697 /***** Insert NPP_Print code here *****\
698 void* platformPrint =
699 printInfo->print.fullPrint.platformPrint;
701 printInfo->print.fullPrint.printOne;
702 \**************************************/
705 printInfo->print.fullPrint.pluginPrinted = FALSE;
709 /* If not fullscreen, we must be embedded */
712 * If your plugin is embedded, or is full-screen
713 * but you returned false in pluginPrinted above, NPP_Print
714 * will be called with mode == NP_EMBED. The NPWindow
715 * in the printInfo gives the location and dimensions of
716 * the embedded plugin on the printed page. On the
717 * Macintosh, platformPrint is the printer port; on
718 * Windows, platformPrint is the handle to the printing
722 /***** Insert NPP_Print code here *****\
723 NPWindow* printWindow =
724 &(printInfo->print.embedPrint.window);
725 void* platformPrint =
726 printInfo->print.embedPrint.platformPrint;
727 \**************************************/
732 /******************************************************************************
733 * Windows-only methods
734 *****************************************************************************/
736 static LRESULT CALLBACK Manage( HWND p_hwnd, UINT i_msg, WPARAM wpar, LPARAM lpar )
738 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(GetWindowLongPtr(p_hwnd, GWLP_USERDATA));
747 PAINTSTRUCT paintstruct;
751 hdc = BeginPaint( p_hwnd, &paintstruct );
753 GetClientRect( p_hwnd, &rect );
755 FillRect( hdc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH) );
756 SetTextColor(hdc, RGB(255, 255, 255));
757 SetBkColor(hdc, RGB(0, 0, 0));
758 DrawText( hdc, WINDOW_TEXT, strlen(WINDOW_TEXT), &rect,
759 DT_CENTER|DT_VCENTER|DT_SINGLELINE);
761 EndPaint( p_hwnd, &paintstruct );
765 /* delegate to default handler */
766 return CallWindowProc( p_plugin->getWindowProc(), p_hwnd,
772 /******************************************************************************
774 *****************************************************************************/
776 static void Redraw( Widget w, XtPointer closure, XEvent *event )
778 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure);
779 Window control = p_plugin->getControlWindow();
780 const NPWindow& window = p_plugin->getWindow();
783 unsigned int i_control_height, i_control_width;
785 if( p_plugin->b_toolbar )
786 p_plugin->getToolbarSize( &i_control_width, &i_control_height );
788 i_control_height = i_control_width = 0;
790 Window video = p_plugin->getVideoWindow();
791 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
793 gcv.foreground = BlackPixel( p_display, 0 );
794 gc = XCreateGC( p_display, video, GCForeground, &gcv );
796 XFillRectangle( p_display, video, gc,
797 0, 0, window.width, window.height - i_control_height);
799 gcv.foreground = WhitePixel( p_display, 0 );
800 XChangeGC( p_display, gc, GCForeground, &gcv );
802 XDrawString( p_display, video, gc,
803 window.width / 2 - 40, (window.height - i_control_height) / 2,
804 WINDOW_TEXT, strlen(WINDOW_TEXT) );
805 XFreeGC( p_display, gc );
807 p_plugin->redrawToolbar();
810 static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
812 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure);
813 const NPWindow& window = p_plugin->getWindow();
815 int i_height = window.height;
816 int i_width = window.width;
817 int i_xPos = event->xbutton.x;
818 int i_yPos = event->xbutton.y;
820 if( p_plugin && p_plugin->b_toolbar )
823 libvlc_exception_t ex;
825 libvlc_exception_init( &ex );
826 libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
827 libvlc_exception_clear( &ex );
829 i_playing = p_plugin->playlist_isplaying( &ex );
830 libvlc_exception_clear( &ex );
832 vlc_toolbar_clicked_t clicked;
833 clicked = p_plugin->getToolbarButtonClicked( i_xPos, i_yPos );
840 p_plugin->playlist_pause( &ex );
842 p_plugin->playlist_play( &ex );
844 libvlc_exception_clear( &ex );
850 p_plugin->playlist_stop(&ex);
851 libvlc_exception_clear( &ex );
855 case clicked_Fullscreen:
857 p_plugin->set_fullscreen( 1, &ex );
858 libvlc_exception_clear( &ex );
865 libvlc_audio_toggle_mute( p_plugin->getVLC(), &ex );
866 libvlc_exception_clear( &ex );
870 case clicked_timeline:
872 /* if a movie is loaded */
876 f_length = libvlc_media_player_get_length( p_md, &ex ) / 100;
877 libvlc_exception_clear( &ex );
879 f_length = (float)f_length *
880 ( ((float)i_xPos-4.0 ) / ( ((float)i_width-8.0)/100) );
882 libvlc_media_player_set_time( p_md, f_length, &ex );
883 libvlc_exception_clear( &ex );
890 /* Not implemented yet*/
894 default: /* button_Unknown */
898 Redraw( w, closure, event );
901 static void Resize ( Widget w, XtPointer closure, XEvent *event )
903 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure);
904 Window control = p_plugin->getControlWindow();
905 const NPWindow& window = p_plugin->getWindow();
906 Window drawable = p_plugin->getVideoWindow();
907 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
910 Window root_return, parent_return, * children_return;
912 unsigned int i_nchildren;
913 unsigned int i_control_height, i_control_width;
915 if( p_plugin->b_toolbar )
917 p_plugin->getToolbarSize( &i_control_width, &i_control_height );
921 i_control_height = i_control_width = 0;
924 #ifdef X11_RESIZE_DEBUG
925 XWindowAttributes attr;
927 if( event && event->type == ConfigureNotify )
929 fprintf( stderr, "vlcshell::Resize() ConfigureNotify %d x %d, "
930 "send_event ? %s\n", event->xconfigure.width,
931 event->xconfigure.height,
932 event->xconfigure.send_event ? "TRUE" : "FALSE" );
934 #endif /* X11_RESIZE_DEBUG */
936 if( ! p_plugin->setSize(window.width, (window.height - i_control_height)) )
938 /* size already set */
942 i_ret = XResizeWindow( p_display, drawable,
943 window.width, (window.height - i_control_height) );
945 #ifdef X11_RESIZE_DEBUG
947 "vlcshell::Resize() XResizeWindow(owner) returned %d\n", i_ret );
949 XGetWindowAttributes ( p_display, drawable, &attr );
951 /* X is asynchronous, so the current size reported here is not
952 necessarily the requested size as the Resize request may not
953 yet have been handled by the plugin host */
954 fprintf( stderr, "vlcshell::Resize() current (owner) size %d x %d\n",
955 attr.width, attr.height );
956 #endif /* X11_RESIZE_DEBUG */
958 XQueryTree( p_display, drawable,
959 &root_return, &parent_return, &children_return,
962 if( i_nchildren > 0 )
964 /* XXX: Make assumptions related to the window parenting structure in
965 vlc/modules/video_output/x11/xcommon.c */
966 base_window = children_return[i_nchildren - 1];
968 #ifdef X11_RESIZE_DEBUG
969 fprintf( stderr, "vlcshell::Resize() got %d children\n", i_nchildren );
970 fprintf( stderr, "vlcshell::Resize() got base_window %p\n",
972 #endif /* X11_RESIZE_DEBUG */
974 i_ret = XResizeWindow( p_display, base_window,
975 window.width, ( window.height - i_control_height ) );
977 #ifdef X11_RESIZE_DEBUG
979 "vlcshell::Resize() XResizeWindow(base) returned %d\n",
982 XGetWindowAttributes( p_display, base_window, &attr );
984 fprintf( stderr, "vlcshell::Resize() new size %d x %d\n",
985 attr.width, attr.height );
986 #endif /* X11_RESIZE_DEBUG */