Commit 4a33ee31 authored by Jean-Paul Saman's avatar Jean-Paul Saman

libvlc: mozilla: activex: add support for libvlc_MediaPlayerMouseClick event

libvlc:  add libvlc_MediaPlayerMouseClick event
mozilla: add MediaPlayerMouseClick event
activex: add MediaPlayerMouseClick event
parent 5461234e
......@@ -73,6 +73,7 @@ enum libvlc_event_e {
libvlc_MediaPlayerLengthChanged,
libvlc_MediaPlayerMouseGrab,
libvlc_MediaPlayerMouseRelease,
libvlc_MediaPlayerMouseClick,
libvlc_MediaListItemAdded=0x200,
libvlc_MediaListWillAddItem,
......@@ -227,6 +228,12 @@ typedef struct libvlc_event_t
int y;
} media_player_mouse_release;
struct
{
int x;
int y;
} media_player_mouse_click;
} u; /**< Type-dependent event description */
} libvlc_event_t;
......@@ -238,3 +245,4 @@ typedef struct libvlc_event_t
# endif
#endif /* _LIBVLC_EVENTS_H */
......@@ -188,6 +188,8 @@ library AXVLC
const int DISPID_MediaPlayerMouseGrabEvent = 214;
const int DISPID_MediaPlayerMouseReleaseEvent = 215;
const int DISPID_MediaPlayerMouseClickEvent = 216;
[
uuid(DF48072F-5EF8-434e-9B40-E2F3AE759B5F),
helpstring("Event interface for VLC control"),
......@@ -238,6 +240,9 @@ library AXVLC
void MediaPlayerMouseGrab([in] long x, [in] long y);
[id(DISPID_MediaPlayerMouseReleaseEvent), helpstring("Mouse released object in video output")]
void MediaPlayerMouseRelease([in] long x, [in] long y);
[id(DISPID_MediaPlayerMouseClickEvent), helpstring("Mouse click event")]
void MediaPlayerMouseClick([in] long x, [in] long y);
};
[
......
......@@ -825,6 +825,8 @@ void __RPC_STUB IVLCControl_put_AutoLoop_Stub(
#define DISPID_MediaPlayerMouseReleaseEvent (215)
#define DISPID_MediaPlayerMouseClickEvent (216)
/*****************************************************************************
* DVLCEvents dispinterface
*/
......
......@@ -1230,6 +1230,28 @@ static void handle_mouse_release_event(const libvlc_event_t* event, void *param)
event->u.media_player_mouse_release.y);
}
void VLCPlugin::fireOnMediaPlayerMouseClickEvent(long x, long y)
{
DISPPARAMS params;
params.cArgs = 2;
params.rgvarg = (VARIANTARG *) CoTaskMemAlloc(sizeof(VARIANTARG) * params.cArgs) ;
memset(params.rgvarg, 0, sizeof(VARIANTARG) * params.cArgs);
params.rgvarg[1].vt = VT_I4;
params.rgvarg[1].lVal = x;
params.rgvarg[0].vt = VT_I4;
params.rgvarg[0].lVal = y;
params.rgdispidNamedArgs = NULL;
params.cNamedArgs = 0;
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerMouseClickEvent, &params);
};
static void handle_mouse_click_event(const libvlc_event_t* event, void *param)
{
VLCPlugin *plugin = (VLCPlugin*)param;
plugin->fireOnMediaPlayerMouseClickEvent(event->u.media_player_mouse_click.x,
event->u.media_player_mouse_click.y);
}
/* */
bool VLCPlugin::playlist_select( int idx )
......@@ -1327,6 +1349,9 @@ void VLCPlugin::player_register_events()
handle_mouse_grab_event, this);
libvlc_event_attach(eventManager, libvlc_MediaPlayerMouseRelease,
handle_mouse_release_event, this);
libvlc_event_attach(eventManager, libvlc_MediaPlayerMouseClick,
handle_mouse_click_event, this);
}
}
......@@ -1350,6 +1375,7 @@ void VLCPlugin::player_unregister_events()
libvlc_event_detach(eventManager, libvlc_MediaPlayerStopped,
handle_input_state_event, this);
libvlc_event_detach(eventManager, libvlc_MediaPlayerForward,
handle_input_state_event, this);
libvlc_event_detach(eventManager, libvlc_MediaPlayerBackward,
handle_input_state_event, this);
......@@ -1371,6 +1397,9 @@ void VLCPlugin::player_unregister_events()
handle_mouse_grab_event, this);
libvlc_event_detach(eventManager, libvlc_MediaPlayerMouseRelease,
handle_mouse_release_event, this);
libvlc_event_detach(eventManager, libvlc_MediaPlayerMouseClick,
handle_mouse_click_event, this);
}
}
......@@ -1392,3 +1421,4 @@ int VLCPlugin::playlist_add_extended_untrusted(const char *mrl, int optc, const
return item;
}
......@@ -258,6 +258,8 @@ public:
void fireOnMediaPlayerMouseGrabEvent(long x, long y);
void fireOnMediaPlayerMouseReleaseEvent(long x, long y);
void fireOnMediaPlayerMouseClickEvent(long x, long y);
// controlling IUnknown interface
LPUNKNOWN pUnkOuter;
......
......@@ -285,8 +285,16 @@ function handleMouseRelease(event,X,Y)
document.getElementById("objectTextField").innerHTML = "released at " + newpos;
}
function handleMouseRelease(event,X,Y)
{
var newpos = "";
newpos = "("+ X + "," + Y + ")";
document.getElementById("objectTextField").innerHTML = "clicked at " + newpos;
}
registerVLCEvent('MediaPlayerMouseGrab', handleMouseGrab);
registerVLCEvent('MediaPlayerMouseRelease', handleMouseRelease);
registerVLCEvent('MediaPlayerMouseClick', handleMouseClick;
function doSetSlider()
{
......
......@@ -130,6 +130,7 @@ static vlcplugin_event_t vlcevents[] = {
{ "MediaPlayerLengthChanged", libvlc_MediaPlayerLengthChanged, handle_changed_event },
{ "MediaPlayerMouseGrab", libvlc_MediaPlayerMouseGrab, handle_logo_event },
{ "MediaPlayerMouseRelease", libvlc_MediaPlayerMouseRelease, handle_logo_event },
{ "MediaPlayerMouseClick", libvlc_MediaPlayerMouseClick, handle_logo_event },
};
static void handle_input_event(const libvlc_event_t* event, void *param)
......@@ -203,6 +204,10 @@ static void handle_logo_event(const libvlc_event_t* event, void *param)
INT32_TO_NPVARIANT(event->u.media_player_mouse_release.x, npparam[0]);
INT32_TO_NPVARIANT(event->u.media_player_mouse_release.y, npparam[1]);
break;
case libvlc_MediaPlayerMouseClick:
INT32_TO_NPVARIANT(event->u.media_player_mouse_click.x, npparam[0]);
INT32_TO_NPVARIANT(event->u.media_player_mouse_click.y, npparam[1]);
break;
default: /* ignore all other libvlc_event_type_t */
NPN_MemFree( npparam );
return;
......
......@@ -276,6 +276,7 @@ static const event_name_t event_list[] = {
DEF(MediaPlayerLengthChanged)
DEF(MediaPlayerMouseGrab)
DEF(MediaPlayerMouseRelease)
DEF(MediaPlayerMouseClick)
DEF(MediaListItemAdded)
DEF(MediaListWillAddItem)
......
......@@ -67,6 +67,10 @@ static int
mouse_released( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
static int
mouse_click( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
/* */
static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi );
......@@ -180,6 +184,7 @@ static vout_thread_t *get_vout_thread( libvlc_media_player_t *p_mi )
{
var_AddCallback( p_vout, "mouse-grab", mouse_grab, p_mi );
var_AddCallback( p_vout, "mouse-release", mouse_released, p_mi );
var_AddCallback( p_vout, "mouse-clicked", mouse_click, p_mi );
}
return p_vout;
......@@ -202,6 +207,7 @@ static void release_vout_thread( libvlc_media_player_t *p_mi )
var_DelCallback( p_vout, "mouse-grab", mouse_grab, p_mi );
var_DelCallback( p_vout, "mouse-release", mouse_released, p_mi );
var_DelCallback( p_vout, "mouse-clicked", mouse_click, p_mi );
vlc_object_release( p_vout );
p_mi->input.p_vout = NULL;
......@@ -421,6 +427,22 @@ mouse_released( vlc_object_t *p_this, char const *psz_cmd,
return VLC_SUCCESS;
}
static int
mouse_click( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_this);
libvlc_media_player_t *mp = p_data;
libvlc_event_t event;
event.type = libvlc_MediaPlayerMouseClick;
event.u.media_player_mouse_click.x = newval.coords.x;
event.u.media_player_mouse_click.y = newval.coords.y;
libvlc_event_send(mp->p_event_manager, &event);
return VLC_SUCCESS;
}
static input_thread_t *find_input (vlc_object_t *obj)
{
libvlc_media_player_t *mp = (libvlc_media_player_t *)obj;
......@@ -559,6 +581,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
/* mouse events */
register_event(mp, MouseGrab);
register_event(mp, MouseRelease);
register_event(mp, MouseClick);
/* Attach a var callback to the global object to provide the glue between
* vout_thread that generates the event and media_player that re-emits it
......
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