Monday 27 November 2017

windows 7 - How can I reverse mouse movement (X & Y axis) system-wide? (Win 7 x64)


Short Version


I'm looking for a way to reverse the X and Y mouse axis movements. The computer is running Windows 7, x64 and Logitech SetPoint 6.32. I would like a system-level, permanent fix; such as a mouse driver modification or a registry tweak. Does anyone know of a solid way of implementing this, or how to find the registry values to change this? I'll settle quite happily for how to enable the orientation feature in SetPoint 6.32 for mice as well as trackballs.


Long Version People seem never to understand why I would want this, and I commonly hear "just use the mouse right-side up!" advice. Dyslexia is not something which can be cured by "just reading things right." While I appreciate the attempts to help, I'm hoping some background may help people understand.


I have a user with an unusual form of dyslexia, for whom mouse movements are backward. If she wants to move her cursor left, she will move the mouse right. If she wants the cursor to move up, she'll move the mouse down. She used to hold her mouse upside-down, which makes sophisticated clicking difficult, is terrible for ergonomics, and makes multi-button mice completely useless.


In olden times, mouse drivers included an orientation feature (typically a hot-air balloon you dragged upward to set the mouse movement orientation) which could be used to set the relationship between mouse movement and cursor movement. Several years ago, mouse drivers were "improved" and this feature has since been limited to trackballs.


After losing the orientation feature she went back to upside-down mousing for a bit, until finding UberOptions, a tweak for Logitech SetPoint, which would enable all features for all pointing devices. This included the orientation feature. And there was much rejoicing.


Now her mouse has died, and current Logitech mice require a newer version of SetPoint for which UberOptions has not been updated. We've also seen MAF-Mouse (the developer indicated the version for 64-bit Windows does not support USB mice, yet) and Sakasa (while it works, commentary on the web indicate it tends to break randomly and often. It's also just a running program, so not system-wide.).


I have seen some very sophisticated registry hacks. For example, I used to use a hack which would change the codes created by the F1-F12 keys when the F-Lock key was invented and defaulted to screwing my keyboard up. I'm hoping there's a way to flip X and Y in the registry; or some other, similar, system-level tweak out there.


Another solution could be re-enabling the orientation feature for mice, as well as trackballs. It's very frustrating that input device drivers include the functionality we desperately need for an accessibilty concern, but it's been disabled in the name of making the drivers more idiot-proof.



Answer



Couldn't find anything online, and I figured this shouldn't be too hard to make, so I went ahead and built one myself. Requires Microsoft .NET Framework 4.0 in order to run.


Polynomial's Mouse Inverter (freeware, under CC-BY-NC-SA license) - (Alt Link)


Let me know how it works out for you :)




Sorry this took so long, but here's the code that actually does the inversion:


internal class Inverter
{
private Point pos = Cursor.Position;

private bool invertX;

private bool invertY;

private bool running;

private bool exit;

public bool InvertX
{
get
{
return this.invertX;
}
set
{
this.invertX = value;
if (this.InvertSettingsChanged != null)
{
this.InvertSettingsChanged(this, new EventArgs());
}
}
}

public bool InvertY
{
get
{
return this.invertY;
}
set
{
this.invertY = value;
if (this.InvertSettingsChanged != null)
{
this.InvertSettingsChanged(this, new EventArgs());
}
}
}

public bool Running
{
get
{
return this.running;
}
}

public Inverter(bool x, bool y)
{
this.invertX = x;
this.invertY = y;
this.pos = Cursor.Position;
}

private void MouseLoop()
{
Thread.CurrentThread.IsBackground = true;
Thread.CurrentThread.Priority = ThreadPriority.Highest;
while (!this.exit)
{
Point position = Cursor.Position;
int right = (this.invertX ? this.pos.X - (position.X - this.pos.X) : position.X);
if (this.invertX)
{
if (right < 2)
{
right = 2;
}
if (right > Screen.FromPoint(position).Bounds.Right - 2)
{
Rectangle bounds = Screen.FromPoint(position).Bounds;
right = bounds.Right - 2;
}
}
int bottom = (this.invertY ? this.pos.Y - (position.Y - this.pos.Y) : position.Y);
if (this.invertY)
{
if (bottom < 2)
{
bottom = 2;
}
if (bottom > Screen.FromPoint(position).Bounds.Bottom - 2)
{
Rectangle rectangle = Screen.FromPoint(position).Bounds;
bottom = rectangle.Bottom - 2;
}
}
Cursor.Position = new Point(right, bottom);
this.pos = Cursor.Position;
Thread.Sleep(1);
}
this.exit = false;
}

public void Start()
{
this.pos = Cursor.Position;
this.running = true;
(new Thread(new ThreadStart(this.MouseLoop))).Start();
}

public void Stop()
{
this.running = false;
this.exit = true;
}

public event EventHandler InvertSettingsChanged;
}

I just pulled this out of the executable with Telerik JustDecompile, because I don't have the original code. You can extract an entire VS project with JD if you need the full application code.


No comments:

Post a Comment

Where does Skype save my contact&#39;s avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...