Commit c9dfaf20 authored by Sergey Radionov's avatar Sergey Radionov Committed by Jean-Baptiste Kempf

ActiveX: Fullscreen support

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 112fe149
......@@ -46,6 +46,8 @@ SOURCES_activex = \
axvlc_idl.c \
axvlc_idl.h \
guiddef.h \
vlc_win32_fullscreen.cpp \
vlc_win32_fullscreen.h \
$(NULL)
DIST_rsrc = \
......@@ -62,6 +64,11 @@ DIST_misc = \
inplace.bmp \
vlc16x16.bmp \
test.html \
pixmaps/defullscreen.bmp \
pixmaps/play.bmp \
pixmaps/pause.bmp \
pixmaps/volume.bmp \
pixmaps/volume-muted.bmp \
$(NULL)
if BUILD_ACTIVEX
......
......@@ -25,6 +25,11 @@ BEGIN
END
2 BITMAP DISCARDABLE "inplace.bmp"
3 BITMAP DISCARDABLE "pixmaps/defullscreen.bmp"
4 BITMAP DISCARDABLE "pixmaps/play.bmp"
5 BITMAP DISCARDABLE "pixmaps/pause.bmp"
6 BITMAP DISCARDABLE "pixmaps/volume.bmp"
7 BITMAP DISCARDABLE "pixmaps/volume-muted.bmp"
1 TYPELIB "axvlc.tlb"
......@@ -75,7 +75,20 @@ static LRESULT CALLBACK VLCInPlaceClassWndProc(HWND hWnd, UINT uMsg, WPARAM wPar
EndPaint(hWnd, &ps);
}
return 0L;
case WM_SIZE:{
int new_client_width = LOWORD(lParam);
int new_client_height = HIWORD(lParam);
//first child will be resized to client area
HWND hChildWnd = GetWindow(hWnd, GW_CHILD);
if(hChildWnd){
MoveWindow(hChildWnd, 0, 0, new_client_width, new_client_height, FALSE);
}
return 0L;
}
case WM_LBUTTONDBLCLK:{
p_instance->toggleFullscreen();
return 0L;
}
default:
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
......@@ -202,6 +215,7 @@ STDMETHODIMP VLCPluginClass::LockServer(BOOL fLock)
};
////////////////////////////////////////////////////////////////////////
extern HMODULE DllGetModule();
VLCPlugin::VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter) :
_inplacewnd(NULL),
......@@ -212,7 +226,8 @@ VLCPlugin::VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter) :
_p_mplayer(NULL),
_i_midx(-1),
_i_codepage(CP_ACP),
_b_usermode(TRUE)
_b_usermode(TRUE),
_WindowsManager(DllGetModule())
{
/*
** bump refcount to avoid recursive release from
......@@ -705,6 +720,8 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
HRGN clipRgn = CreateRectRgnIndirect(&clipRect);
SetWindowRgn(_inplacewnd, clipRgn, TRUE);
_WindowsManager.CreateWindows(this->getInPlaceWindow());
if( _b_usermode )
{
/* will run vlc if not done already */
......@@ -726,6 +743,11 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
return S_OK;
};
void VLCPlugin::toggleFullscreen()
{
_WindowsManager.ToggleFullScreen();
}
HRESULT VLCPlugin::onInPlaceDeactivate(void)
{
if( isPlaying() )
......@@ -734,6 +756,8 @@ HRESULT VLCPlugin::onInPlaceDeactivate(void)
fireOnStopEvent();
}
_WindowsManager.DestroyWindows();
DestroyWindow(_inplacewnd);
_inplacewnd = NULL;
......@@ -1237,8 +1261,7 @@ bad_unlock:
void VLCPlugin::set_player_window()
{
// XXX FIXME no idea if this is correct or not
libvlc_media_player_set_hwnd(_p_mplayer,getInPlaceWindow());
_WindowsManager.LibVlcAttach(_p_mplayer);
}
void VLCPlugin::player_register_events()
......
......@@ -29,6 +29,7 @@
#include <vlc/vlc.h>
#include "vlc_win32_fullscreen.h"
extern "C" const GUID CLSID_VLCPlugin;
extern "C" const GUID CLSID_VLCPlugin2;
extern "C" const GUID LIBID_AXVLC;
......@@ -213,6 +214,9 @@ public:
// control geometry within container
RECT getPosRect(void) { return _posRect; };
inline HWND getInPlaceWindow(void) const { return _inplacewnd; };
void toggleFullscreen();
BOOL isInPlaceActive(void);
/*
......@@ -355,6 +359,7 @@ private:
// in place activated window (Plugin window)
HWND _inplacewnd;
VLCWindowsManager _WindowsManager;
VLCPluginClass* _p_class;
ULONG _i_ref;
......
This diff is collapsed.
/*****************************************************************************
* vlc_win32_fullscreen.h: a VLC plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002-2011 the VideoLAN team
* $Id$
*
* Authors: Sergey Radionov <rsatom@gmail.com>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_WIN32_FULLSCREEN_H
#define VLC_WIN32_FULLSCREEN_H
///////////////////////
//VLCHolderWnd
///////////////////////
class VLCHolderWnd
{
public:
static void RegisterWndClassName(HINSTANCE hInstance);
static void UnRegisterWndClassName();
static VLCHolderWnd* CreateHolderWindow(HWND hParentWnd);
void DestroyWindow()
{::DestroyWindow(_hWnd);};
private:
static LPCTSTR getClassName(void) { return TEXT("VLC ActiveX Window Holder Class"); };
static LRESULT CALLBACK VLCHolderClassWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
static HINSTANCE _hinstance;
static ATOM _holder_wndclass_atom;
private:
VLCHolderWnd(HWND hWnd)
:_hWnd(hWnd){};
public:
HWND getHWND() const {return _hWnd;}
private:
HWND _hWnd;
};
///////////////////////
//VLCFullScreenWnd
///////////////////////
class VLCWindowsManager;
class VLCFullScreenWnd
{
public:
static void RegisterWndClassName(HINSTANCE hInstance);
static void UnRegisterWndClassName();
static VLCFullScreenWnd* CreateFSWindow(VLCWindowsManager* WM);
void DestroyWindow()
{::DestroyWindow(_hWnd);};
private:
static LPCTSTR getClassName(void) { return TEXT("VLC ActiveX Fullscreen Class"); };
static LRESULT CALLBACK FSWndWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LPCTSTR getControlsClassName(void) { return TEXT("VLC ActiveX Fullscreen Controls Class"); };
static LRESULT CALLBACK FSControlsWndWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
static HINSTANCE _hinstance;
static ATOM _fullscreen_wndclass_atom;
static ATOM _fullscreen_controls_wndclass_atom;
private:
VLCFullScreenWnd(HWND hWnd, VLCWindowsManager* WM)
:_hWnd(hWnd), _WindowsManager(WM),
hControlsWnd(0), hToolTipWnd(0), hNewMessageBitmap(0), hFSButtonBitmap(0), hFSButton(0),
hPauseBitmap(0), hPlayBitmap(0), hPlayPauseButton(0), hVideoPosScroll(0),
hMuteButton(0), hVolumeBitmap(0), hVolumeMutedBitmap(0),
hVolumeSlider(0), Last_WM_MOUSEMOVE_lParam(0){};
~VLCFullScreenWnd();
private:
libvlc_media_player_t* getMD();
bool IsPlaying()
{
libvlc_media_player_t* p_md = getMD();
int is_playing = 0;
if( p_md ){
is_playing = libvlc_media_player_is_playing(p_md);
}
return is_playing!=0;
}
private:
void RegisterEvents();
void UnRegisterEvents();
void SetVideoPosScrollRangeByVideoLen();
void SyncVideoPosScrollPosWithVideoPos();
void SetVideoPos(float Pos); //0-start, 1-end
void SyncVolumeSliderWithVLCVolume();
void SetVLCVolumeBySliderPos(int CurScrollPos);
void NeedShowControls();
void NeedHideControls();
private:
void CreateToolTip();
private:
LPARAM Last_WM_MOUSEMOVE_lParam;
private:
VLCWindowsManager* _WindowsManager;
private:
HWND hControlsWnd;
HWND hToolTipWnd;
HICON hNewMessageBitmap;
HANDLE hFSButtonBitmap;
HWND hFSButton;
HANDLE hPauseBitmap;
HANDLE hPlayBitmap;
HWND hPlayPauseButton;
HWND hVideoPosScroll;
HANDLE hVolumeBitmap;
HANDLE hVolumeMutedBitmap;
HWND hMuteButton;
HWND hVolumeSlider;
private:
void SetVideoPosScrollPosByVideoPos(int CurPos);
static bool handle_position_changed_event_enabled;
static void handle_position_changed_event(const libvlc_event_t* event, void *param);
//static void handle_time_changed_event(const libvlc_event_t* event, void *param);
static void handle_input_state_event(const libvlc_event_t* event, void *param);
public:
HWND getHWND() const {return _hWnd;}
private:
HWND _hWnd;
int VideoPosShiftBits;
};
///////////////////////
//VLCWindowsManager
///////////////////////
class VLCWindowsManager
{
public:
VLCWindowsManager(HMODULE hModule);
~VLCWindowsManager();
void CreateWindows(HWND hWindowedParentWnd);
void DestroyWindows();
void LibVlcAttach(libvlc_media_player_t* p_md);
void LibVlcDetach();
void StartFullScreen();
void EndFullScreen();
void ToggleFullScreen();
bool IsFullScreen();
HMODULE getHModule() const {return _hModule;};
VLCHolderWnd* getHolderWnd() const {return _HolderWnd;}
VLCFullScreenWnd* getFullScreenWnd() const {return _FSWnd;}
libvlc_media_player_t* getMD() {return _p_md;}
public:
void setNewMessageFlag(bool Yes)
{_b_new_messages_flag = Yes;};
bool getNewMessageFlag() const
{return _b_new_messages_flag;};
private:
HMODULE _hModule;
HWND _hWindowedParentWnd;
libvlc_media_player_t* _p_md;
VLCHolderWnd* _HolderWnd;
VLCFullScreenWnd* _FSWnd;
bool _b_new_messages_flag;
};
#endif //VLC_FULLSCREEN_H
......@@ -1098,7 +1098,7 @@ STDMETHODIMP VLCVideo::toggleFullscreen()
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_toggle_fullscreen(p_md);
Instance()->toggleFullscreen();
}
return hr;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment