From: Jean-Paul Saman Date: Fri, 24 Apr 2009 10:41:49 +0000 (+0200) Subject: mozilla: introduce new property text X-Git-Tag: 1.1.0-ff~5046 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=50b952d9421372f1a1163f2accc38d4719e57afd;p=vlc mozilla: introduce new property text The text "Waiting for video..." is no longer shown be default. One has to add it to the browser plugin properties before it is shown on the plugin area. --- diff --git a/projects/mozilla/test.html b/projects/mozilla/test.html index 83377a03f2..79c6f4d734 100644 --- a/projects/mozilla/test.html +++ b/projects/mozilla/test.html @@ -115,6 +115,7 @@ Insert VideoLAN.VLCPlugin.2 width="640" height="480" toolbar="true" + text="Waiting for video" name="vlc"> diff --git a/projects/mozilla/vlcplugin.cpp b/projects/mozilla/vlcplugin.cpp index 0ed4a19a9e..3a49e8e4c7 100644 --- a/projects/mozilla/vlcplugin.cpp +++ b/projects/mozilla/vlcplugin.cpp @@ -45,6 +45,7 @@ VlcPlugin::VlcPlugin( NPP instance, uint16 mode ) : b_stream(0), b_autoplay(1), b_toolbar(0), + psz_text(NULL), psz_target(NULL), playlist_index(-1), libvlc_instance(NULL), @@ -144,6 +145,10 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[]) { psz_target = argv[i]; } + else if( !strcmp( argn[i], "text" ) ) + { + psz_text = strdup( argv[i] ); + } else if( !strcmp( argn[i], "autoplay") || !strcmp( argn[i], "autostart") ) { @@ -266,6 +271,7 @@ VlcPlugin::~VlcPlugin() { free(psz_baseURL); free(psz_target); + free(psz_text); if( libvlc_media_player ) libvlc_media_player_release( libvlc_media_player ); if( libvlc_media_list ) diff --git a/projects/mozilla/vlcplugin.h b/projects/mozilla/vlcplugin.h index 97a9dea617..201d94a0f6 100644 --- a/projects/mozilla/vlcplugin.h +++ b/projects/mozilla/vlcplugin.h @@ -141,6 +141,7 @@ public: int b_stream; int b_autoplay; int b_toolbar; + char * psz_text; char * psz_target; void playlist_play(libvlc_exception_t *ex) diff --git a/projects/mozilla/vlcshell.cpp b/projects/mozilla/vlcshell.cpp index 37243f7200..c2228f9ee2 100644 --- a/projects/mozilla/vlcshell.cpp +++ b/projects/mozilla/vlcshell.cpp @@ -47,8 +47,6 @@ /* Enable/disable debugging printf's for X11 resizing */ #undef X11_RESIZE_DEBUG -#define WINDOW_TEXT "Waiting for video" - /***************************************************************************** * Unix-only declarations ******************************************************************************/ @@ -243,7 +241,8 @@ int16 NPP_HandleEvent( NPP instance, void * event ) ForeColor(whiteColor); MoveTo( (npwindow.width-80)/ 2 , npwindow.height / 2 ); - DrawText( WINDOW_TEXT , 0 , strlen(WINDOW_TEXT) ); + if( p_plugin->psz_text ) + DrawText( p_plugin->psz_text, 0, strlen(p_plugin->psz_text) ); } } return true; @@ -746,8 +745,9 @@ static LRESULT CALLBACK Manage( HWND p_hwnd, UINT i_msg, WPARAM wpar, LPARAM lpa FillRect( hdc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH) ); SetTextColor(hdc, RGB(255, 255, 255)); SetBkColor(hdc, RGB(0, 0, 0)); - DrawText( hdc, WINDOW_TEXT, strlen(WINDOW_TEXT), &rect, - DT_CENTER|DT_VCENTER|DT_SINGLELINE); + if( p_plugin->psz_text ) + DrawText( hdc, p_plugin->psz_text, strlen(p_plugin->psz_text), &rect, + DT_CENTER|DT_VCENTER|DT_SINGLELINE); EndPaint( p_hwnd, &paintstruct ); return 0L; @@ -790,9 +790,10 @@ static void Redraw( Widget w, XtPointer closure, XEvent *event ) gcv.foreground = WhitePixel( p_display, 0 ); XChangeGC( p_display, gc, GCForeground, &gcv ); - XDrawString( p_display, video, gc, - window.width / 2 - 40, (window.height - i_control_height) / 2, - WINDOW_TEXT, strlen(WINDOW_TEXT) ); + if( p_plugin->psz_text ) + XDrawString( p_display, video, gc, + window.width / 2 - 40, (window.height - i_control_height) / 2, + p_plugin->psz_text, strlen(p_plugin->psz_text) ); XFreeGC( p_display, gc ); p_plugin->redrawToolbar();