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 = reinterpret_cast<VlcPlugin*>(instance->pdata);
171 if( p_plugin == NULL )
176 EventRecord *myEvent = (EventRecord*)event;
178 switch( myEvent->what )
184 if( (myEvent->when - lastMouseUp) < GetDblTime() )
187 p_plugin->toggle_fullscreen(&ex);
188 libvlc_exception_clear(&ex);
193 lastMouseUp = myEvent->when;
201 const NPWindow& npwindow = p_plugin->getWindow();
202 if( npwindow.window )
206 if( p_plugin->playlist_isplaying(&ex) )
208 hasVout = p_plugin->player_has_vout(NULL);
211 libvlc_rectangle_t area;
214 area.right = npwindow.width;
215 area.bottom = npwindow.height;
216 libvlc_video_redraw_rectangle(p_plugin->getMD(&ex), &area, NULL);
219 libvlc_exception_clear(&ex);
223 /* draw the beautiful "No Picture" */
225 ForeColor(blackColor);
228 /* seems that firefox forgets to set the following
229 * on occasion (reload) */
230 SetOrigin(((NP_Port *)npwindow.window)->portx,
231 ((NP_Port *)npwindow.window)->porty);
236 rect.right = npwindow.width;
237 rect.bottom = npwindow.height;
240 ForeColor(whiteColor);
241 MoveTo( (npwindow.width-80)/ 2 , npwindow.height / 2 );
242 DrawText( WINDOW_TEXT , 0 , strlen(WINDOW_TEXT) );
249 case NPEventType_GetFocusEvent:
250 case NPEventType_LoseFocusEvent:
252 case NPEventType_AdjustCursorEvent:
254 case NPEventType_MenuCommandEvent:
256 case NPEventType_ClippingChangedEvent:
258 case NPEventType_ScrollingBeginsEvent:
260 case NPEventType_ScrollingEndsEvent:
267 #endif /* XP_MACOSX */
269 /******************************************************************************
270 * General Plug-in Calls
271 *****************************************************************************/
272 NPError NPP_Initialize( void )
274 return NPERR_NO_ERROR;
277 jref NPP_GetJavaClass( void )
282 void NPP_Shutdown( void )
287 NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
288 char* argn[], char* argv[], NPSavedData* saved )
292 if( instance == NULL )
294 return NPERR_INVALID_INSTANCE_ERROR;
297 VlcPlugin * p_plugin = new VlcPlugin( instance, mode );
298 if( NULL == p_plugin )
300 return NPERR_OUT_OF_MEMORY_ERROR;
303 status = p_plugin->init(argc, argn, argv);
304 if( NPERR_NO_ERROR == status )
306 instance->pdata = reinterpret_cast<void*>(p_plugin);
308 NPN_SetValue(instance, NPPVpluginWindowBool, (void *)false);
309 NPN_SetValue(instance, NPPVpluginTransparentBool, (void *)false);
319 NPError NPP_Destroy( NPP instance, NPSavedData** save )
321 if( NULL == instance )
322 return NPERR_INVALID_INSTANCE_ERROR;
324 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
325 if( NULL == p_plugin )
326 return NPERR_NO_ERROR;
328 instance->pdata = NULL;
331 HWND win = (HWND)p_plugin->getWindow().window;
332 WNDPROC winproc = p_plugin->getWindowProc();
336 SetWindowLong( win, GWL_WNDPROC, (LONG)winproc );
342 return NPERR_NO_ERROR;
345 NPError NPP_SetWindow( NPP instance, NPWindow* window )
347 #if defined(XP_UNIX) && !defined(__APPLE__)
349 unsigned int i_control_height = 0, i_control_width = 0;
354 return NPERR_INVALID_INSTANCE_ERROR;
357 /* NPP_SetWindow may be called before NPP_New (Opera) */
358 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
359 if( NULL == p_plugin )
361 /* we should probably show a splash screen here */
362 return NPERR_NO_ERROR;
365 #if defined(XP_UNIX) && !defined(__APPLE__)
366 control = p_plugin->getControlWindow();
369 libvlc_exception_t ex;
370 libvlc_exception_init(&ex);
372 libvlc_instance_t *p_vlc = p_plugin->getVLC();
376 * Before setting window to point to the
377 * new window, you may wish to compare the new window
378 * info to the previous window (if any) to note window
382 /* retrieve current window */
383 NPWindow& curwin = p_plugin->getWindow();
386 if( window && window->window )
388 /* check if plugin has a new parent window */
389 CGrafPtr drawable = (((NP_Port*) (window->window))->port);
390 if( !curwin.window || drawable != (((NP_Port*) (curwin.window))->port) )
392 /* set/change parent window */
393 libvlc_video_set_parent(p_vlc, (libvlc_drawable_t)drawable, &ex);
394 libvlc_exception_clear(&ex);
397 /* as MacOS X video output is windowless, set viewport */
398 libvlc_rectangle_t view, clip;
401 ** browser sets port origin to top-left location of plugin
402 ** relative to GrafPort window origin is set relative to document,
403 ** which of little use for drawing
405 view.top = ((NP_Port*) (window->window))->porty;
406 view.left = ((NP_Port*) (window->window))->portx;
407 view.bottom = window->height+view.top;
408 view.right = window->width+view.left;
410 /* clipRect coordinates are also relative to GrafPort */
411 clip.top = window->clipRect.top;
412 clip.left = window->clipRect.left;
413 clip.bottom = window->clipRect.bottom;
414 clip.right = window->clipRect.right;
416 libvlc_video_set_viewport(p_vlc, p_plugin->getMD(&ex), &view, &clip, &ex);
417 libvlc_exception_clear(&ex);
419 /* remember new window */
420 p_plugin->setWindow(*window);
422 else if( curwin.window )
424 /* change/set parent */
425 libvlc_video_set_parent(p_vlc, 0, &ex);
426 libvlc_exception_clear(&ex);
428 curwin.window = NULL;
430 #endif /* XP_MACOSX */
433 if( window && window->window )
435 /* check if plugin has a new parent window */
436 HWND drawable = (HWND) (window->window);
437 if( !curwin.window || drawable != curwin.window )
439 /* reset previous window settings */
440 HWND oldwin = (HWND)p_plugin->getWindow().window;
441 WNDPROC oldproc = p_plugin->getWindowProc();
445 SetWindowLong( oldwin, GWL_WNDPROC, (LONG)oldproc );
447 /* attach our plugin object */
448 SetWindowLongPtr((HWND)drawable, GWLP_USERDATA,
449 reinterpret_cast<LONG_PTR>(p_plugin));
451 /* install our WNDPROC */
452 p_plugin->setWindowProc( (WNDPROC)SetWindowLong( drawable,
453 GWL_WNDPROC, (LONG)Manage ) );
455 /* change window style to our liking */
456 LONG style = GetWindowLong((HWND)drawable, GWL_STYLE);
457 style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
458 SetWindowLong((HWND)drawable, GWL_STYLE, style);
460 /* change/set parent */
461 libvlc_video_set_parent(p_vlc, (libvlc_drawable_t)drawable, &ex);
462 libvlc_exception_clear(&ex);
464 /* remember new window */
465 p_plugin->setWindow(*window);
468 InvalidateRect( (HWND)drawable, NULL, TRUE );
469 UpdateWindow( (HWND)drawable );
472 else if( curwin.window )
475 HWND oldwin = (HWND)curwin.window;
476 SetWindowLong( oldwin, GWL_WNDPROC, (LONG)(p_plugin->getWindowProc()) );
477 p_plugin->setWindowProc(NULL);
479 /* change/set parent */
480 libvlc_video_set_parent(p_vlc, 0, &ex);
481 libvlc_exception_clear(&ex);
483 curwin.window = NULL;
488 /* default to hidden toolbar, shown at the end of this method if asked *
489 * developers note : getToolbarSize need to wait the end of this method
491 i_control_height = 0;
492 i_control_width = window->width;
494 if( window && window->window )
496 Window parent = (Window) window->window;
497 if( !curwin.window || (parent != (Window)curwin.window) )
499 Display *p_display = ( (NPSetWindowCallbackStruct *)
500 window->ws_info )->display;
502 XResizeWindow( p_display, parent, window->width, window->height );
504 int i_blackColor = BlackPixel(p_display, DefaultScreen(p_display));
507 Window video = XCreateSimpleWindow( p_display, parent, 0, 0,
508 window->width, window->height - i_control_height,
509 0, i_blackColor, i_blackColor );
510 Window controls = (Window) NULL;
511 controls = XCreateSimpleWindow( p_display, parent,
512 0, window->height - i_control_height-1,
513 window->width, i_control_height-1,
514 0, i_blackColor, i_blackColor );
516 XMapWindow( p_display, parent );
517 XMapWindow( p_display, video );
518 if( controls ) { XMapWindow( p_display, controls ); }
523 Widget w = XtWindowToWidget( p_display, parent );
525 XtAddEventHandler( w, ExposureMask, FALSE,
526 (XtEventHandler)Redraw, p_plugin );
527 XtAddEventHandler( w, StructureNotifyMask, FALSE,
528 (XtEventHandler)Resize, p_plugin );
529 XtAddEventHandler( w, ButtonReleaseMask, FALSE,
530 (XtEventHandler)ControlHandler, p_plugin );
532 /* set/change parent window */
533 libvlc_video_set_parent( p_vlc, (libvlc_drawable_t) video, &ex );
534 libvlc_exception_clear(&ex);
536 /* remember window */
537 p_plugin->setWindow( *window );
538 p_plugin->setVideoWindow( video );
542 p_plugin->setControlWindow( controls );
545 Redraw( w, (XtPointer)p_plugin, NULL );
547 /* now display toolbar if asked through parameters */
548 if( p_plugin->b_toolbar )
550 p_plugin->showToolbar();
554 else if( curwin.window )
556 /* change/set parent */
557 libvlc_video_set_parent(p_vlc, 0, &ex);
558 libvlc_exception_clear(&ex);
559 curwin.window = NULL;
563 if( !p_plugin->b_stream )
565 if( p_plugin->psz_target )
567 if( p_plugin->playlist_add( p_plugin->psz_target, NULL ) != -1 )
569 if( p_plugin->b_autoplay )
571 p_plugin->playlist_play(NULL);
574 p_plugin->b_stream = true;
577 return NPERR_NO_ERROR;
580 NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream *stream,
581 NPBool seekable, uint16 *stype )
583 if( NULL == instance )
585 return NPERR_INVALID_INSTANCE_ERROR;
588 VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(instance->pdata);
589 if( NULL == p_plugin )
591 return NPERR_INVALID_INSTANCE_ERROR;
595 ** Firefox/Mozilla may decide to open a stream from the URL specified
596 ** in the SRC parameter of the EMBED tag and pass it to us
598 ** since VLC will open the SRC URL as well, we're not interested in
599 ** that stream. Otherwise, we'll take it and queue it up in the playlist
601 if( !p_plugin->psz_target || strcmp(stream->url, p_plugin->psz_target) )
603 /* TODO: use pipes !!!! */
604 *stype = NP_ASFILEONLY;
605 return NPERR_NO_ERROR;
607 return NPERR_GENERIC_ERROR;
610 int32 NPP_WriteReady( NPP instance, NPStream *stream )
616 int32 NPP_Write( NPP instance, NPStream *stream, int32 offset,
617 int32 len, void *buffer )
623 NPError NPP_DestroyStream( NPP instance, NPStream *stream, NPError reason )
625 if( instance == NULL )
627 return NPERR_INVALID_INSTANCE_ERROR;
629 return NPERR_NO_ERROR;
632 void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname )
634 if( instance == NULL )
639 VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(instance->pdata);
640 if( NULL == p_plugin )
645 if( p_plugin->playlist_add( stream->url, NULL ) != -1 )
647 if( p_plugin->b_autoplay )
649 p_plugin->playlist_play(NULL);
654 void NPP_URLNotify( NPP instance, const char* url,
655 NPReason reason, void* notifyData )
657 /***** Insert NPP_URLNotify code here *****\
658 PluginInstance* p_plugin;
659 if (instance != NULL)
660 p_plugin = (PluginInstance*) instance->pdata;
661 \*********************************************/
664 void NPP_Print( NPP instance, NPPrint* printInfo )
666 if( printInfo == NULL )
671 if( instance != NULL )
673 /***** Insert NPP_Print code here *****\
674 PluginInstance* p_plugin = (PluginInstance*) instance->pdata;
675 \**************************************/
677 if( printInfo->mode == NP_FULL )
681 * If your plugin would like to take over
682 * printing completely when it is in full-screen mode,
683 * set printInfo->pluginPrinted to TRUE and print your
684 * plugin as you see fit. If your plugin wants Netscape
685 * to handle printing in this case, set
686 * printInfo->pluginPrinted to FALSE (the default) and
687 * do nothing. If you do want to handle printing
688 * yourself, printOne is true if the print button
689 * (as opposed to the print menu) was clicked.
690 * On the Macintosh, platformPrint is a THPrint; on
691 * Windows, platformPrint is a structure
692 * (defined in npapi.h) containing the printer name, port,
696 /***** Insert NPP_Print code here *****\
697 void* platformPrint =
698 printInfo->print.fullPrint.platformPrint;
700 printInfo->print.fullPrint.printOne;
701 \**************************************/
704 printInfo->print.fullPrint.pluginPrinted = FALSE;
708 /* If not fullscreen, we must be embedded */
711 * If your plugin is embedded, or is full-screen
712 * but you returned false in pluginPrinted above, NPP_Print
713 * will be called with mode == NP_EMBED. The NPWindow
714 * in the printInfo gives the location and dimensions of
715 * the embedded plugin on the printed page. On the
716 * Macintosh, platformPrint is the printer port; on
717 * Windows, platformPrint is the handle to the printing
721 /***** Insert NPP_Print code here *****\
722 NPWindow* printWindow =
723 &(printInfo->print.embedPrint.window);
724 void* platformPrint =
725 printInfo->print.embedPrint.platformPrint;
726 \**************************************/
731 /******************************************************************************
732 * Windows-only methods
733 *****************************************************************************/
735 static LRESULT CALLBACK Manage( HWND p_hwnd, UINT i_msg, WPARAM wpar, LPARAM lpar )
737 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(GetWindowLongPtr(p_hwnd, GWLP_USERDATA));
746 PAINTSTRUCT paintstruct;
750 hdc = BeginPaint( p_hwnd, &paintstruct );
752 GetClientRect( p_hwnd, &rect );
754 FillRect( hdc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH) );
755 SetTextColor(hdc, RGB(255, 255, 255));
756 SetBkColor(hdc, RGB(0, 0, 0));
757 DrawText( hdc, WINDOW_TEXT, strlen(WINDOW_TEXT), &rect,
758 DT_CENTER|DT_VCENTER|DT_SINGLELINE);
760 EndPaint( p_hwnd, &paintstruct );
764 /* delegate to default handler */
765 return CallWindowProc( p_plugin->getWindowProc(), p_hwnd,
771 /******************************************************************************
773 *****************************************************************************/
775 static void Redraw( Widget w, XtPointer closure, XEvent *event )
777 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure);
778 Window control = p_plugin->getControlWindow();
779 const NPWindow& window = p_plugin->getWindow();
782 unsigned int i_control_height, i_control_width;
784 if( p_plugin->b_toolbar )
785 p_plugin->getToolbarSize( &i_control_width, &i_control_height );
787 i_control_height = i_control_width = 0;
789 Window video = p_plugin->getVideoWindow();
790 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
792 gcv.foreground = BlackPixel( p_display, 0 );
793 gc = XCreateGC( p_display, video, GCForeground, &gcv );
795 XFillRectangle( p_display, video, gc,
796 0, 0, window.width, window.height - i_control_height);
798 gcv.foreground = WhitePixel( p_display, 0 );
799 XChangeGC( p_display, gc, GCForeground, &gcv );
801 XDrawString( p_display, video, gc,
802 window.width / 2 - 40, (window.height - i_control_height) / 2,
803 WINDOW_TEXT, strlen(WINDOW_TEXT) );
804 XFreeGC( p_display, gc );
806 p_plugin->redrawToolbar();
809 static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
811 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure);
812 const NPWindow& window = p_plugin->getWindow();
814 int i_height = window.height;
815 int i_width = window.width;
816 int i_xPos = event->xbutton.x;
817 int i_yPos = event->xbutton.y;
819 if( p_plugin && p_plugin->b_toolbar )
822 libvlc_exception_t ex;
824 libvlc_exception_init( &ex );
825 libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
826 libvlc_exception_clear( &ex );
828 i_playing = p_plugin->playlist_isplaying( &ex );
829 libvlc_exception_clear( &ex );
831 vlc_toolbar_clicked_t clicked;
832 clicked = p_plugin->getToolbarButtonClicked( i_xPos, i_yPos );
839 p_plugin->playlist_pause( &ex );
841 p_plugin->playlist_play( &ex );
843 libvlc_exception_clear( &ex );
849 p_plugin->playlist_stop(&ex);
850 libvlc_exception_clear( &ex );
854 case clicked_Fullscreen:
856 p_plugin->set_fullscreen( 1, &ex );
857 libvlc_exception_clear( &ex );
864 libvlc_audio_toggle_mute( p_plugin->getVLC(), &ex );
865 libvlc_exception_clear( &ex );
869 case clicked_timeline:
871 /* if a movie is loaded */
875 f_length = libvlc_media_player_get_length( p_md, &ex ) / 100;
876 libvlc_exception_clear( &ex );
878 f_length = (float)f_length *
879 ( ((float)i_xPos-4.0 ) / ( ((float)i_width-8.0)/100) );
881 libvlc_media_player_set_time( p_md, f_length, &ex );
882 libvlc_exception_clear( &ex );
889 /* Not implemented yet*/
893 default: /* button_Unknown */
897 Redraw( w, closure, event );
900 static void Resize ( Widget w, XtPointer closure, XEvent *event )
902 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure);
903 Window control = p_plugin->getControlWindow();
904 const NPWindow& window = p_plugin->getWindow();
905 Window drawable = p_plugin->getVideoWindow();
906 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
909 Window root_return, parent_return, * children_return;
911 unsigned int i_nchildren;
912 unsigned int i_control_height, i_control_width;
914 if( p_plugin->b_toolbar )
916 p_plugin->getToolbarSize( &i_control_width, &i_control_height );
920 i_control_height = i_control_width = 0;
923 #ifdef X11_RESIZE_DEBUG
924 XWindowAttributes attr;
926 if( event && event->type == ConfigureNotify )
928 fprintf( stderr, "vlcshell::Resize() ConfigureNotify %d x %d, "
929 "send_event ? %s\n", event->xconfigure.width,
930 event->xconfigure.height,
931 event->xconfigure.send_event ? "TRUE" : "FALSE" );
933 #endif /* X11_RESIZE_DEBUG */
935 if( ! p_plugin->setSize(window.width, (window.height - i_control_height)) )
937 /* size already set */
941 i_ret = XResizeWindow( p_display, drawable,
942 window.width, (window.height - i_control_height) );
944 #ifdef X11_RESIZE_DEBUG
946 "vlcshell::Resize() XResizeWindow(owner) returned %d\n", i_ret );
948 XGetWindowAttributes ( p_display, drawable, &attr );
950 /* X is asynchronous, so the current size reported here is not
951 necessarily the requested size as the Resize request may not
952 yet have been handled by the plugin host */
953 fprintf( stderr, "vlcshell::Resize() current (owner) size %d x %d\n",
954 attr.width, attr.height );
955 #endif /* X11_RESIZE_DEBUG */
957 XQueryTree( p_display, drawable,
958 &root_return, &parent_return, &children_return,
961 if( i_nchildren > 0 )
963 /* XXX: Make assumptions related to the window parenting structure in
964 vlc/modules/video_output/x11/xcommon.c */
965 base_window = children_return[i_nchildren - 1];
967 #ifdef X11_RESIZE_DEBUG
968 fprintf( stderr, "vlcshell::Resize() got %d children\n", i_nchildren );
969 fprintf( stderr, "vlcshell::Resize() got base_window %p\n",
971 #endif /* X11_RESIZE_DEBUG */
973 i_ret = XResizeWindow( p_display, base_window,
974 window.width, ( window.height - i_control_height ) );
976 #ifdef X11_RESIZE_DEBUG
978 "vlcshell::Resize() XResizeWindow(base) returned %d\n",
981 XGetWindowAttributes( p_display, base_window, &attr );
983 fprintf( stderr, "vlcshell::Resize() new size %d x %d\n",
984 attr.width, attr.height );
985 #endif /* X11_RESIZE_DEBUG */