mouse scroll wheel doesn't work, SDL2

Found a bug in R'n'D? Report it here!

Moderators: Flumminator, Zomis

Post Reply
filbo
Posts: 647
Joined: Fri Jun 20, 2014 10:06 am

mouse scroll wheel doesn't work, SDL2

Post by filbo »

This has been true "forever", but I'm reporting it specifically in latest "RC2"-labeled git code.

Main menu => Level Creator; mouse over the playfield or the drawing elements palette; operate scroll wheel; mouse over playfield, hold down Shift + operate scroll wheel.

Expected: playfield or drawing elements palette scrolls up or down; playfield scrolls horizontally.

Actual: in SDL1 build, works fine; in SDL2 build, nothing happens.

"HMMM", I thought, "it must be this code in src/events.c, somehow getting wrong signals from SDL2:"

Code: Select all

  /* do not use scroll wheel button events for anything other than gadgets */
  if (IS_WHEEL_BUTTON(button_nr))
    return;
-- commented it out -- makes no difference. Sigh.
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: mouse scroll wheel doesn't work, SDL2

Post by Holger »

Thanks for reminding me about this!

It's fixed now in the latest version in the Git repo, and should work as in SDL1.

One (hopefully) slight improvement: It now supports accelerated mouse wheel actions on platforms that support it (which is currently Mac OS X (tested, and really works nicely) and (probably) Windows (not tested), but unfortunately not Linux, which apparently does not support it on system/driver level -- here we have a default of jumping three lines/tiles per single wheel move, which can be reduced to one line/tile by holding down the "Alt" key, for more precise control).
filbo
Posts: 647
Joined: Fri Jun 20, 2014 10:06 am

Re: mouse scroll wheel doesn't work, SDL2

Post by filbo »

Confirming: scroll wheel now works under SDL2. (And still works under SDL1.)

I have not noticed the lack of acceleration, or a need for it...

One small tweak that would be nice: some programs or environments will scroll horizontally if you operate the scroll wheel while pointing at the horizontal scroll bar. I am apparently used to this behavior, as I keep noticing myself trying to do it in the RnD level editor...
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: mouse scroll wheel doesn't work, SDL2

Post by Holger »

I have not noticed the lack of acceleration, or a need for it...
If you have used it once, you will miss it if it's not there. :-)

It really feels "natural", as you can move the mouse wheel very slowly to scroll very precisely line by line (or tile by tile in the editor) with every single "click" of the mouse wheel (not meaning pressing it as a middle mouse button, but the "click" it makes for each minimal wheel movement). But you can also give it a fast spin, moving through the whole list of elements in the "editor element palette" with only a few moves of your finger. I got instantly used to it on a Mac, and now it does not "feel right" anymore when I use a wheel mouse with Linux. :-|
One small tweak that would be nice: some programs or environments will scroll horizontally if you operate the scroll wheel while pointing at the horizontal scroll bar. I am apparently used to this behavior, as I keep noticing myself trying to do it in the RnD level editor...
Sounds very reasonable indeed. And this was also extremely easy to add. Please "git pull" and have a look at it.
filbo
Posts: 647
Joined: Fri Jun 20, 2014 10:06 am

Re: mouse scroll wheel doesn't work, SDL2

Post by filbo »

Works beautifully, SDL1 & SDL2. Thanks!
Post Reply