Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Wheel scroll not recognized for high resolution mouse

This thread is locked; no one can reply to it. rss feed Print
Wheel scroll not recognized for high resolution mouse
kovarex
Member #14,203
April 2012

It seems, that the library smaller movements of the scroll wheel, more details and info in the bug thread: http://www.factorioforums.com/forum/viewtopic.php?f=7&t=7336

www.factorio.com - a factory building game.

Thomas Fjellstrom
Member #476
June 2000
avatar

Wait, you're involved with factorio? Dude! does it use allegro?

Interesting problem, we might have to fix some mouse code. I wasn't aware windows would ever give you sub 120 values (I always thought that was an odd number...)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

SiegeLord
Member #7,827
October 2006
avatar

Yeah, the poster in that thread probably nailed the issue. Currently Allegro ignores values that are less than that magical 120 constant. What I think should be done is that we accumulate to a certain constant, and have that constant be configurable via allegro5.cfg:

[mouse]
# Changes the mouse resolution. Lower values mean higher sensitivity.
win_mouse_wheel_resolution = 120

How does that sound?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Thomas Fjellstrom
Member #476
June 2000
avatar

Sounds good to me. though maybe it shouldn't be limited to windows. I seem to recall a similar thing in other apis (120 "ticks").

Might be nice to make an api to set/get it as well. That sounds like something a game would put in its input settings menu.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

SiegeLord
Member #7,827
October 2006
avatar

That requires thought and work :P. Quick glance suggests that X11 just receives discrete button presses for the mouse wheel rotation (my mouse wheel is definitely not high precision, so I don't know what it does for the super-precise ones). OSX appears to be using floating point for its delta-Z values, so that might be a place for such a precision parameter as well.

Another obvious solution would be a floating point dz variable, but that's not something easily changed.

EDIT:

I should say that obviously we can add a precision API that effectively encodes the denominator of the dz value... but would we ever choose to go that route if we had an option of a floating point dz?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Chris Katko
Member #1,881
January 2002
avatar

SiegeLord said:

floating point dz?

What the hell is a float supposed to mean? ??? What's 13.95E-15? Degrees? Kilometers?

[edit]

Assuming this is the right page:

Quote:

Rotation (NSEventTypeRotate)—The rotation accessor method returns a floating-point value representing the degrees of rotation, counterclockwise.

Is that even possible to ensure? If I plug in two different mice showing up as "generic USB mouse", are they really going to report that the same way? Is the mouse equivalent of DPI in the USB specification?

I don't know, I'm making a big deal out of nothing. It just strikes me as strange to turn a mechanical counting device (with a discrete integer number output) into a floating point number.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Thomas Fjellstrom
Member #476
June 2000
avatar

It just strikes me as strange to turn a mechanical counting device (with a discrete integer number output) into a floating point number.

In many cases (which mechanical wheels), the wheel is actually three discreet buttons. Probably why X decides to just pass them through. Optical wheels probably just emulate buttons.

Quote:

What the hell is a float supposed to mean? ??? What's 13.95E-15? Degrees? Kilometers?

I presume you'd not likely get more than -1 - 1 out of it.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

SiegeLord
Member #7,827
October 2006
avatar

It's no more arbitrary than +1 and -1 :P. The floating point value would be the fraction of 1.

Anyway, I'm implementing an integer based API, something along the lines of al_set_mouse_wheel_precision(ALLEGRO_DISPLAY *d, int precision).

EDIT: And here it is:

https://github.com/SiegeLord/allegro5/commit/2f79ba33e01b9b953b8a08c8b08fe4d9c204a514

I'll look it over again tomorrow, and then probably commit it. This fixes both the aforementioned bug, and adds the API to take advantage of those high resolution mice if you want to.

EDIT2: I decided I don't like it... might need to rewrite some/all of it... no ETA.

EDIT3: Committed the fix as http://sourceforge.net/p/alleg/allegro/ci/d567a7fb30eb511189886cd7d21fc44215dbab44/.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: