Page 1 of 1

Detect mouse motion gtk

Posted: 27 Dec 2019 15:48
by MickeyMoneysac
Hi all,

first of all i just want to say a big thankyou to the developers from videolan for building such a great, easy to use media framework!
Developing a simple gtk media player i want to hide the controls in fullscreen mode. However when the user moves the mouse the controls should reappear for some time. Using the “motion-notify-event” is not a way because this interferes with the dvd menu navigation from libvlc.
So then I found
[url=https://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__video.html#gae9e67bc9137941aa621d3febf2ce95da]libvlc_video_set_mouse_input()[/url]
to be the perfect solution, but when embedding the libvlc video to a drawing area with

Code: Select all

libvlc_media_player_set_xwindow(media_player, GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(drawing_area)))) ;
the position of the mouse is only detected when clickin on the drawing area.
If you do not call libvlc_media_player_set_xwindow vlc opens a new window and then mouse movement is detected always without the need of clicking. So my question is, how do i make libvlc_video_get_cursor() returning the position of the mouse when it is only hovering over the GtkDrawingArea without clicking on it or any other suggestion (such as an event) to detect mouse movement.

Thanks in advance

MickeyMoneysac

Re: Detect mouse motion gtk

Posted: 27 Dec 2019 23:40
by MickeyMoneysac
It had to happen this way.
I could not find a solution for two hours and now twenty minutes after posing this question I noticed that I forgot to delete one gtk motion event line
gtk_widget_set_events (GTK_WIDGET(drawing_area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK) ;
which destroyed the libvlc mouse detection. Now everything is running so smooth.
Thank you very much for the greatest media framework out there.

Wishes

MickeyMoneysac