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

This forum is about all development around libVLC.
mxturing
New Cone
New Cone
Posts: 4
Joined: 01 Aug 2011 07:39

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

Postby mxturing » 02 Aug 2011 05:57

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!

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 02 Aug 2011 08:56

On Windows, I'm not sure. You might need to improve/extend the event handling in the Windows video output plugins.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

mxturing
New Cone
New Cone
Posts: 4
Joined: 01 Aug 2011 07:39

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

Postby mxturing » 02 Aug 2011 10:16

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?

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 02 Aug 2011 12:18

Write code?
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

devildrey33
Blank Cone
Blank Cone
Posts: 11
Joined: 07 Dec 2010 17:06
Operating System: Windows & Linux
Location: Spain

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

Postby devildrey33 » 03 Aug 2011 06:26

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.
http://www.devildrey33.es

mxturing
New Cone
New Cone
Posts: 4
Joined: 01 Aug 2011 07:39

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

Postby mxturing » 03 Aug 2011 09:53

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!

devildrey33
Blank Cone
Blank Cone
Posts: 11
Joined: 07 Dec 2010 17:06
Operating System: Windows & Linux
Location: Spain

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

Postby devildrey33 » 03 Aug 2011 17:36

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.
http://www.devildrey33.es

mxturing
New Cone
New Cone
Posts: 4
Joined: 01 Aug 2011 07:39

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

Postby mxturing » 04 Aug 2011 10:48

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:

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

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

Postby erwan10 » 04 Aug 2011 22:43

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.

devildrey33
Blank Cone
Blank Cone
Posts: 11
Joined: 07 Dec 2010 17:06
Operating System: Windows & Linux
Location: Spain

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

Postby devildrey33 » 05 Aug 2011 05:19

for mxturing : im glad to be usefull.

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


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 8 guests