topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 7:43 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: work around for middle button not working on X64 Win 7 Logitech mouse  (Read 56358 times)

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
Since several versions back I have been having problems with using the middle button to toggle visibility. This is on a Windows 7 64bit computer with an old Logitech mouse. It would work for a short while then stop. Sometimes the reconnect mouse function helped, other times not and required restarting circle dock. I had tried adding modifier keys like shift and ctrl to no avail. I had tried finding different drivers and that didn't help either. I had tried several different macro programs to trigger a keystroke combo on middle mouse and that didn't work.

finally I tried X-mouse Button Control. Its a program that lets you remap mouse buttons to some other function. I have not looked into how it works, but it fixes the problem. I set middle mouse button down to send "ctr shift F7" and it has worked for 2 days without a single hiccup.

I believe this should work with any mouse not just Logitech.

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
Markham - I read up on X-mouse a little more and found out a little something that may interest you. X-mouse is free, but not open source so I am just going on what I found from the site. According to the site he says he is using  SetWindowsHookEx() to read outputs from the drivers, so it should be hardware agnostic. I think you had said that is what CD uses correct? How much of that code is from VIP verses new that you wrote? Maybe something to dig into for a slightly different implementation under x64 could fix the issue? I am grasping there, without seeing the code. If you like I would be happy to look over the source and research MSDN and other resources some.

sgtevmckay

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 838
  • Magis Esse
    • View Profile
    • Rainmeter
    • Read more about this member.
    • Donate to Member
Also, as defined here ( https://www.donation....msg197660#msg197660 ), I have utilized setpoint tools , by Logitech, to compensate....I have been working flawlessly since. I am also on a Windows 7 64bit system

I was wondering if "X-mouse Button Control" would produce similar results.
Thanks for the confirmation  :Thmbsup:

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
setpoint didn't work for me.

sgtevmckay

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 838
  • Magis Esse
    • View Profile
    • Rainmeter
    • Read more about this member.
    • Donate to Member
Is it because there is no SetPoint tools available for your mouse, or SetPoint did not correct the issue???
You had mentioned your mouse is "Older" (???)

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
no current setpoint for my mouse. I had tried older versions of logitech software and they didn't work.

Markham

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 404
    • View Profile
    • Circle Dock
    • Donate to Member
Worick and Sarge:

Thank you for looking at this issue. Like the "X_Mouse Button Control" utility, Circle Dock does use SetWindowsHookEx() to insert its handlers into the chain. The problem was that the hook was somehow getting lost in certain circumstances - usually on Windows 7-64bit. Unfortunately it was - and still is - an issue I can not replicate here.

However I have been reading up more about dotNet and in particular about its automatic Garbage Collection. This examines the application's working space, frees no-longer-required variable space and reorganises the working space so that the freed areas are joined to produce larger blocks which are then deallocated to the OS pool. Now C# doesn't have pointers per-se but it does have "Delegates" (which are a hybrid equivalent to C/C++'s pointers) and as SetWindowsHookEx() requires a pointer to a function, what is actually passed is a delegate to that function. It appears that the Garbage Collector was freeing the delegates - since they themselves are never referenced again - even though they pointed to the internal handler. Everything I had read previously seemed to suggest that delegates were preserved: obviously not!

Fortunately you can tell the Garbage Collector not to mess with certain objects using GC.KeepAlive(ObjectName) - but this has to be done within the same routine as the delegate is declared. I have added such calls to the keyboard and mouse handling routines. Both the 32-bit and 64-bit versions are working flawlessly here and I'm really hoping that this finally fixes the issue once and for all.

Here's the 64-bit executable modified as above: perhaps you would test this version without the use of any third-party utilities, such as X-Mouse Button and SetPoint, and let me know your findings.

Mark

[attachment Removed][/attachment]
« Last Edit: March 22, 2010, 12:05 AM by Markham »

joby_toss

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
Thank you for this test version!

It works fine for me ... but something strange happened! I reverted to the original .exe and guess what?! That one works fine now, to!  :huh:

How is this possible? Could this issue be related to something in the settings that your new .exe corrected (or something stayed in memory longer - I'll try later with a system restart in between the switch)?
I'm puzzled!  :)

The two executables work OK for me now.

Windows7x64 ----- CircleDock 1.5.5.16
I am a 3D body trapping a single dimension soul.

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
Downloaded and testing now. No 3rd party apps. Initially it seems to be working. I'll use it for a day and report back.

Markham

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 404
    • View Profile
    • Circle Dock
    • Donate to Member
There was an unfortunate bug in the 64-bit executable I uploaded to this thread yesterday which made it difficult to return from a lower level to a higher, or top level - the left mouse button wasn't acted upon when clicking on a lower level's Centre Button. This, incidentally, was caused by an "else" clause being in slightly the wrong place which came about when I added enhancements to the Centre Button handling. (The Centre Button can now be configured to provide to do other actions than show the Start Menu.)

I have revised the global mouse handling routines and removed the automatic "repair" facility which is no longer required and was actually causing more problems than it fixed. Should you lose touch with the mouse, one of the Tray Icon's context menu items can do this manually. However, I think it's unlikely you'll use this!

I have added a new configuration item to "Visibility" (General Settings), "Do not pass mouse toggle on to other applications". The recommended setting is to enable this option which reserves the mouse button used for toggling the dock's visibility for Circle Dock's private use. This prevents unwanted side-effects particularly noticeable when the middle button performs this function and the foreground application uses the middle button to set scrolling (eg Microsoft Office, Open Office, Firefox etc).

A revised beta of the 64-bit executable is attached. Do NOT download this unless your Circle Dock configuration is set for the default (English) language; please wait for the official v1.56 release. Updated language files are not included.



Mark
« Last Edit: March 23, 2010, 01:50 PM by Markham »

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
ah nice. Thanks again Markham. I did run into a few issues with the exe you posted yesterday. I'll try this new one out tonight and report back. I think the fixes you put in will probably address the issues I had. I'll post more info if not.

joby_toss

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
The middle button toggle works, but CD still "steals" it from other apps (Opera for example - no page scroll, no tab close on middle click) - with or without that new option checked.
I am a 3D body trapping a single dimension soul.

Markham

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 404
    • View Profile
    • Circle Dock
    • Donate to Member
The middle button toggle works, but CD still "steals" it from other apps (Opera for example - no page scroll, no tab close on middle click) - with or without that new option checked.
That can happen if you've configured Circle Dock to be the top-most application. It's not the mouse-click that is stolen but rather the application focus. Try setting the Z-Order to "Normal".



Mark

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
I unfortunately do still loose middle mouse toggle but it seems to only fail from active usage. Previously if I left the computer unused for 10+ minutes CD would almost never toggle when I used it next. Now it rarely/never seems to fail when unused for some time. It only fails when recently toggled. Oddly though it seems to self repair sometimes now. It stops working for a few minutes then works again for a while. I believe you said you had removed the timed hook repair though. Without restarting CD I have had it cycle through middle toggle working then not working 3 times so far.

*** Something that may help track this down *** When middle click toggle is not working, other apps do NOT register the middle click. Something is still intercepting it. As soon as I quite CD the other apps register the middle clicks. That may indicate a different part of code is contributing to the issue.

A few improvements I did notice:
Adding a modifier key like CTR now works correctly. Previously if I had a modifier key checked I could still toggle without pressing the key. It now correctly requires the key to be pressed.
The splash image when opening dock settings looks much better now. I know that is pretty minor but those little things count too.

Markham

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 404
    • View Profile
    • Circle Dock
    • Donate to Member
*** Something that may help track this down *** When middle click toggle is not working, other apps do NOT register the middle click. Something is still intercepting it. As soon as I quite CD the other apps register the middle clicks. That may indicate a different part of code is contributing to the issue.

Thanks for that! It does give me a clue as to where to start looking! It seems that the dotNet Garbage Collector is interfering with the low-level, global mouse event handler. I have added some protection to the various handles and delegates (ie the pointers to the callback routines); I have also forced Garbage Collection to occur immediately before setting the global hooks. Together I hope this will overcome the problem.

To test this, I have added a label to the Toggle Button and I'd greatly appreciate you testing the attached beta with the following settings:
  • On the Visibility Tab ("Toggle Visibility"), enable Show Toggle Button when hidden
  • On the Visibility Tab ("Show Dock"), enable any one (or more) of the Show Dock when I Move My Mouse to" options but choose an edge that you're unlikely to venture too close to under normal circumstances.

You can now hide the Dock and move the Toggle Button to a convenient location on the screen such that its label is visible. The label will continuously report on three mouse activities:
  • As you move the mouse pointer around the screen, the Pointer's X and Y positions are shown
  • When a mouse button is pressed, the label will report "Mouse ButtonID Down", so when you press the middle button - to toggle visibility - you should see "Mouse Middle Down"
  • When a mouse button is released, the label reports "Mouse ButtonID Up"
All these reports come directly from the low-level handler, so we should now get some idea if and when the event handler stops working. These are the only three global mouse events Circle Dock is interested in, it doesn't care about double-clicks or any movement of the mouse scroll wheel. The latter is only monitored when the Dock has focus and Circle Dock uses normal Windows Forms reporting.

Adding a modifier key like CTR now works correctly. Previously if I had a modifier key checked I could still toggle without pressing the key. It now correctly requires the key to be pressed.
Ah! That's interesting. I have also made similar modifications to the keyboard handler.

The splash image when opening dock settings looks much better now. I know that is pretty minor but those little things count too.
I agree, it's a better image :)




Mark
« Last Edit: March 24, 2010, 12:05 PM by Markham »

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
awesome. Testing now.

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
wow, took a couple of hours to get a first failure this time. When it did the toggle button label still correctly tracked mouse middle down and mouse middle up. No CD visibility toggle though. I could use the toggle button, screen edge, and the tray icon to toggle visibility. Middle mouse toggle function came back after about 1-2 min then went out again in around a minute then came back again, and has been out for about 10 minutes now.

I can say at all times the label reacted instantly and correctly to mouse middle down and up.

joby_toss

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
That can happen if you've configured Circle Dock to be the top-most application. It's not the mouse-click that is stolen but rather the application focus. Try setting the Z-Order to "Normal".
Mark
Yes, that was it!
Thank you!
I am a 3D body trapping a single dimension soul.

Markham

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 404
    • View Profile
    • Circle Dock
    • Donate to Member
wow, took a couple of hours to get a first failure this time. When it did the toggle button label still correctly tracked mouse middle down and mouse middle up. No CD visibility toggle though. I could use the toggle button, screen edge, and the tray icon to toggle visibility. Middle mouse toggle function came back after about 1-2 min then went out again in around a minute then came back again, and has been out for about 10 minutes now.

I can say at all times the label reacted instantly and correctly to mouse middle down and up.

That's all good information, many thanks!

Your findings confirm that the problems with the global mouse handler have been fixed. But since you found that whilst mouse clicks were being reported, those for the middle button sometimes did not toggle the visibility. Since the reporting and the calls to toggle the visibility are in the same event handler:
       private void OnGlobalMouseUp(object sender, MouseEventExtArgs e)
        {
            ReportMouse(e, "Up");
            if ((e.Button == MouseToggleButton) &&
                (MouseModifier == DockSettings.Toggling.VisibilityMouseModifier))
            {
                ToggleVisiblity();
                BackgroundObject.Activate();
                CentreObject.Activate();
                e.Handled = DockSettings.Toggling.DontPassToggleToOtherApps;
            }
        }
it meant that either MouseToggleButton or MouseModifier, both of which are local variables, were being optimised-out of the resident image when Circle Dock is hidden and most of its memory image is swapped to Virtual Memory. The fact that this is intermittent supports this. I've now made those static variables to prevent them being swapped-out.

Today's beta contains those changes and there's now no longer any need to have the mouse toggle the Dock's visibility at a screen edge. There's a new option in Elements -> Toggle Button that turns on/off the mouse clicks/position reporting. I like this option so I'll probably keep it in for the release! If you see the new Toggle Button label, you'll notice it uses another nice change: multi-line item labels.

Again, the attached file is an English-only Windows 64-bit executable.


Mark
« Last Edit: March 26, 2010, 04:38 AM by Markham »

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
Awesome again. Testing now. I like the idea of leaving the toggle label in also. It would be handy for me.

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
did you change the toggle to middle up instead of middle down?

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
same results. middle toggle still stops after a while. This time it has not came back though after some time.

Markham

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 404
    • View Profile
    • Circle Dock
    • Donate to Member
did you change the toggle to middle up instead of middle down?

No. The convention I have always adopted when writing code to go inside key and mouse handlers is to use the downstroke to set flags and the upstroke to perform actions.


Mark

Markham

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 404
    • View Profile
    • Circle Dock
    • Donate to Member
same results. middle toggle still stops after a while. This time it has not came back though after some time.
Is the middle button still correctly reporting Mouse Down- Mouse Up?


Mark

worick

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 42
    • View Profile
    • Donate to Member
yes it is registering down and up correctly when it is toggling and is not toggling.

Previously, at least the last .exe, CD toggled on middle mouse down, not up. It now toggles on middle mouse up when working.

I have not had it start working again on its own with this latest .exe file. If it stops toggling I have to restart CD to get toggle going again.