FAQ FAQ   Search Search  Register Register   Login Login  
   Main Site   Wiki  



Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next

Author Message
 PostPosted: Sun Apr 16, 2006 2:08 am  Post subject: Tired of Mac OS X's mouse acceleration?
Offline
A Brave Victim
User avatar

Joined: Thu Feb 03, 2005 12:50 am
Posts: 3354
Needs CoreFoundation and IOKit:
Code:
#include <stdio.h>
#include <IOKit/hidsystem/IOHIDLib.h>
#include <IOKit/hidsystem/IOHIDParameter.h>
/* didn't really sort the headers out, but it compiles and runs here */

int main(int argc, char **argv) {
   const uint32_t accel = 0x80000000; /* signed 2's complement (probably) (using unsigned for setting-bits-by-hand reasons) 16.16 fixed point; normally non-negative, otherwise all acceleration and scaling will be disabled */
   io_connect_t handle = NXOpenEventStatus(); /* NXEventHandle and io_connect_t are the same thing */
   if(handle) {
      if(IOHIDSetParameter(handle, CFSTR(kIOHIDMouseAccelerationType), &accel, sizeof accel) != KERN_SUCCESS) {
         printf("Failed to set mouse accel\n");
      }
      if(IOHIDSetParameter(handle, CFSTR(kIOHIDTrackpadAccelerationType), &accel, sizeof accel) != KERN_SUCCESS) {
         printf("Failed to set trackpad accel\n");
      }
      NXCloseEventStatus(handle);
   } else {
      printf("No handle\n");
   }
   return 0;
}


This maps mouse units directly to pixels. If you have the right resolution and stable readings, this could work very well. Bear in mind that this is probably unsupported, but it works for me on 10.4.6, unlike a deprecated solution.

Some ways to revert to your old settings:
- Set a different accel in this code.
- Log out and back in.
- Use the preference pane you're used to.


Top
Profile
 
 PostPosted: Thu Oct 26, 2006 4:49 am  Post subject:
Offline
A Brave Victim
User avatar

Joined: Thu Feb 03, 2005 12:50 am
Posts: 3354
It's been a while, but
Code:
defaults write .GlobalPreferences com.apple.mouse.scaling -1
defaults write .GlobalPreferences com.apple.trackpad.scaling -1

works as well. Run the above in Terminal.app, log out, and then back in. If it didn't work something else has probably touched the file. That's unlikely to happen shortly after a clean login, so just do it again. If you succeed, don't be afraid to change mouse settings in System Preferences. It'll be left at -1 as long as you don't touch the speed slider.


Top
Profile
 
 PostPosted: Sat Apr 26, 2008 3:17 pm  Post subject: Re: Tired of Mac OS X's mouse acceleration?
Offline

Joined: Sat Apr 26, 2008 3:10 pm
Posts: 4
Jonathan wrote:
Needs CoreFoundation and IOKit:
[code]#include <stdio.h>
#include <IOKit/hidsystem/IOHIDLib.h>
#include <IOKit/hidsystem/IOHIDParameter.h>

...


Hey Jonathan, thanks for posting this.

I just got a macbook. Coming from Windows however, I am really annoyed with OSX's mouse acceleration. I'm currently using USBOverdrive, however it does not completely fix the problem. The two terminal commands you gave seem to work, but they also drop tracking speed to the lowest, which makes it a less preferable solution.

Anyway, being a total programming newbie, I was wondering how I can apply your first fix to my macbook? Assuming it completely removes the acceleration (in other words, giving a pure 1:1 ratio). I tried finding some info on how to use IOKit and CoreFoundation, but it's really out of my league. Could you perhaps explain to me the steps I need to go through to apply this fix?

If it's too much trouble I understand. I would be really grateful though.. I don't understand why it's so hard to fix this problem and why Apple does not enable you to simply turn it off.

Thanks in advance for any help.

phero


Top
Profile
 
 PostPosted: Sat Apr 26, 2008 3:29 pm  Post subject:
Offline
Reverse Outside Corner Grinder
User avatar

Joined: Wed Jan 04, 2006 4:42 am
Posts: 1679
Location: 0x08048000
/me doesn't get why someone would want a touchpad without mouse acceleration.

_________________
There's no place like ::1


Top
Profile
 
 PostPosted: Sat Apr 26, 2008 4:28 pm  Post subject:
Offline
A Brave Victim
User avatar

Joined: Thu Feb 03, 2005 12:50 am
Posts: 3354
wrtlprnft wrote:
/me doesn't get why someone would want a touchpad without mouse acceleration.

The one in my PowerBook still allows me to swipe across the majority of the screen. And I can target single pixels. I 'roll' my finger over the pad a bit for minor adjustments, if that means anything.

Anyway, it seems that 10.5 broke this trick. When you set a negative value you get zero instead, which removes acceleration, but is terribly slow. Maybe the programmatic way still works (edit: it does! :D); I only tried hacking the preferences file so far on 10.5.

_________________
ˌɑrməˈɡɛˌtrɑn


Top
Profile
 
 PostPosted: Sat Apr 26, 2008 4:42 pm  Post subject:
Offline

Joined: Sat Apr 26, 2008 3:10 pm
Posts: 4
wrtlprnft wrote:
/me doesn't get why someone would want a touchpad without mouse acceleration.


Well it wouldn't be for the touchpad, but for the USB mouse I have attached to my macbook ;)


Top
Profile
 
 PostPosted: Sat Apr 26, 2008 4:43 pm  Post subject:
Offline

Joined: Sat Apr 26, 2008 3:10 pm
Posts: 4
Jonathan wrote:
wrtlprnft wrote:
/me doesn't get why someone would want a touchpad without mouse acceleration.

The one in my PowerBook still allows me to swipe across the majority of the screen. And I can target single pixels. I 'roll' my finger over the pad a bit for minor adjustments, if that means anything.

Anyway, it seems that 10.5 broke this trick. When you set a negative value you get zero instead, which removes acceleration, but is terribly slow. Maybe the programmatic way still works (edit: it does! :D); I only tried hacking the preferences file so far on 10.5.


Is there any easy way to explain this "hacking" to a programming newbie? I'd do anything to get rid of the acceleration completely.


Top
Profile
 
 PostPosted: Sat Apr 26, 2008 5:03 pm  Post subject:
Offline
A Brave Victim
User avatar

Joined: Thu Feb 03, 2005 12:50 am
Posts: 3354
Here's a little tool for non-programmers.

Source file:
Code:
#include <stdio.h>
#include <IOKit/hidsystem/IOHIDLib.h>
#include <IOKit/hidsystem/IOHIDParameter.h>

int main(int argc, char **argv)
{
   const int32_t accel = -0x10000; // if this ever becomes a scale factor, we set it to one
   if(argc < 2) {
      fprintf(stderr, "Give me mouse and/or trackpad as arguments\n");
      return 1;
   }
   
   io_connect_t handle = NXOpenEventStatus();
   if(handle) {
      int i;
      for(i=1; i<argc; i++) {
         CFStringRef type = 0;
         
         if(strcmp(argv[i], "mouse") == 0)
            type = CFSTR(kIOHIDMouseAccelerationType);
         else if(strcmp(argv[i], "trackpad") == 0)
            type = CFSTR(kIOHIDTrackpadAccelerationType);
         
         if(type && IOHIDSetParameter(handle, type, &accel, sizeof accel) != KERN_SUCCESS)
            fprintf(stderr, "Failed to kill %s accel\n", argv[i]);
      }
      NXCloseEventStatus(handle);
   } else
      fprintf(stderr, "No handle\n");
   
   return 0;
}


To run it, unpack the tgz, open Terminal, drop killmouseaccel on it, type mouse and/or trackpad, separated by spaces, and hit enter. Should look like this:
Code:
/Users/jonathan/Desktop/killmouseaccel mouse trackpad


Note that it won't last; you have to run it again after setting mouse accel with something else or after logging in again.

Compiled for 10.4 universal, if it matters to anyone.


Attachments:
killmouseaccel.tar.gz [3.65 KiB]
Downloaded 6322 times

_________________
ˌɑrməˈɡɛˌtrɑn
Top
Profile
 
 PostPosted: Sat Apr 26, 2008 5:40 pm  Post subject:
Offline

Joined: Sat Apr 26, 2008 3:10 pm
Posts: 4
You're my new hero, Jonathan!

You know a lot of people actually buy USBOverdrive just for killing the mouse accel, right? This fixes it without any third party software.

However, just like with USBOverdrive, I'm not 100% sure this fix completely removes any acceleration. On the other hand, maybe I'm just being paranoid.

In any case, thanks a lot for your help.

Edit: It's still there in World of Warcraft, but I'm quitting that game anyway - it runs crap on a macbook.


Top
Profile
 
 PostPosted: Sat Apr 26, 2008 6:01 pm  Post subject:
Offline
A Brave Victim
User avatar

Joined: Thu Feb 03, 2005 12:50 am
Posts: 3354
Here's an attempt at a GUI. Not my specialty but it seems to work. :) Should be more convenient for most.

All copyright notices I found that it put in automatically were removed deliberately; I don't care.

phero: glad to be of help. :) I clearly felt that MouseFix didn't work, but here I clearly feel it does. And no matter how fast or slow I move, the pointer always moves the same distance with the same mouse movement. Try for yourself: move the pointer to the edge of the screen, and move the mouse say 3 cm at high speed. Then try again at low speed. Move back and forth a bit but finish in the same spot (make sure you don't clip the pointer at the edge of the screen). Is there a significant difference in the final pointer position?

I don't know why it doesn't work in WoW. Maybe it sets mouse accel itself, applies its own, or just feels bad because it doesn't run too well ("mouse lag" but not accel).


Attachments:
File comment: Really gzipped. Xcode project included.
Kill Mouse Accel.dmg.gz [92.8 KiB]
Downloaded 7761 times

_________________
ˌɑrməˈɡɛˌtrɑn
Top
Profile
 
 PostPosted: Sun Apr 27, 2008 11:39 am  Post subject:
Offline
On Lightcycle Grid
User avatar

Joined: Sun Dec 03, 2006 3:22 pm
Posts: 45
Location: Baltimore, MD
http://www.versiontracker.com/dyn/moreinfo/macosx/12205


this freeware app works well for me as far as making the mouse & trackpad controllable. If you read the docs for this app, it does sound like what Jonathan has done, without the scaling tinkering. The author says the source is available, so... get it and stick a mod in there.

I dont really get the issue with the mouse accel. I'm using 10.3.9 - maybe it was changed in Tiger or Leopard.


Top
Profile
 
 PostPosted: Sun Apr 27, 2008 1:31 pm  Post subject:
Offline
A Brave Victim
User avatar

Joined: Thu Feb 03, 2005 12:50 am
Posts: 3354
With MouseZoom you only get more acceleration. It changes the same variable but only allows an entirely different range.

_________________
ˌɑrməˈɡɛˌtrɑn


Top
Profile
 
 PostPosted: Fri Sep 19, 2008 6:48 am  Post subject:
Offline
Match Winner
User avatar

Joined: Sat Mar 15, 2008 5:55 am
Posts: 506
Not to be nitpicky, but Ubuntu seems to have supercharged touch pad speeds itself, I tried that and lost my mouse pointer... guess I'll stick to wireless mouse..


Top
Profile
 
 PostPosted: Fri Sep 19, 2008 10:19 am  Post subject:
Offline

Joined: Thu Sep 18, 2008 12:16 pm
Posts: 1
Thank you that works really well, but I would like to be able to increase the scaling as the default is a bit slow for me. Do I just change the accel variable? and how do I compile this? I have xcode but I'm new to MAC development and not sure how to setup the project etc

sorry i'm being an idiot the xcode project is included with the download :oops:


Top
Profile
 
 PostPosted: Thu Jan 22, 2009 9:24 pm  Post subject:
Offline

Joined: Thu Jan 22, 2009 9:13 pm
Posts: 1
Thanks so much Jonathan for this!

I was finding it super annoying to use the mouse in my new mac, and I tried everything, 5 or 6 different mouses, also tried different mac, etc, and the problem remained the same. Still I think that the mouse does not respond as well as in Windows. I have been a windows user for 15 years, and when I use a mouse, I usually use fast movements to the place I want to reach, and then I very precise slow movements to reach the final destination, but it seems that under MAC OSX these small movements are not perceived by system as well as in WIN and it lags a bit. If i do very small circles on my windows machine it detects it perfectly, while on mac it doesnt, it is like it is lagging a bit, like if it stutters, does anyone share the same feelings? Is there a way to improve this small movements? Btw, this is already using your fix!

Thanks


Top
Profile
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by two camels and phpBB © 2000, 2002, 2005, 2007 phpBB Group