Page 1 of 1

i can't Catch mouse events vlc 1.1.5 in Qt,please help me!

Posted: 02 Aug 2011 05:57
by mxturing
recently,'m using windows 7, QT 4.7.3 and vlc 1.1.5 ,but i can't catch the mouse clic events over the video in a widget!

i knew vlc_media_player's events happens in its own threads,how can i catch it events?

or ,there are other solution?
please ,help me!

Re: i can't Catch mouse events vlc 1.1.5 in Qt,please help m

Posted: 02 Aug 2011 08:56
by Rémi Denis-Courmont
On Windows, I'm not sure. You might need to improve/extend the event handling in the Windows video output plugins.

Re: i can't Catch mouse events vlc 1.1.5 in Qt,please help m

Posted: 02 Aug 2011 10:16
by mxturing
On Windows, I'm not sure. You might need to improve/extend the event handling in the Windows video output plugins.
thanks your reply!

but how to?could you tell me some details?

Re: i can't Catch mouse events vlc 1.1.5 in Qt,please help m

Posted: 02 Aug 2011 12:18
by Rémi Denis-Courmont
Write code?

Re: i can't Catch mouse events vlc 1.1.5 in Qt,please help m

Posted: 03 Aug 2011 06:26
by devildrey33
I use a trick in C under windows to get mouse and key events, this consists on disable Vlc Window using EnableWindow API and later get events from their parent window. Ofcourse this trick disables automatic fullscreen and you need to write code for it in doubleclick event resizing the parent and vlc window.

Im not familiarized with QT and cant help more with their functions, but if you need more information about this 'trick' and windows API i can explain better this process.

Sorry for my poor english.

Re: i can't Catch mouse events vlc 1.1.5 in Qt,please help m

Posted: 03 Aug 2011 09:53
by mxturing
I use a trick in C under windows to get mouse and key events, this consists on disable Vlc Window using EnableWindow API and later get events from their parent window. Ofcourse this trick disables automatic fullscreen and you need to write code for it in doubleclick event resizing the parent and vlc window.

Im not familiarized with QT and cant help more with their functions, but if you need more information about this 'trick' and windows API i can explain better this process.

Sorry for my poor english.
oh,thanks for your reply!

could you please show me some code about your trick?

becase i don't know how to get the events from the vlc apis!

Re: i can't Catch mouse events vlc 1.1.5 in Qt,please help m

Posted: 03 Aug 2011 17:36
by devildrey33
Ok, vlc creates two child windows into window you pass in the libvlc_media_player_set_hwnd function every time you play a video. One of these windows is maked to get mouse events, and the other window is used to output the video.

Windows schema :
1 MyWindow
2 -VlcEnvetWindow
3 --VlcOutputWindow

You need get handle of VlcEventWindow. To get these handle i use a timer when video starts to play and into these timer i use EnumChildWindows passing in the hWnd MyWindow to search the inmediate child. I use a timer because vlc windows take some time to be created.

Code: Select all

// First step is start a timer when you play a video, // Second step : in the timer function i call : EnumChildWindows(MyWindow_HWND, EnumerateVLC, NULL); // Third step : if EnumerateVlc get some child window these window is the VlcEventWindow, and need disable it, to reach mouse events on MyWindow BOOL CALLBACK EnumerateVLC(HWND hWndvlc, LPARAM lParam) { EnableWindow(hWndvlc, FALSE); // And kill timer, i only need get this handle one time. return TRUE; } // When EnumerateVLC is called all mouse events are redirected to MyWindow
And remember, when you stop/finish the video vlcwindows are destroyed, and you need to get new handle every time after this ocours on your play function.

Another thing is, when you pause the video, vlcwindows are not destroyed, and its not necesary get VlcEventWindow handle again.

Sorry for my poor english again, and Good luck.

Re: i can't Catch mouse events vlc 1.1.5 in Qt,please help m

Posted: 04 Aug 2011 10:48
by mxturing
Ok, vlc creates two child windows into window you pass in the libvlc_media_player_set_hwnd function every time you play a video. One of these windows is maked to get mouse events, and the other window is used to output the video.

Windows schema :
1 MyWindow
2 -VlcEnvetWindow
3 --VlcOutputWindow

You need get handle of VlcEventWindow. To get these handle i use a timer when video starts to play and into these timer i use EnumChildWindows passing in the hWnd MyWindow to search the inmediate child. I use a timer because vlc windows take some time to be created.

Code: Select all

// First step is start a timer when you play a video, // Second step : in the timer function i call : EnumChildWindows(MyWindow_HWND, EnumerateVLC, NULL); // Third step : if EnumerateVlc get some child window these window is the VlcEventWindow, and need disable it, to reach mouse events on MyWindow BOOL CALLBACK EnumerateVLC(HWND hWndvlc, LPARAM lParam) { EnableWindow(hWndvlc, FALSE); // And kill timer, i only need get this handle one time. return TRUE; } // When EnumerateVLC is called all mouse events are redirected to MyWindow
And remember, when you stop/finish the video vlcwindows are destroyed, and you need to get new handle every time after this ocours on your play function.

Another thing is, when you pause the video, vlcwindows are not destroyed, and its not necesary get VlcEventWindow handle again.

Sorry for my poor english again, and Good luck.
thanks your answer!i had get events! :lol:

Re: i can't Catch mouse events vlc 1.1.5 in Qt,please help m

Posted: 04 Aug 2011 22:43
by erwan10
I just committed a patch for the vlc1.1 and vlc1.2 series that does this job of disabling vlc windows when libvlc developper specifies both mouse and keyboard support to be disabled via the libvlc api.

So no more need for this hack in future versions.

Re: i can't Catch mouse events vlc 1.1.5 in Qt,please help m

Posted: 05 Aug 2011 05:19
by devildrey33
for mxturing : im glad to be usefull.

for erwan10 : Very interesting :), thank you. I will try this new patch when i have some time.