[vlc-commits] Win32: support the attribute 'branding'

Daniel Amm git at videolan.org
Fri Oct 16 11:46:09 CEST 2015


npapi-vlc | branch: master | Daniel Amm <da2424 at t-online.de> | Tue Aug  4 01:55:24 2015 +0200| [1ad868ac37a4943d14ff2a468c7d1acef64099f3] | committer: Jean-Baptiste Kempf

Win32: support the attribute 'branding'

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=1ad868ac37a4943d14ff2a468c7d1acef64099f3
---

 activex/axvlc.idl           |    5 +++++
 activex/persistpropbag.cpp  |   12 ++++++++++++
 activex/vlccontrol2.cpp     |   15 +++++++++++++++
 activex/vlccontrol2.h       |    2 ++
 common/win32_fullscreen.cpp |   13 ++++++++-----
 5 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/activex/axvlc.idl b/activex/axvlc.idl
index 0db3efa..e87a945 100644
--- a/activex/axvlc.idl
+++ b/activex/axvlc.idl
@@ -662,6 +662,11 @@ library AXVLC
 
         [propget, helpstring("Returns the media description object.")]
         HRESULT mediaDescription([out, retval] IVLCMediaDescription** obj);
+
+        [propget, helpstring("Returns/sets visibility of the VLC branding.")]
+        HRESULT Branding([out, retval] VARIANT_BOOL* visible);
+        [propput, helpstring("Returns/sets visibility of the VLC branding.")]
+        HRESULT Branding([in] VARIANT_BOOL visible);
     };
 
     [
diff --git a/activex/persistpropbag.cpp b/activex/persistpropbag.cpp
index eb0be5c..faab5d0 100644
--- a/activex/persistpropbag.cpp
+++ b/activex/persistpropbag.cpp
@@ -261,6 +261,13 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
         }
     }
 
+    V_VT(&value) = VT_BOOL;
+    if( S_OK == pPropBag->Read(OLESTR("Branding"), &value, pErrorLog) )
+    {
+        _p_instance->get_options().set_enable_branding(V_BOOL(&value) != VARIANT_FALSE);
+        VariantClear(&value);
+    }
+
     return _p_instance->onLoad();
 };
 
@@ -332,6 +339,11 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt
     pPropBag->Write(OLESTR("FullscreenEnabled"), &value);
     VariantClear(&value);
 
+    V_VT(&value) = VT_BOOL;
+    V_BOOL(&value) = _p_instance->get_options().get_enable_branding()? VARIANT_TRUE : VARIANT_FALSE;
+    pPropBag->Write(OLESTR("Branding"), &value);
+    VariantClear(&value);
+
     if( fClearDirty )
         _p_instance->setDirty(FALSE);
 
diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp
index e85aec1..681fb24 100644
--- a/activex/vlccontrol2.cpp
+++ b/activex/vlccontrol2.cpp
@@ -1690,6 +1690,21 @@ STDMETHODIMP VLCControl2::put_BackColor(OLE_COLOR backcolor)
     return S_OK;
 };
 
+STDMETHODIMP VLCControl2::get_Branding(VARIANT_BOOL *visible)
+{
+    if( NULL == visible )
+        return E_POINTER;
+
+    *visible = varbool( _p_instance->get_options().get_enable_branding() );
+    return S_OK;
+};
+
+STDMETHODIMP VLCControl2::put_Branding(VARIANT_BOOL visible)
+{
+    _p_instance->get_options().set_enable_branding( VARIANT_FALSE != visible );
+    return S_OK;
+};
+
 STDMETHODIMP VLCControl2::get_audio(IVLCAudio** obj)
 {
     return object_get(obj,_p_vlcaudio);
diff --git a/activex/vlccontrol2.h b/activex/vlccontrol2.h
index 76a7ac7..c5bc1cb 100644
--- a/activex/vlccontrol2.h
+++ b/activex/vlccontrol2.h
@@ -449,6 +449,8 @@ public:
     STDMETHODIMP put_BackColor(OLE_COLOR backcolor) override;
     STDMETHODIMP get_FullscreenEnabled(VARIANT_BOOL* enabled) override;
     STDMETHODIMP put_FullscreenEnabled(VARIANT_BOOL enabled) override;
+    STDMETHODIMP get_Branding(VARIANT_BOOL* visible) override;
+    STDMETHODIMP put_Branding(VARIANT_BOOL visible) override;
 
     STDMETHODIMP get_audio(IVLCAudio**) override;
     STDMETHODIMP get_input(IVLCInput**) override;
diff --git a/common/win32_fullscreen.cpp b/common/win32_fullscreen.cpp
index 0289129..c801760 100644
--- a/common/win32_fullscreen.cpp
+++ b/common/win32_fullscreen.cpp
@@ -556,11 +556,14 @@ LRESULT VLCHolderWnd::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
         case WM_PAINT:{
             PAINTSTRUCT PaintStruct;
             HDC hDC = BeginPaint(hWnd(), &PaintStruct);
-            RECT rect;
-            GetClientRect(hWnd(), &rect);
-            int IconX = ((rect.right - rect.left) - GetSystemMetrics(SM_CXICON))/2;
-            int IconY = ((rect.bottom - rect.top) - GetSystemMetrics(SM_CYICON))/2;
-            DrawIcon(hDC, IconX, IconY, RC().hBackgroundIcon);
+            if( PO() && PO()->get_enable_branding() )
+            {
+                RECT rect;
+                GetClientRect(hWnd(), &rect);
+                int IconX = ((rect.right - rect.left) - GetSystemMetrics(SM_CXICON))/2;
+                int IconY = ((rect.bottom - rect.top) - GetSystemMetrics(SM_CYICON))/2;
+                DrawIcon(hDC, IconX, IconY, RC().hBackgroundIcon);
+            }
             EndPaint(hWnd(), &PaintStruct);
             break;
         }



More information about the vlc-commits mailing list