Butterfly icon indicating copy to clipboard operation
Butterfly copied to clipboard

[Bug]: Lenovo Ideapad: Stylus buttons are not correctly recognized

Open OsiPog opened this issue 1 month ago • 14 comments

What happened?

I'd love to drop Xournal++ for Butterfly but there seems to be an issue with my stylus. I am using the Lenovo Ideapad Flex and its stylus. Using the pointer test in Butterfly I can see that pressing the first button on the stylus causes "Input" to flash from 1 to 0 and back to 1. When I press the second button "Input" becomes "5 (101)".

I tried wev there I have the same behavior. But on https://thetest.com/tests/input and in Xournal++ it works perfectly.

I understand that this is not enough information for anyone to make a fix but can someone point me in the right direction of debugging this problem?

Version

2.4.0

Platform

Linux

Relevant log output


Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

OsiPog avatar Nov 15 '25 18:11 OsiPog

It should show Touch as input type? Then this should be a duplicate on #238. I'm currently working on support on windows for flutter and I'm maybe starting working on linux after that: https://github.com/flutter/flutter/pull/165323

CodeDoctorDE avatar Nov 15 '25 19:11 CodeDoctorDE

It shows "Pen" input though. Are there maybe any logs I could share?

-------- Original Message -------- On 15/11/2025 20:03, CodeDoctor wrote:

CodeDoctorDE left a comment (LinwoodDev/Butterfly#968)

It should show Touch as input type? Then this should be a duplicate on #238. I'm currently working on support on windows for flutter and I'm maybe starting working on linux after that: flutter/flutter#165323

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

OsiPog avatar Nov 15 '25 19:11 OsiPog

Oh then this is nice. didn't know that. I'm not sure what the problem is? The input test is just an internal testing so it's not really useful for endusers but i can explain it to you. What you see is a bit mapping. The number should be read binary. If you see a 0001 (1) you have pressed the first button (on stylus it isn't useful). If you see 0010 (2) you have pressed the second button (on stylus the first button) and 0100 (4) the second one.

I just looked at my code and found out that the second button on stylus wouldn't be detected correctly, is this currently the problem on your side that you can't map the button?

CodeDoctorDE avatar Nov 15 '25 19:11 CodeDoctorDE

This is kind of the problem. As I said pressing the first button is not recognized as a button press, but as a very quickly lifting the pen and then putting it back to the screen. The second button is recognized as a 5, and that means its drawing even when the pen not on the screen.

If I find time tomorrow on the train I can debug this further by compiling the code myself. Do you have any point where I could start?

-------- Original Message -------- On 15/11/2025 20:13, CodeDoctor wrote:

CodeDoctorDE left a comment (LinwoodDev/Butterfly#968)

Oh then this is nice. didn't know that. I'm not sure what the problem is? The input test is just an internal testing so it's not really useful for endusers but i can explain it to you. What you see is a bit mapping. The number should be read binary. If you see a 0001 (1) you have pressed the first button (on stylus it isn't useful). If you see 0010 (2) you have pressed the second button (on stylus the first button) and 0100 (4) the second one.

I just looked at my code and found out that the second button on stylus wouldn't be detected correctly, is this currently the problem on your side that you can't map the button?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

OsiPog avatar Nov 15 '25 19:11 OsiPog

Oh that's strange. On the lower level, there is the flutter engine code which gets its input from gtk but I'm not really sure how it works there.

CodeDoctorDE avatar Nov 15 '25 19:11 CodeDoctorDE

can you please see if the latest nightly fixes the issue?

CodeDoctorDE avatar Dec 02 '25 19:12 CodeDoctorDE

can you please see if the latest nightly fixes the issue?

I am not OP but I've got a lenovo laptop with a similar issue when it comes to the pen. My laptop didn't come with a pen but I bought the lenovo one off their website. I'm running Fedora 42, but the pen buttons work fine in Xournal++. I installed the nightly build and the first button on the pen is still unrecognized (it is physically the first button on the pen, but in software it seems to be the 3rd button as Xournal++ shows the first button as the one that draws and the button it shows as the second button is the one that is currently working in Linwood Butterfly, and the third button (the one that is not working) it just shows as eraser, but it comes 3rd in the list so its likely the third button).

I attached a screenshot of how it looks in Xournal++. And to clarify the button labeled as eraser is the one that isn't working in Linwood Butterfly. Everything else works.

Image

And here in Linwood Butterfly it is the second button that isn't working.

Image

jackniedermayer avatar Dec 08 '25 14:12 jackniedermayer

Oh interesting, can you give me the button output the first button (the one that doesnt work) in the pointer test in the input settings

CodeDoctorDE avatar Dec 08 '25 14:12 CodeDoctorDE

Oh interesting, can you give me the button output the first button (the one that doesnt work) in the pointer test in the input settings

I just tested it and pressing the button doesn't do anything in the pointer test. As in it's as if I'm not pressing the button so it just changes from 0 when not clicking to 1 when clicking the screen

Edit: The other button does work though, it changes from 2 (10) when not pressing down to 3 (11) when pressing down.

jackniedermayer avatar Dec 08 '25 14:12 jackniedermayer

Did you pressing the button while having the pen on the screen like with the other button?

CodeDoctorDE avatar Dec 08 '25 14:12 CodeDoctorDE

Using this tester https://thesevenpens.github.io/HtmlTabletTester/ the button that isn't working in Butterfly shows up as 32 (eraser), the pen tip shows up as 1 (pen tip), and the working button shows up as 3 (unknown)

jackniedermayer avatar Dec 08 '25 14:12 jackniedermayer

Did you pressing the button while having the pen on the screen like with the other button?

I did and it didn't change anything

jackniedermayer avatar Dec 08 '25 15:12 jackniedermayer

I would like to see the values inside the pointer tests in butterfly to assign these internal inputs. I think they are different. You could find it in the settings under inputs and then press the button while having the pen pressing on the rectangle. Which platform are you on? Web or Linux?

CodeDoctorDE avatar Dec 08 '25 15:12 CodeDoctorDE

I am on linux, I am in the discord. Would it be easier to call on discord and stream this over the call? I'm not entirely sure what you mean

jackniedermayer avatar Dec 08 '25 15:12 jackniedermayer