How to detect double click on video ?

This forum is about all development around libVLC.
entretoize
New Cone
New Cone
Posts: 5
Joined: 21 Dec 2015 07:38

How to detect double click on video ?

Postby entretoize » 21 Dec 2015 07:47

Hello, I'm not finding how to detect a click or double click on the video, (fullscreen/embeded), I tried googling and searching this forum but the only thing I find is that I must get clickevent, or create a video filter, but no explaination.
Can someone guide me to some documentation or links, at least ?
(I'm using C++)

Thanks

entretoize
New Cone
New Cone
Posts: 5
Joined: 21 Dec 2015 07:38

Re: How to detect double click on video ?

Postby entretoize » 22 Dec 2015 13:04

Hello again, I see it's still very hard to get help..
I finally find a way to detect double click to switch to fullscreen and I'll let that for those who are still searching:

Use a hook:

Code: Select all

wchar_t ch[256]; HWND hch=GetWindow(dialoghwnd, GW_CHILD); //searching for vlc child (the video window) while(hch) { GetClassName(hch,ch,256); if (wcsstr(ch,L"VLC")) break; hch=GetNextWindow(hch,GW_HWNDNEXT); } SetWindowsHookEx(WH_MOUSE, MouseHookProc,NULL, GetWindowThreadProcessId(hch, NULL)); //add the hook for mouse
The mouse hook proc:

Code: Select all

LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) { if(nCode >= 0 && WM_LBUTTONDBLCLK == wParam) SendMessage(hWnd,WM_LBUTTONDBLCLK,0,0); return CallNextHookEx(NULL, nCode, wParam, lParam); }
And in the main proc:

Code: Select all

case WM_LBUTTONDBLCLK: { fullscreen=!fullscreen; DWORD dwStyle = GetWindowLong(hwnd, GWL_STYLE); if (fullscreen) { MONITORINFO mi = { sizeof(mi) }; if (GetWindowPlacement(hwnd, &g_wpPrev) && GetMonitorInfo(MonitorFromWindow(hwnd,MONITOR_DEFAULTTOPRIMARY), &mi)) { SetWindowLong(hwnd, GWL_STYLE,dwStyle & ~WS_OVERLAPPEDWINDOW); SetWindowPos(hwnd, HWND_TOPMOST, mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.bottom - mi.rcMonitor.top, SWP_NOZORDER|SWP_NOOWNERZORDER | SWP_FRAMECHANGED|SWP_NOACTIVATE); } libvlc_set_fullscreen(mp,1); } else { SetWindowLong(hwnd, GWL_STYLE,dwStyle | WS_OVERLAPPEDWINDOW); SetWindowPlacement(hwnd, &g_wpPrev); SetWindowPos(hwnd, NULL, 0, 0, 0, 0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); libvlc_set_fullscreen(mp,0); } } break;
Thanks me... and coders on other website sharing the codes !
Last edited by entretoize on 22 Dec 2015 13:39, edited 1 time in total.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: How to detect double click on video ?

Postby RSATom » 22 Dec 2015 13:15

You could subclass video output window or set mouse hook(if you are on Windows) to intercept mouse events.

That's code where mouse hooks was used for same task: https://github.com/RSATom/fbvlc/blob/ma ... n.cpp#L202

Another way could be use Qt QML and my QmlVlc library
Last edited by RSATom on 22 Dec 2015 14:37, edited 1 time in total.

entretoize
New Cone
New Cone
Posts: 5
Joined: 21 Dec 2015 07:38

Re: How to detect double click on video ?

Postby entretoize » 22 Dec 2015 13:41

Thanks RSATom, in fact the window I used had elements on it catching my clics. It works now.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 15 guests