Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horizontal scroll direction is reversed #2218

Closed
dhardy opened this issue Nov 19, 2017 · 40 comments
Closed

Horizontal scroll direction is reversed #2218

dhardy opened this issue Nov 19, 2017 · 40 comments
Assignees
Labels
Blocker: New Stable Issues that must be resolved prior to the next stable series being released. Bug Issues involving unexpected behavior. Confirmed Issues that have been successfully reproduced by at least one developer. Regression Issues that were not present in previous releases. UI User interface issues, including both back-end and front-end issues.

Comments

@dhardy
Copy link

dhardy commented Nov 19, 2017

Before the last system update, touchpad scrolling of the map worked perfectly. After the update (Wesnoth 1.13.10), horizontal scrolling works in the wrong direction (vertical scrolling is still correct). It's weird having only one axis reversed. I don't see any config for this.

@sevu
Copy link
Member

sevu commented Nov 19, 2017

I recall this happening to me too.

@sevu sevu added Bug Issues involving unexpected behavior. Regression Issues that were not present in previous releases. UI User interface issues, including both back-end and front-end issues. Confirmed Issues that have been successfully reproduced by at least one developer. labels Nov 19, 2017
@Vultraz
Copy link
Member

Vultraz commented Nov 19, 2017

When I swipe left, the map goes to the right. Is that not the previous behavior?

@dhardy
Copy link
Author

dhardy commented Nov 20, 2017

It's not the previous behaviour I had. Now the map moves down when I swipe down (same direction) but left when I swipe right. It's pretty odd. (I never did get why we needed to reverse touchpad scrolling directions just because touchscreens work differently; one is a "scrolling" method the other is "drag a point".)

@Vultraz
Copy link
Member

Vultraz commented Nov 20, 2017

That’s a good analogy, I guess. Now we just neee to decide which scrolling method to commit to.

@dhardy
Copy link
Author

dhardy commented Nov 20, 2017

Well, either stick to the old standard (and tweak your touchpad if you want different in all your apps) or add an option. Because all my other apps scroll in the same direction as I swipe.

@AI0867
Copy link
Member

AI0867 commented Nov 22, 2017

Apple decided to make touchpads on macOS work the same as touchscreens on iOS at some point, and microsoft followed suit in windows 8 (even with scrollwheels I believe). Some linux software also does this, KDE (at least the versions I've run) does not.

It's all rather annoying.

@dhardy
Copy link
Author

dhardy commented Nov 22, 2017

I know, I just assumed the only sane way to implement the switch would be by swapping touchpad scroll output. (Although even that is not sane — queue scroll down to zoom in on maps interpreting wheel events the usual way.) Ugh, what a can of worms.

@vgaming
Copy link
Member

vgaming commented Nov 23, 2017

// Linux XFCE environment defines scrolling as "scroll down = more text on bottom gets revealed = viewport goes down", but there is an option to reverse scrolling behavior, called "Reverse scroll direction". This option is the approach that seems sane. It's not app-level, it's system-level.

I would be very happy if wesnoth would behave same as all others programs on my OS/environment. So that I could also reverse the behavior on all apps simultaneously by a single click (if I'd want to).

@GregoryLundberg
Copy link
Contributor

I don't know if it's such a good idea querying the DM for options unless it's explicitly an option supported by all DMs on Windows, macOS and every flavor of Linux out there.

@vgaming
Copy link
Member

vgaming commented Nov 23, 2017

@GregoryLundberg agree. So, I'd make it OS-specific. It seems that Windows has a single dominating DE/whatever, same goes for Mac. Linux has all kinds of DE-s, but the majority of them uses traditional scrolling, not "touch-style".

@dhardy
Copy link
Author

dhardy commented Nov 24, 2017

You would have thought there'd be a freedesktop standard for this kind of thing, but I can't find one.

@dhardy
Copy link
Author

dhardy commented Nov 24, 2017

Actually, there's a section in the X protocol (search "scrolling"). Presumably there's some equivalent for Wayland too, but can't find it.

@jyrkive
Copy link
Member

jyrkive commented Nov 26, 2017

Looks like this was caused by commit cfa2df1.

@vgaming
Copy link
Member

vgaming commented Nov 27, 2017

@dhardy well, the point is to ignore the setting, even if it can be found on Xorg configuration files etc. We want wesnoth to behave like all other apps, we don't want hardcode that "scorll down" = "map goes down".
So, if we just use the standard Linux scroll direction, we will always scroll in the same direction as the user would inside e.g. a browser. Even if the user inverts this in his Xorg configuration.

@Vultraz
Copy link
Member

Vultraz commented Nov 27, 2017

What is this "standard Linux scroll direction" you speak of?

@GregoryLundberg
Copy link
Contributor

GregoryLundberg commented Nov 27, 2017

I read it as "what my system does" and "the same as Windows" since I don't see any difference.

When I roll the mouse wheel to scroll down a web page the line I'm reading moves up my screen.

When I roll the mouse wheel the same direction on Wesnoth, the unit moves up my screen.

My touch system is restricted to mouse emulation since I'm using Windows Remote Desktop.

Connected to my Linux system, when I touch the bottom of the window and move down a bit, the unit on my screen moves up. Same as when I move the mouse a bit off the bottom edge.

My Windows 7, 8.1 and 10 systems don't seem to understand touch. Maybe something with my setup but I don't care to look right now.

I would expect, if I an click-dragging the map, or touch-dragging, that the map follows the mouse pointer or my finger.

When it comes to the arrow keys, however, I would expect the system scroll to be honored. That is, if I have it set to move the line on my web page down when I press the down arrow, I would expect the unit on my screen to move down. Similarly, if I have it set (as "normal") to move the line on my web page up when I press the down arrow, I would expect the unit on my screen to move up as well.

If I can reconfigure the mouse wheel to reverse direction, I would expect Wesnoth to follow suit, as my text editor or web browser would.

@vgaming
Copy link
Member

vgaming commented Nov 27, 2017

@Vultraz yes, I mean the same behavior as you get when you scroll a long list. Wesnoth unit/savegame list, for example.

@vgaming
Copy link
Member

vgaming commented Nov 27, 2017

BTW, note on Xorg settings. I did some tests now.

It seems that, when you enable this setting, applications actually receive an inverted scroll action itself. So if you scroll down your mouse wheel, applications get "scoll up" event. If you scroll your wheel up, applications get "scoll down" event. Also, this is input-specific. So you can invert your mouse, but leave touchpad as is, for example.

Note on tests:

  • I didn't want to hack into Xorg settings directly, so I used my XFCE settings to enable the setting instead.
  • I observed the events using xev command.

@dhardy
Copy link
Author

dhardy commented Nov 27, 2017

FYI Windows 8 and recent versions of GNOME both switch scrolling direction (scroll UP to make text go up). Not 100% sure how this happens but I would guess by remapping events (both Xorg conf and xinput allow "mouse button" scroll events to be remapped). IIUC older versions of Windows didn't have uniform support for horizontal scrolling so that may be why the patch @jyrkive mentioned switched only the x direction? Seems a special case though; I imagine most platforms will not want this.

I strongly suspect that regardless of which behaviour you want (objects on map follow fingers when scrolling or move away), on most platforms [with horiz and vert scrolling] the current code will be wrong (inconsistent between x and y directions). But maybe more testers are needed...

@sevu sevu added the Blocker: New Stable Issues that must be resolved prior to the next stable series being released. label Jan 29, 2018
@sevu
Copy link
Member

sevu commented Jan 29, 2018

The game is unplayable with a touchpad, I mark this as a blocker.
Some information:

  • I use libinput as touchpad driver. Not evdev or synaptic.
  • Scrolling up scolls up.
  • Scrolling left scrolls right.

Does anybody on Linux not have a different behavior for horizontal and vertical with the touchpad?

@ancestral
Copy link
Contributor

The game is honoring the scrolling setting in System Preferences. If you have the check box “content tracks finger movement” the game follows that. How do you scroll a page in Safari? It’s the same behavior.

If we undo this, then this breaks for people who have the natural scrolling turned off, which will be even more frustrating for the other half of people who turned the setting off.

So the only fix for this is overriding this preference… which I think we can do. I’ll see if I can find make a patch to check the systemwide scroll setting.

@ancestral
Copy link
Contributor

ancestral commented Feb 6, 2018

BTW, I’m pretty sure this change in behavior happened with the move to SDL2.

@ancestral ancestral reopened this Feb 6, 2018
@ancestral
Copy link
Contributor

@vgaming So when you move your cursor to the edge of the map, you expect the game should move in that direction. This doesn’t apply to web browsers. You don’t scroll by moving the cursor to the edge of the window.

@vgaming
Copy link
Member

vgaming commented Feb 8, 2018

@ancestral this part I do understand. What I cannot understand, is how it relates to scroll events. These are different types of movement on my touchpad, the cursor doesn't even change position while scrolling, it stays in the center.

@ancestral
Copy link
Contributor

ancestral commented Feb 9, 2018

I guess it all comes down to personal preference. And history on how Wesnoth has traditionally worked.

My question is, for Linux users, is there actually a system setting for scrolling direction?

@vgaming
Copy link
Member

vgaming commented Feb 9, 2018

@ancestral yes. But the trick is -- it doesn't really change scrolling direction for e.g. "scroll down" event. Instead, it makes your physical mouse scrolling generate inverted scroll event.

In other words, if you re-configure this setting, you will make the same physical gesture, but get an inverted scrolling event. Apps do not know about it (normally).

@ancestral
Copy link
Contributor

ancestral commented Feb 9, 2018

My apologies. After looking at cfa2df… maybe I was wrong. I could have sworn it was in an #ifdef. My mistake, I was thinking of another report.

So Linux is different?

Please see the issue: #1754

@vgaming
Copy link
Member

vgaming commented Feb 9, 2018

@ancestral I don't know if Linux is different because I don't use any other OS. On Linux, when you scoll up, viewport goes up. That is expected behavior. Now, when you scoll left, viewport goes right. This is broken.

@ancestral
Copy link
Contributor

ancestral commented Feb 9, 2018

Okay, so is it easier to #ifdef for Linux, or #ifdef for Mac and Windows? Not sure about other platforms…

@jyrkive
Copy link
Member

jyrkive commented Feb 10, 2018

IIRC, last time I tested this on Windows, panning direction was correct (meaning that the X axis reversal is Linux specific).

@sevu
Copy link
Member

sevu commented Feb 10, 2018

Wesnoth also runs on a variety of other unix systems.

@vgaming
Copy link
Member

vgaming commented Feb 10, 2018

If there are 2 systems that are known to behave in one way, and an unknown number of other systems that probably behave in another way, I'd chose ifdef-ing the two known systems.

@ancestral ancestral self-assigned this Feb 11, 2018
ancestral added a commit that referenced this issue Feb 11, 2018
…r non-Windows, non-macOS) were scrolling horizontally the incorrect direction. This addresses a problem that was introduced in #1754.
ancestral added a commit that referenced this issue Feb 11, 2018
@ancestral
Copy link
Contributor

I had one person with a Linux machine confirm this works. That being said, if you notice the issue persists, please re-open the issue. Thanks.

@vgaming
Copy link
Member

vgaming commented Feb 11, 2018

@ancestral confirming the fix works. Thanks!

pehjota added a commit to pehjota/wesnoth that referenced this issue Dec 20, 2023
The old issue wesnoth#2218 was actually a bug in SDL, fixed on X11 in version
2.0.18 and on Wayland in version 2.0.20.  The hardcoded workaround in
pull wesnoth#2481 (commit 4bc4373) caused a regression in fixed SDL versions.

This fix is similar to the workaround in widelands/widelands#5394
committed as widelands/widelands@67db32a.

Tested with SDL 2.0.14 and 2.28.5.
pehjota added a commit to pehjota/wesnoth that referenced this issue Dec 20, 2023
The old issue wesnoth#2218 was actually a bug in SDL, fixed on X11 in version
2.0.18 and on Wayland in version 2.0.20.  The hardcoded workaround in
pull wesnoth#2481 (commit 4bc4373) caused a regression in fixed SDL versions.

This fix is similar to the workaround in widelands/widelands#5394
committed as widelands/widelands@67db32a.

Tested with SDL 2.0.14 and 2.28.5.
pehjota added a commit to pehjota/wesnoth that referenced this issue Dec 20, 2023
The old issue wesnoth#2218 was actually a bug in SDL, fixed on X11 in version
2.0.18 and on Wayland in version 2.0.20.  The hardcoded workaround in
pull wesnoth#2481 (commit 4bc4373) caused a regression in fixed SDL versions.

This fix is similar to the workaround in widelands/widelands#5394
committed as widelands/widelands@67db32a.

Tested with SDL 2.0.14 and 2.28.5.
pehjota added a commit to pehjota/wesnoth that referenced this issue Dec 20, 2023
The old issue wesnoth#2218 was actually a bug in SDL, fixed on X11 in version
2.0.18 and on Wayland in version 2.0.20.  The hardcoded workaround in
pull wesnoth#2481 (commit 4bc4373) caused a regression in fixed SDL versions.

This fix is similar to the workaround in widelands/widelands#5394
committed as widelands/widelands@67db32a.

Tested with SDL 2.0.14 and 2.28.5.
Pentarctagon pushed a commit that referenced this issue Dec 26, 2023
* Fix horizontal scrolling regression (fixes #7404)

The old issue #2218 was actually a bug in SDL, fixed on X11 in version
2.0.18 and on Wayland in version 2.0.20.  The hardcoded workaround in
pull #2481 (commit 4bc4373) caused a regression in fixed SDL versions.

This fix is similar to the workaround in widelands/widelands#5394
committed as widelands/widelands@67db32a.

Tested with SDL 2.0.14 and 2.28.5.

* Make mouse handler use same coordinate signs as map

Also fix mouse_wheel_*() virtual method calls, which have been wrong in
the X axis since commit dfe2f33 (and unused since commit c912f7e).
pehjota added a commit to pehjota/wesnoth that referenced this issue Dec 27, 2023
The old issue wesnoth#2218 was actually a bug in SDL, fixed on X11 in version
2.0.18 and on Wayland in version 2.0.20.  The hardcoded workaround in
pull wesnoth#2481 (commit 4bc4373) caused a regression in fixed SDL versions.

This fix is similar to the workaround in widelands/widelands#5394
committed as widelands/widelands@67db32a.

Also make mouse handler use same coordinate signs as map and fix
mouse_wheel_*() virtual method calls, which have been wrong in the X
axis since commit dfe2f33 (and unused since commit c912f7e).

Tested with SDL 2.0.14 and 2.28.5.

Cherry picked from commit ab4001d (pull wesnoth#8137) in the master branch
(1.17).
pehjota added a commit to pehjota/wesnoth that referenced this issue Dec 28, 2023
The old issue wesnoth#2218 was actually a bug in SDL, fixed on X11 in version
2.0.18 and on Wayland in version 2.0.20.  The hardcoded workaround in
pull wesnoth#2481 (commit 4bc4373) caused a regression in fixed SDL versions.

This fix is similar to the workaround in widelands/widelands#5394
committed as widelands/widelands@67db32a.

Also make mouse handler use same coordinate signs as map and fix
mouse_wheel_*() virtual method calls, which have been wrong in the X
axis since commit dfe2f33 (and unused since commit c912f7e).

Tested with SDL 2.0.14 and 2.28.5.

Cherry picked from commit ab4001d (pull wesnoth#8137) in the master branch
(1.17).
pehjota added a commit to pehjota/wesnoth that referenced this issue Dec 28, 2023
The old issue wesnoth#2218 was actually a bug in SDL, fixed on X11 in version
2.0.18 and on Wayland in version 2.0.20.  The hardcoded workaround in
pull wesnoth#2481 (commit 4bc4373) caused a regression in fixed SDL versions.

This fix is similar to the workaround in widelands/widelands#5394
committed as widelands/widelands@67db32a.

Also make mouse handler use same coordinate signs as map and fix
mouse_wheel_*() virtual method calls, which have been wrong in the X
axis since commit dfe2f33 (and unused since commit c912f7e).

Tested with SDL 2.0.14 and 2.28.5.

Cherry picked from commit ab4001d (pull wesnoth#8137) in the master branch
(1.17).
Pentarctagon pushed a commit that referenced this issue Dec 31, 2023
The old issue #2218 was actually a bug in SDL, fixed on X11 in version
2.0.18 and on Wayland in version 2.0.20.  The hardcoded workaround in
pull #2481 (commit 4bc4373) caused a regression in fixed SDL versions.

This fix is similar to the workaround in widelands/widelands#5394
committed as widelands/widelands@67db32a.

Also make mouse handler use same coordinate signs as map and fix
mouse_wheel_*() virtual method calls, which have been wrong in the X
axis since commit dfe2f33 (and unused since commit c912f7e).

Tested with SDL 2.0.14 and 2.28.5.

Cherry picked from commit ab4001d (pull #8137) in the master branch
(1.17).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocker: New Stable Issues that must be resolved prior to the next stable series being released. Bug Issues involving unexpected behavior. Confirmed Issues that have been successfully reproduced by at least one developer. Regression Issues that were not present in previous releases. UI User interface issues, including both back-end and front-end issues.
Projects
None yet
Development

No branches or pull requests

9 participants