Code Monkey home page Code Monkey logo

Comments (3)

Airblader avatar Airblader commented on June 13, 2024

Thanks! I think we need to look into what xinput does under the good, and find out if we can query this mapping through some API in Xinput2. If so there shouldn't be any reason why we can't respect the mapping.

from unclutter-xfixes.

Airblader avatar Airblader commented on June 13, 2024

Relevant code from xinput: https://cgit.freedesktop.org/xorg/app/xinput/tree/src/buttonmap.c

The button map is actually device specific. We can use XGetDeviceButtonMapping to get the map, and I think the raw event has a deviceid property.

Edit: Also, just for reference, here's the XI2 spec: https://www.x.org/releases/X11R7.7/doc/inputproto/XI2proto.txt

from unclutter-xfixes.

Airblader avatar Airblader commented on June 13, 2024

Approach-wise, we can do the following:

static bool is_button_ignored(const XIRawEvent *data) {
    if (config.ignore_scrolling && (data->detail == 4 || data->detail == 5)) {
        return true;
    }

    if (config.ignore_buttons.count == 0) {
        // Return early so we don't query the mapping unless needed
        return false;
    }

    long mapped_button = /* … Get mapping of data->detail … */
    // …
}

I think for --ignore-scrolling we should not map the 4 / 5 as I believe those should always be interpreted as scroll wheel – I'm not entirely sure, to be honest, though. Even if so, the user could always ignore scrolling respecting the mapping by using --ignore-buttons instead then.

from unclutter-xfixes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.