Fixed: Support for > 3 Mouse Buttons as Hotkeys

Started by Simon, December 16, 2024, 03:09:29 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Simon

Hi,

Lix test executable for many mouse buttons

This adds support for more than 3 mouse buttons.

Do you have a mouse with extra buttons? Please try this (put it into a full Lix tree, e.g., from a fresh download). Bind your extra mouse buttons to some skills or functions. Will the bound mouse buttons work during play?

Silken, please turn off your external mouse-to-keyboard binding tool for this test. Lix should really see you mouse buttons as-is, not as keyboard keys.

This doesn't yet export the new bindings to the options file. As a result, this version of Lix doesn't remember the extra mouse button bindings after you exit and restart Lix. Before we can merge this, I'll have to decide how exactly to export/import mouse button bindings from the options file.

-- Simon

Simon

Simon: 1. Ensure that manufacturer's software is running. 2. Ensure that you don't bind any mouse buttons to keyboard keys in it. 3. Run Lix. 4. Bind the extra mouse buttons in Lix. 5. Tell me if Lix accepts those keybindings.

SilkenHealer: That's what I was already doing.

Simon: Okay, and Lix fails to accept the bindings then?

SilkenHealer: Yeah.

Simon: And Lix also fails to accept the binding if you replace step 1 with (ensure that the manufacturers's software is not running).

SilkenHealer: Yeah.

Simon: Okay, then it fails altogether and I should find a mouse with many buttons to test it myself first. I don't have such a mouse unfortunately, but I'm happy that you were up for the quick test.

-- Simon

WillLem

My mouse has 5 buttons. I tested with the following:

Left = (normal actions)
Middle = Pause
Right = Back 1 tick
X1 = Back 1 second
X2 = Fast forward

All seems to be working great, no issues.

Simon


Silken Healer

Update: I got it to work if I set my fourth and fifth mouse button to the default, forward and backwards in the manufactuers' software

Silken Healer

Update 2: Even if I set other buttons then the 2 on the sides to "Forwards" or "Backwards" in the manufactures software Lix recognizes them as MB4/5

Hypothesis to what's happening: could it be because most mouse that have extra buttons by default set the first extra 2 to be "Forwards" and "Backwards," so Lix is waiting for the Forwards/Backwards input, and not the inherent initial button press?

Simon

All right, thanks for the two of you to confirm that there is new working functionality in the experimental!

Next task for me is to persist the new bindings in the options file user/options.sdl.

In addition to a future-proof differentiation between keyboard key IDs, mouse button IDs, and wheel directions, I'll also save the old IDs for RMB, MMB, wheel up/down. This allows new option files to work with old Lix.

The old IDs for RMB, MMB, wheel up/down are prone to theoretical conflicts with extra keyboard keys from far-future Allegro 5 updates. I'd like to eventually ditch this backward-compatible saving in 3-6 years. But for now, it's better to have backward-compatible option files.

QuoteUpdate 2: Even if I set other buttons then the 2 on the sides to "Forwards" or "Backwards" in the manufactures software Lix recognizes them as MB4/5

Which buttons are "them"?

Quote from: Silken Healer on December 16, 2024, 09:43:37 PMHypothesis to what's happening: could it be because most mouse that have extra buttons by default set the first extra 2 to be "Forwards" and "Backwards," so Lix is waiting for the Forwards/Backwards input, and not the inherent initial button press?

I'm only reacting Allegro 5's events for mouse button down, and for mouse button up. I receive a button ID (an integer ≥ 1) for each, and no other information. I'd have to dive into Allegro 5's Windows-specific mouse implementation to tell you more.

-- Simon

Silken Healer

Quote from: Simon on December 17, 2024, 03:05:53 AMWhich buttons are "them"?
Any other than left click, right click, middle click, or the two on the sides labelled as button 4 and 5

Simon

Quote from: Simon on December 17, 2024, 03:05:53 AMpersist the new bindings in the options file user/options.sdl.
also save the old IDs for RMB, MMB, wheel up/down.

Done, and earmarked for the next Lix release 0.10.28.

-- Simon

Silken Healer

The feature doesn't really work properly though?

Simon

What fails?

It sounds like your manufacturer's software swaps the buttons around before Windows sees them. That software's reasoning seems to be: Browsers react to MB4 (with page-back) and to MB5 (with page-forward), and you want MB6 to be page-back in the browser, therefore the software makes Windows believe that MB6 is MB4.

What do you expect Windows to see from your mouse, possibly through the manufacturer's software?

What do you expect Lix to see from Windows through Allgero?

Where in the chain (from hardware to Lix) do you see a bug?

-- Simon

Silken Healer

As I said in a previous post, Lix should react to the inherent initial mouse button, not the browser "Forwards"/"Backwards" action. Due to my testing, I believe the problem is Lix is reacting for the "Forwards"/"Backwards" action, not the inherent initial mouse button.

That's not even starting on how would people use MB6+ in Lix.

Simon

QuoteLix should react to the inherent initial mouse button

I'd have to bypass your operating system's drivers (including your manufacturer's software) and write my own driver for your hardware and read your hardware's raw output.

Quotenot the browser "Forwards"/"Backwards" action

Lix sees no such named action. All Lix sees is button IDs.

If your manufacturer's software calls MB4 "browser backwards" when it swaps your buttons, that doesn't change that Lix sees the already-swapped integers, not meaningful names.

-- Simon

Silken Healer

Quote from: Simon on December 18, 2024, 05:30:14 AMI'd have to bypass your operating system's drivers (including your manufacturer's software) and write my own driver for your hardware and read your hardware's raw output.

I'm sorry if you thought I was being selfish and only wanted it for me. I thought it was not working as you intended for anybody. If you think it is not broken, then feel free to release it.

You do realize that the Mouse Button 4/5 aren't necessarily "Forwards"/"Backwards" by default and can just be Mouse Button 4/5, right? That might be where the confusion lies

Simon

#14
Right, we agree that MB4 isn't necessarily browser-backwards.

Browsers may react to MB4 by executing their page-back function; we don't care, Lix isn't a browser.

Your manufacturer's software sees MB4, and calls MB4 "browser backwards". We don't care ... or do we? Does that software fire some sort of non-mouse-button event that browsers somehow catch? Who knows exactly what your software does. I assume that it fires no such event. I assume it acts like a driver, swapping the button presses before your OS exposes the button presses to applications.

Now what exactly happens to your MB4 input that doesn't happen to WillLem's MB4 input? WillLem's X1 is MB4 (different name) and WillLem can bind MB4 successfully in Lix. If you think that Lix has the bug (instead of that your software is misconfigured or buggy), sure, that's possible, but then why does WillLem succeed in binding MB4 in Lix?

-- Simon