mzomparelli / zVirtualDesktop

Windows 10 Virtual Desktop Hotkeys, System Tray Icon, Wallpapers, and Task View replacement
461 stars 45 forks source link

Mouse Hook occasionally causes mouse to stop clicking in any window except one #253

Open altrahm opened 4 years ago

altrahm commented 4 years ago

This is a strange bug, but I've had it happen on multiple computers where zVD is the only thing in common, so I'm pretty sure it's the cause. What happens is I can only click on a single application. I can move the mouse normally, but if I try and click on any other window, the click doesn't work and that window loses focus. If I close the one window that works, then the next window I click on will work, but only that window. I just had it happen while switching desktops (with the keyboard, but mouse hook enabled; I've disabled it for now so I'll update if this bug happens again without it), and when I tried opening the zVD settings (which wasn't easy without the mouse), I got the error below


just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'FlowLayoutPanel'.
   at System.Windows.Forms.Control.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4075.0 built by: NET48REL1LAST
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
zVirtualDesktop
    Assembly Version: 1.0.94.0
    Win32 Version: 1.0.94.0
    CodeBase: file:///C:/Utilities/zVirtualDesktop/zVirtualDesktop.exe
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4042.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4110.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
PresentationCore
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4110.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/PresentationCore/v4.0_4.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
WindowsBase
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4110.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3825.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
System.ServiceModel
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3825.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ServiceModel/v4.0_4.0.0.0__b77a5c561934e089/System.ServiceModel.dll
----------------------------------------
SMDiagnostics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3825.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/SMDiagnostics/v4.0_4.0.0.0__b77a5c561934e089/SMDiagnostics.dll
----------------------------------------
System.ServiceModel.Internals
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3825.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ServiceModel.Internals/v4.0_4.0.0.0__31bf3856ad364e35/System.ServiceModel.Internals.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Transactions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.IdentityModel
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3825.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.IdentityModel/v4.0_4.0.0.0__b77a5c561934e089/System.IdentityModel.dll
----------------------------------------
ef383d6a-5db8-4d78-8195-284c0019068b
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.94.0
    CodeBase: file:///C:/Utilities/zVirtualDesktop/zVirtualDesktop.exe
----------------------------------------
System.Net.Http
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Net.Http/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll
----------------------------------------
System.Management
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.```

I clicked continue on the dialogue box and the settings opened, but I wasn't able to switch from the "Hotkeys" tab with just the keyboard (this is also a bug that should be fixed), so I had to close explorer since, at the moment, the taskbar was the only thing I could click on, and then I was able to disable the mouse hook and re-open explorer. This fixed it (though I still can't click on the start menu until I restart). I've tried just restarting explorer in the past and it doesn't fix it (though sometimes things work while explorer is closed but stop again when I re-open it) and I've tried just closing zVD, which didn't seem to help in the past, so it's hard to exactly isolate the bug. 
I'll update with new info if/when it happens again.
mzomparelli commented 4 years ago

Thank you for the detailed stack trace. How often does this happen? This actually looks like it might be related to DekstopView. I don't believe I'm using the FlowLayoutPanel anywhere else. I'll look into this further. Please let me know if it happens again and maybe you can find a pattern or something.

altrahm commented 4 years ago

It doesn't happen often, maybe once a week. I've turned the mouse hook off for now, I'll turn it back on in a couple of weeks and see if it starts happening again (or let you know if it happens while the mouse hook's off)

mzomparelli commented 4 years ago

FYI, zVD should default to open settings with WIN+S. This should allow you to get into the settings without the mouse. You can change that hotkey anytime. I have not experienced this issue but I will keep watching for it. Post more details if and when you can. Try to link it to another app running maybe. Possibly a conflict.

altrahm commented 4 years ago

Alright, this hasn't happened since I turned it off. Today I turned the mouse hook back on and switched desktops using the mouse a bunch of times and it immediately happened. Also, WIN+S did work, but I couldn't actually select the "Enable mouse hook" checkbox with just the keyboard.

mzomparelli commented 4 years ago

Can you send the stack trace again? I want to compare to the original.

mzomparelli commented 4 years ago

I've added a new feature that will allow you to navigate the settings menu using the up and down arrow keys. Once on the hook tab you can use the tab key to get to the hook checkboxes. I have not published this build yet but it's coming soon.

mzomparelli commented 4 years ago

I might change this to page up and down instead of up and down arrows.

mzomparelli commented 4 years ago

I just published a new version that will allow you to use page up / page down to navigate the settings tabs. I know this doesn't fix your issue but at least will allow you to toggle the settings using only the keyboard.

altrahm commented 4 years ago

Ok it happened again. Didn't get a stack trace since it didn't crash. Closing zVD through task manager didn't fix the problem but reopening it did. Before that I also tried disabling/reenabling the mouse hook with the new shortcuts you mentioned above (thanks btw!), which also didn't work.

I've also noticed that having the mouse hook enabled affects mouse sensitivity in video games, which is strange. I always have to close zVD before playing any game that captures the mouse. Maybe I should open that in a separate issue?

mzomparelli commented 4 years ago

So closing zVD didn't fix the mouse issue immediately? The mouse didn''t start to function again until running zVD again, after closing?

The mouse issue you describe during game-play is a known issue. Basically what's happening is zVD isn't given enough processing power to process the mouse events. The higher the mouse's DPI the more prominent this issue will be. This is because the higher the DPI the more events that come though. Disabling the mouse hook during game-play should work. I used to have an option where the mouse hook would only turn on when a modifier was pressed. I'm probably going to bring that back.

altrahm commented 4 years ago

That's correct. In the past when this issue came up, closing zVD never fixed it immediately (though it eventually would go away), but I never tried reopening zVD while the problem was still happening. If it happens again I'll try the same thing and see if it fixes it.

And a modifier key would be great, esp. if it could be multiple keys (e.g. alt+; for me)

mzomparelli commented 4 years ago

so it would turn on for any and or all modifiers. I'll work on putting that back in.

As far as the issue though. do you have any left-click hotkeys? If so can you provide the entire hotkey and action type? I might have an idea to what is going on. Still, I can't understand how it doesn't come back immediately after closing zVD. That sounds like a conflict with other software maybe.

mzomparelli commented 4 years ago

Rereading your previous posts I’m surprised I’m just now asking for the actual hotkeys you’re using. Please send any hotkeys you have that involve the mouse. The action type will be helpful too.

altrahm commented 4 years ago

Screenshot (15) These are the browser back/forward buttons on my mouse, activated when hovering over the taskbar to switch back/forward through desktops

EDIT: Oh also this one Screenshot (16)

altrahm commented 4 years ago

My best guess for a conflict would be displayfusion, for which I also have a mouse hook (middle clicking the title bar of a window moves it to the other monitor)

mzomparelli commented 4 years ago

I will test more with your hotkeys.

Is this the only reason you still use DisplayFusion? I can add functionality do do this in zVD. The only issue is it's easy when the user only has two monitors. What does display fusion do when you have 3?

altrahm commented 4 years ago

No, I use it for quite a lot. I think displayfusion just loops the window to the next highest monitor number, but I'm not sure.