clsid2 / mpc-hc

Media Player Classic
GNU General Public License v3.0
10.93k stars 489 forks source link

Clicking Toast notification while MPC-HC is in focus opens file dialog #2447

Closed Zerowalker closed 8 months ago

Zerowalker commented 8 months ago

As topic says.

I noticed this odd bug, if i got the player in focus and there is some toast notification, say a calendar event or something, and you click on it (not just close it), mpc-hc opens the "file dialog", i believe it's the "Quick Open File".

It's not a big deal but thought it might be good to finally post the issue, It could perhaps be something on my end, but not sure what that could be if that's the case, but it should be fairly easy to test by doing the steps above.

xLn2 commented 8 months ago

Might be related with Global Media Keys option that located at Options > Player > Keys. You might try disable this setting, restart player and computer.

adipose commented 8 months ago

https://github.com/clsid2/mpc-hc/issues/2204

Sounds much like this.

Zerowalker commented 8 months ago

Might be related with Global Media Keys option that located at Options > Player > Keys. You might try disable this setting, restart player and computer.

That one is already disabled.

clsid2 commented 8 months ago

Options > Player > Keys Change the keybinding of Quick Open File.

This is NOT a bug in MPC-HC.

You need to report it to Microsoft or to the developers of the app that shows the notification.

adipose commented 8 months ago

As topic says.

I noticed this odd bug, if i got the player in focus and there is some toast notification,

say a calendar event or something, and you click on it (not just close it), mpc-hc opens the "file dialog",

i believe it's the "Quick Open File".

It's not a big deal but thought it might be good to finally post the issue,

It could perhaps be something on my end, but not sure what that could be if that's the case,

but it should be fairly easy to test by doing the steps above.

Does it happen every time? I had trouble reproducing the other bug since I had to wait for YouTube popups.

Windows version?

Zerowalker commented 8 months ago

Windows 10 22H2 19045.3803

I actually can't seem to reproduce it, tried triggering it with the "Clock" timer app. So it's not always as I thought, will have to keep track next time it happens to see if it's a specific notification or something.

adipose commented 8 months ago

Windows 10 22H2 19045.3803

I actually can't seem to reproduce it, tried triggering it with the "Clock" timer app. So it's not always as I thought, will have to keep track next time it happens to see if it's a specific notification or something.

Thanks. In the past it had to do with Youtube/chrome toast. Something about clicking the notification was triggering a hotkey in mpc-hc, but it shouldn't be possible--unless it's just mass sending keystrokes to players registered with SMTC?

Zerowalker commented 8 months ago

It actually seems to be solved. Must have been solved quite recently. Not sure if it's MPC-HC, Windows or something on my end. But I'm quite sure the issue was there some months ago. I have updated MPC-HC whenever there's been a new release, so I'm currently on 2.1.3

clsid2 commented 8 months ago

If it comes back, let us know which app notification caused it.

Zerowalker commented 7 months ago

Okay found one that seems to trigger it. When i got an google calender notification from chrome and click "snooze" it opens the file explorer.

makedir commented 6 months ago

Oh wow, so I was right all the time and @clsid2 claimed I was imagining things claiming it was all related to media controls, where it was not. Experienced it again right now with Edge twitter notifications, having an MPC instance open, clicking "dismiss" opens "save a copy" in MPC. I am on Windows 11 23h2 22631.3155 Edge 122 and MPC 2.1.6 and I can reproduce it with 100% getting a Edge twitter notification of a twitter DM. Clicking "dismiss" and having MPC in front opens "save a copy" dialog. Minimizing MPC doesnt trigger it. If another window is in front of mpc it also doesnt happen.

Had removed key binding for "quick open" and now ironically it opens "quick open" instead of "save a copy" when clicking dismiss of the Edge or Chrome notification.

image

image

makedir commented 6 months ago

Ok this is definitely a bug in MPC. It seems if you clear a keybinding it doesnt clear it properly. 1st bug. And now comes the weird thing in combination:

I rebound quick open file with something else and now instead of quick open, clicking dismiss goes down to the next in the line and opens "open file/url" even it is empty.

image

image

If you now also change the 2nd line to something else like this:

image

clicking dismiss on the toast widow with mpc on focus now opens the 3rd line open dvd/bd gui.

image

If you now bind a key to dvd/bd, it goes to the next line opening device when pressing dismiss.

clsid2 commented 6 months ago

I see ZERO evidence of a bug in MPC-HC.

Those functions can be triggered not just by a keybinding but also by sending a window message with their ID. So Edge must be sending messages to wrong window.

makedir commented 6 months ago

@clsid2 please stop debating again where it is crystal clear this is a bug in MPC. The first one is maybe not a direct bug but I told you now the related BUG IN MPC.

image

image

And this is a really dangerous bug.

  1. bug inside mpc of not properly clearing key bindings
  2. key binding algorithm handling is bugged as seen above, jumping to next "empty" line and executing it

Chrome/Edge sending "something" to MPC, MPC executing the command from top to bottom first one which it finds with no binding in the key binding list.

if quick open file is not bound, it executes that. if it is bound and open file/url is not bound it executes that, if that one is bound and the next one not it executes that one, until it takes the one which is not bound.

clsid2 commented 6 months ago

They should not send commands to MPC-HC window.

I can't reproduce with the notifications shown by Windows 11.

Here is test site for triggering notifications: https://www.bennish.net/web-notifications.html

makedir commented 6 months ago

That one is not working. You need a notification with buttons. Twitter for example then let someone send you a direct message with tab open of twitter page and without having dms open. the toast will have a message with a reply and dismiss button. clicking dismiss with mpc in focus triggers the issue.

You need a toast like this with a button under it

image

clsid2 commented 6 months ago

Ask Elon Musk to fix his crappy X. I am not using that.

makedir commented 6 months ago

Who spit into your cornflakes when you were a child? Use something else Youtube and Edge and it will also have a dismiss button.

makedir commented 6 months ago

This one works:

https://pushalert.co/demo

Use for example or others too image

clicking the mothers day specials button triggers the issue

makedir commented 6 months ago

https://github.com/clsid2/mpc-hc/assets/6721083/b2ffe223-df15-4c0b-8672-7afb31800c6e

image

It would execute line 1, it wont because bound, goes to 2nd line, it is bound, goes to 3rd line, goes to 4th line and exxecutes open device.

clsid2 commented 6 months ago

That website does not trigger any actions in MPC-HC here. Clicking on notification just opens website as it should. I even tried setting MPC-HC to always on top.

makedir commented 6 months ago

https://github.com/clsid2/mpc-hc/assets/6721083/6667410d-c90a-4d50-b542-8fc376324631

makedir commented 6 months ago

Look what your "non existing bug" in MPC does if you have the key bindings bound like this:

image

It wants to delete the file if you click the toast button

https://github.com/clsid2/mpc-hc/assets/6721083/f645a828-f247-41ac-883e-ff43f7d043e5

clsid2 commented 6 months ago

I think it might be sending some weird mouse action. Try this: -removed-

makedir commented 6 months ago

It says it contains a virus

image

clsid2 commented 6 months ago

Wacatac is common false positive by Defender. https://www.virustotal.com/gui/file/e411daa8703569f74752e1eddd56a43b739a336151645210013e3e72bfd352e2

makedir commented 6 months ago

No, the version doesnt fix the issue. tested in a virtualbox VM where the issue also happens.

https://pushpad.xyz/demo

image

clsid2 commented 6 months ago

Try this one: mpc-hc64.zip Will show a prompt if a command get triggered.

If that fails I have another idea to try.

clsid2 commented 6 months ago

Might be fixed: mpc-hc64.zip

Seems like a bug in Windows.

adipose commented 6 months ago

Is it executing unbound actions? Maybe sent globally with null action?

adipose commented 6 months ago

please stop debating again where it is crystal clear this is a bug in MPC.

It may be a bug in mpc-hc or not. It is certainly undesired behavior. But as it was never an issue before Windows 10 toast popups, the question is whether it is rightly called a bug or simply designed without awareness of a future Windows feature, which may interfere with Accelerators.

https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-accel

If Windows is sending mpc-hc signals that are being interpreted as accelerators, is that a Windows bug or an mpc-hc bug? And if it is a Windows bug, do we have the ability to identify when it was sent by windows or the user? We must answer these questions to solve the problem and the dilemma!

clsid2 commented 6 months ago

Are you able to reproduce it? Because I still can't.

I suspect that Windows is somehow matching against a null value in the accel list. That is of course a major bug. Plus the fact that is trying to send a (keypress) action to MPC window when pressing on a toast button is another bug. But anyway, I have taken some measures against Windows stupidness that will hopefully fix the problem.

makedir commented 6 months ago

Might be fixed:

yes that last one seems to fix the issue

adipose commented 6 months ago

Are you able to reproduce it? Because I still can't.

Nope, not so far.

adipose commented 6 months ago

With global media keys enabled, using the Chrome notifications, I can get a windows message WM_HOTKEY with APPCOMMAND_MEDIA_PLAY, even though the notification is only supposed to open a browser link.

adipose commented 6 months ago

Further, I was able to APPCOMMAND_MEDIA_PAUSE by disabling APPCOMMAND_MEDIA_PLAY. It seems as if it sends a global APPCOMMAND to every window with the first registered APPCOMMAND.

makedir commented 6 months ago

Like I said. This issue has nothing to do with media keys, never had media remote on in MPC as seen on the example videos above, it was obviously a bug in MPC which @clsid2 seems to has fixed. Not just that MPC executed commands by receiving something but also the list which goes through until finding an empty command binding and then executes that. maybe another bug in MPC that the option for global media keys is ignored.

adipose commented 6 months ago

Like I said. This issue has nothing to do with media keys, never had media remote on in MPC as seen on the example videos above, it was obviously a bug in MPC which @clsid2 seems to has fixed. Not just that MPC executed commands by receiving something but also the list which goes through until finding an empty command binding and then executes that. maybe another bug in MPC that the option for global media keys is ignored.

I disagree. There is no reason for windows to send global media keys appcommand to MPC-HC when you click on a chrome notification. I just reproduced this. Once I understand it better, I will submit a bug to Microsoft.

makedir commented 6 months ago

I disagree.

what do you disagree on again? so it s a magic trick that it happens with no option activated in MPC:

image

adipose commented 6 months ago

@clsid2 ,

I have been able to find a kind of workaround for the issue I found. If you use this (before registering other commands):

RegisterHotKey(m_pMainWnd->m_hWnd, 0xFFFF, 0, 0);

Then the chrome notifications send 0xFFFF wParam instead. This can be dropped the same as we drop wParam=0.

If you don't register it, the first one you register gets sent by the toast click.

adipose commented 6 months ago

I disagree.

what do you disagree on again? so it s a magic trick that it happens with no option activated in MPC:

image

The global media keys is one issue I can reproduce, but I cannot reproduce your specific issue. If I could get access to your machine I'd happily debug what windows messages are coming to your app.

The fact that Windows sends garbage media keys when you click on a notification is enough to prove Microsoft has a major bug with how the toast notifications are being processed. So I wouldn't be at all surprised if they did something else stupid, here. Like, they see that you have NO registered app commands, so they instead send you other kinds of ACCEL commands in an attempt to "integrate" with running applications.

Bottom line, there is no reason to send me an app command because someone wants to click on a chrome popup. But they do it anyway.

You are making assumptions without understanding how it works. MPC-HC is REGISTERING hotkeys with Windows. Windows, in turn, NOTIFIES MPC-HC that the key has been pressed. We do not control Windows decisions on this. When you clear a hotkey and the next hotkey runs instead, it may be a similar behavior to the one I just described about app commands (those are different, only work with global media keys, but similar concept).

makedir commented 6 months ago

If I could get access to your machine

what do you mean my machine? I can reproduce it with 100% chance on any Windows 11 PC, even in virtual machine in virtualbox as seen above.

adipose commented 6 months ago

I can never reproduce it. Send me the VM that can repro it.

makedir commented 6 months ago

I cant, it contains my Windows key and private information and the vm storage file is 60gb in size. It is a fresh Windows 11 installation though. I just installed it some days ago.

image

Send me a debug file I can execute in the vm which tells you the information you want.

adipose commented 6 months ago

In the past I couldn't reproduce this on windows 10 or 11. Fresh doesn't mean you didn't install anything, etc.

Something is different for you but I don't know what, yet.

Clsid2 has a workaround but the actual bug is unclear.

makedir commented 6 months ago

Nope. Nothing installed or changed on the VM

image

Thats all.

makedir commented 6 months ago

Tell me what I shall do to give you the information, what would Teamviewer be useful for.

makedir commented 6 months ago

do you have telegram or discord chat (no voice call) or something maybe we can do tv but what would you want to do on it then

makedir commented 6 months ago

I asked how you would do that. do you have discord or telegram or not. give me yours so I can give you the teamiewer data.

clsid2 commented 6 months ago

Maybe a tiny standalone demo app would be more useful for bug reporting to Microsoft. A basic MFC GUI app that registers some hotkeys and key accels. Then also easy to log all incoming commands.