kamaaina / macropad_tool

tool to program a macropad
50 stars 6 forks source link

"wheelup" and "wheeldown" are not working properly #20

Closed zenmaster3000 closed 5 months ago

zenmaster3000 commented 5 months ago

I have the following configuration.

(
    device: (
        // Normal, Clockwise, CounterClockwise, UpsideDown
        orientation: Normal,
        rows: 3,
        cols: 4,
        knobs: 2,
    ),
    layers: [
        // layer 1
        (
            buttons: [
                [(delay: 0, mapping: "prev"), (delay: 0, mapping: "stop"), (delay: 0, mapping: "play"), (delay: 0, mapping: "next")],
                [(delay: 0, mapping: "space"), (delay: 0, mapping: "space"), (delay: 0, mapping: "f"), (delay: 0, mapping: "g")],
                [(delay: 0, mapping: "space"), (delay: 0, mapping: "space"), (delay: 0, mapping: "f"), (delay: 0, mapping: "g")],
           ],
            knobs: [
                (ccw: (delay: 0, mapping: "volumedown"), press: (delay: 0, mapping: "mute"), cw: (delay: 0, mapping: "volumeup")),
                (ccw: (delay: 0, mapping: "wheeldown"), press: (delay: 0, mapping: "mclick"), cw: (delay: 0, mapping: "wheelup")),
            ],
        ),
    ],
)

When using the "wheeldown" I get the following out put when testing with xev:

ButtonPress event, serial 39, synthetic NO, window 0x1a00001,
    root 0x1cf, subw 0x0, time 11609003, (81,102), root:(1272,750),
    state 0x14, button 4, same_screen YES

ButtonRelease event, serial 39, synthetic NO, window 0x1a00001,
    root 0x1cf, subw 0x0, time 11609003, (81,102), root:(1272,750),
    state 0x814, button 4, same_screen YES

KeyRelease event, serial 39, synthetic NO, window 0x1a00001,
    root 0x1cf, subw 0x0, time 11609008, (81,102), root:(1272,750),
    state 0x14, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 39, synthetic NO, window 0x1a00001,
    root 0x1cf, subw 0x0, time 11609016, (81,102), root:(1272,750),
    state 0x10, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False
zenmaster3000 commented 5 months ago

I fixed it by commenting out the line 371 from the k884x.rs file.

...
                } else if let Ok(a) = MouseAction::from_str(key) {
                    //m_c = 0x01;     /////////This line //////////      
                    match a {
                        MouseAction::WheelUp => mouse_action = 0x01,
                        MouseAction::WheelDown => mouse_action = 0xff,
                        _ => (),
                    }
                    msg[4] = 0x03;
                }
...
kamaaina commented 5 months ago

sorry about that!

thank you for reporting this bug to me. yes, you are correct, currently wheelup and wheeldown are being programmed as ctrl+wheelup and ctrl+wheeldown which essentially zooms in/out in a browser. thanks for suggesting the fix as well.

kamaaina commented 5 months ago

committed and pushed fix