Page MenuHomeWildfire Games

Add GUI events for middle mouse click
Needs ReviewPublic

Authored by Imarok on Jan 18 2019, 5:21 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Add gui events for middle mouse click

Test Plan

just test it ;)

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 6809
Build 11201: Vulcan BuildJenkins
Build 11200: arc lint + arc unit

Event Timeline

Imarok created this revision.Jan 18 2019, 5:21 PM
Vulcan added a subscriber: Vulcan.Jan 18 2019, 5:26 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/980/

vladislavbelov added inline comments.
source/gui/CGUI.cpp
162

Too many of the same code. Maybe remove the duplication here and below?

for what u need it

Angen added a subscriber: Angen.Jan 19 2019, 8:30 AM

for what u need it

for map ping

elexis added a subscriber: elexis.Jan 19 2019, 12:31 PM

Actually, does this have to be hardlinked to a mouse tripleclick? Why not use hotkeys so people can put it on arbitrary input? There will certainly be people with only 2 buttons (Wasn't that about every mac user?) Which doesn't mean that the GUI hardcoding support can't be completed. I guess the use case for these hardcoded GUI events is to keep some things unchangeable, like the leftclick on a button, the leftclick on a list item. These are conventions that are the same throughout platforms, websites, decades. But there are not many of such things that are so common.

It's already supported, see default.cfg:

pan = MouseMiddle ; Enable scrolling by moving mouse

(I posted the same comment already this week on some other phab page, but not sure where)

source/gui/CGUI.cpp
217

When I saw this in D1751 I also thought to remove this triplicated hunk, but there are too many constants to make this immediately worthwhile.
One could pull the && pNearest condition out of the switch, and maybe the doubleclick timing, but it won't become much better probably.
Maybe one actually could do refactor the mousebutton handling with some function and pass the constant.
I guess mouses are not limited to 3 buttons as they are not limited to 2 buttons, so one could solve it for as much as SDL supports then.

vladislavbelov added inline comments.Sat, Feb 16, 6:27 PM
source/gui/CGUI.cpp
217

I guess mouses are not limited to 3 buttons as they are not limited to 2 buttons, so one could solve it for as much as SDL supports then.

It won't be an easy task. We make solve it with keyboard settings to detect any pressed key.