X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fremoteosd.c;h=2361be612129b611161a2c354f8abf39af290640;hb=5072a6cf46f1ae67f4ad1098a00b222d6aefc0eb;hp=bd3d0d0529ae65ce4aaa336b73f5eafa8544fa27;hpb=83e3e91f9c7b021b5da8bf8c6c6cd8dc0a1ce763;p=vlc diff --git a/modules/video_filter/remoteosd.c b/modules/video_filter/remoteosd.c index bd3d0d0529..2361be6121 100644 --- a/modules/video_filter/remoteosd.c +++ b/modules/video_filter/remoteosd.c @@ -1172,12 +1172,14 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) vlc_mutex_unlock( &p_sys->lock ); /* set to one of the 9 relative locations */ - p_region->i_align = 0; //=CENTER + p_region->i_align = 0; /* Center */ p_spu->b_absolute = false; p_spu->i_x = 0; p_spu->i_y = 0; + p_spu->i_original_picture_width = 0; /*Let vout core do the horizontal scaling */ + p_spu->i_original_picture_height = fmt.i_height; p_spu->p_region = p_region; @@ -1338,31 +1340,39 @@ static int MouseEvent( vlc_object_t *p_this, char const *psz_var, int i_x, i_y; int i_v; - int v_h = p_vout->output.i_height; - int v_w = p_vout->output.i_width; i_v = var_GetInteger( p_sys->p_vout, "mouse-button-down" ); i_y = var_GetInteger( p_sys->p_vout, "mouse-y" ); i_x = var_GetInteger( p_sys->p_vout, "mouse-x" ); + vlc_mutex_lock( &p_sys->lock ); + + const int v_h = p_vout->fmt_in.i_visible_height; + const int v_w = p_sys->i_vnc_width * v_h / p_sys->i_vnc_height; + const int v_x = (p_vout->fmt_in.i_visible_width-v_w)/2; + + i_x -= v_x; + if( i_y < 0 || i_x < 0 || i_y >= v_h || i_x >= v_w ) { - msg_Dbg( p_this, "invalid mouse event? x=%d y=%d btn=%x", i_x, i_y, i_v ); - return VLC_SUCCESS; + vlc_mutex_unlock( &p_sys->lock ); + msg_Dbg( p_this, "invalid mouse event? x=%d y=%d btn=%x", i_x, i_y, i_v ); + return VLC_SUCCESS; } -#ifdef VNC_DEBUG - msg_Dbg( p_this, "mouse event x=%d y=%d btn=%x", i_x, i_y, i_v ); -#endif - - /* FIXME: calculate x and y coordinates for scaled output */ - - vlc_mutex_lock( &p_sys->lock ); if( !p_sys->b_connection_active ) { vlc_mutex_unlock( &p_sys->lock ); return VLC_SUCCESS; } +#ifdef VNC_DEBUG + msg_Dbg( p_this, "mouse event x=%d y=%d btn=%x", i_x, i_y, i_v ); +#endif + + /* */ + i_x = i_x * p_sys->i_vnc_width / v_w; + i_y = i_y * p_sys->i_vnc_height / v_h; + /* buttonMask bits 0-7 are buttons 1-8, 0=up, 1=down */ rfbPointerEventMsg ev; ev.type = rfbPointerEvent;