Skip to content

Fix: ignore *pass-on* counters when detecting left-button grabs from llTakeControl #3990

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

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

Sekkmer
Copy link
Contributor

@Sekkmer Sekkmer commented Apr 28, 2025

A script that takes CONTROL_ML_LBUTTON with pass_on = TRUE should not prevent the viewer from normal clicking in mouse look, yet in practice it does:

llTakeControls(CONTROL_ML_LBUTTON, TRUE, TRUE);

This happens because LLAgent::leftButtonGrabbed() treats “pass-on” requests as a full grab, unlike the other …Grabbed() helpers.

ref: Wiki: llTakeControls

Solution

Remove the two mControlsTakenPassedOnCount checks; the function now tests only the real grab counters, exactly like rotateGrabbed(), upGrabbed(), etc.

Testing

  1. Drop the script below into any prim, accept the permission request
default {
    state_entry() {
        llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
    }
    run_time_permissions(integer perm) {
        if(PERMISSION_TAKE_CONTROLS & perm) {
            llTakeControls(CONTROL_ML_LBUTTON, TRUE, TRUE);              
        }
    }
    control(key id, integer level, integer edge)
    {}
}
  1. Enter mouse look (first person mode)
    Before this patch you cannot click doors, HUDs, etc.
    After this patch clicks work normally.

Note

I only tested this change on Firestorm as building LL viewer on Linux is not straight forward, but this issue is also present in LL viewer and the code is exactly the same, here is the corresponding PR on FS side: FS PR #113

LLAgent::leftButtonGrabbed() must report TRUE only when an attachment has
**actually grabbed** the left mouse button (accept = TRUE, pass_on = FALSE), like every other ...Grabbed() function below it
@github-actions github-actions bot added the c/cpp label Apr 28, 2025
Copy link

github-actions bot commented Apr 28, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Sekkmer
Copy link
Contributor Author

Sekkmer commented Apr 28, 2025

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@marchcat marchcat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

Copy link
Contributor

@marchcat marchcat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only tested this change on Firestorm as building LL viewer on Linux is not straight forward, but this issue is also present in LL viewer and the code is exactly the same

Checked on LL viewer and it works as described.

@marchcat marchcat merged commit 65d70a8 into secondlife:develop Apr 29, 2025
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix mouselook leftclick disabled by passon from llTakeControl
2 participants