[MPlayer-cygwin] Basic help needed...

Lostgallifreyan z.crow at btinternet.com
Wed May 13 22:16:56 CEST 2015


Lostgallifreyan <z.crow at btinternet.com> wrote:
(13/05/2015 19:03)

>While I can't contribute adequate code in context, I will dig out my own mouse and key handling stuff
>later, and post it, in case it helps.

As promised, some of my methods for handling mouse and keys, in case there's any use for it. It's basic, but basic is good, less risk of things going wrong, and likely an easier time seeing if they fit in Mplayer at all. PhaseMod is a dialog based program, I'm not sure if Mplayer's main window is too, but it looks like it might be. I doubt that matters much for these messages.

I sometimes use GetAsyncKeyState(VK_CONTROL)<0) or VK_MENU for Alt key, VK_SHIFT, etc.. and especially, for VK_LBUTTON because mouse messages aren't always as timely as key presses. I like the async function because it really means 'now', if Mplayer is having trouble at times with fullscreen display of FLV, audio and video may not sync, so messages NOT async may bork too, being held up in message queues.

When trying to do fullscreen with Mplayer using CTRL-ENTER in input.conf I had overridden the normal ENTER binding with 'ignore' so skip to next in playlist did not happen. The result was 'no binding for 0xA' or something close to that statement. The code for LF is 13, 'A', so I'm assuming that it saw ENTER but not CTRL-, but I also assume it knows if CTRL is held, or it could not accept a CTRL-leftclick in windowed mode. Something appears to block the message so we can't test for CTRL ourselves. Whether this is a message queue thing I do not know, if it is, changing to GetAsyncKeystate might solve this. It's why I chose it in my work, to solve a case where its failed to get noticed when it should.

One bit of my code may best be stated by direct paste:
case WM_KEYDOWN: case WM_KEYUP: case WM_SYSKEYDOWN: case WM_SYSKEYUP:{
  ReadKeys(wParam,!(msg&1)); if((msg&~1)==WM_SYSKEYDOWN)return DefWindowProc(hwnd,msg,wParam,lParam);   //Read keys, but return Alt control to system.
} break;

This simplified things, directing to one main handler, but the Alt key bit is critical, it let me get a shot at the Alt key without conflict with Window's own interest in it. :) Once it got to ReadKeys I was able to use the Tab key as a modifier like Control, Alt, Shift, without conflict with Window's own purposes, so it's fairly versatile doing it this way. Note, ReadKeys did not test async, because the event happened earlier, in the code above..

I thought I'd used more specific mouse-up or other detections, but apparently not, I reverted to more standard methods, just WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, and WM_CONTEXTMENU, but this might be best. To emulate the behaviour of Gabsest's Media Player Classic in Mplayer, for example, we just need to get those first two, WM_LBUTTONDOWN to toggle pause state, and WM_LBUTTONDBLCLK to toggle fullscreen. WM_LBUTTONDOWN will fire twice for double-click so it works, same with WM_LBUTTONUP which might be better for emulating Windows stype clicking, also offering a way to avoid direct conflict with any existing use of WM_LBUTTONDOWN.

Another possible trick: Mplayer could be made to take WM_MOUSEMOVE and an immediate test for GetAsyncKeyState(VK_LBUTTON)<0, which will allow existing drag-while-clicking-window-contents. What it ALSO allows is a way to determing that dragging is NOT done, so we can expect a simple click in absence of dragging to pause/resume with no need to hold the CTRL key! :)

This is a long post, probably not useful to extend it, so I'll stop there.

Just a small PS:
I found that mouse button 3 and 4 seem to be equivalent to use of a mousewheel. To do that I had to try 'ignore' for each mouse buttons in the list till I found it. Nor could I ovveride ALL buttons and just look for a no-bindign report in the console, because Mplayer has its own ideas about those 'buttons' already. Mplayer seems to have hardwired configs, so I could not find this just by overriding all. I can make Mplayer spit out a list of kets and commands for binding (but I'm damnned if I can do it today, I forgot how, and Mplayer -help ain't saying nothing). In short, what I'd liek most is a SIMPLE override of ALL input, which will report a lack of binding for whatever I do, no matter what hidden methods Mplayer may have for the event. This would be extremely helpful because it will immediately identify the control with a code, and (hopefully) with a name that Mplayer will know it by when I use it in input.conf.



More information about the MPlayer-cygwin mailing list