1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-09 06:15:49 +02:00

Fix unreliable unfocused notification window scroll wheel hook

This commit is contained in:
chylex 2016-07-09 21:33:46 +02:00
parent 2de5d6206e
commit 971affa607

View File

@ -127,8 +127,12 @@ protected override void WndProc(ref Message m){
}
private IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam){
if (!Focused && wParam.ToInt32() == NativeMethods.WH_MOUSEWHEEL && browser.Bounds.Contains(PointToClient(Cursor.Position))){
Focus();
if (!ContainsFocus && wParam.ToInt32() == NativeMethods.WH_MOUSEWHEEL && browser.Bounds.Contains(PointToClient(Cursor.Position))){
// fuck it, Activate() doesn't work with this
Point prevPos = Cursor.Position;
NativeMethods.SimulateMouseClick(NativeMethods.MouseButton.Left);
Cursor.Position = PointToScreen(new Point(-1,-1));
Cursor.Position = prevPos;
}
return NativeMethods.CallNextHookEx(mouseHook,nCode,wParam,lParam);