input/tablet: Take Seat<Self> and TabletToolHandle in tablet_tool_image() - #2134
input/tablet: Take Seat<Self> and TabletToolHandle in tablet_tool_image()#2134ids1024 wants to merge 3 commits into
Seat<Self> and TabletToolHandle in tablet_tool_image()#2134Conversation
I don´t think it's a good idea. Other handles don't have an associated userdata (the cursor image for pointer is stored within the seat), and accessing the userdata might be problematic if smithay/src/input/pointer/mod.rs Lines 814 to 817 in 347b2b3 One goal I had was for the
This was made on purpose to match the other Grabs are meant to alter the behavior before events are forwarded to clients, and they are called by the handle so they need a locked version which is held by the InnerHandle.
|
I'm not sure if it's a good idea, but the difference is that there is at most one pointer or keyboard (etc.) on a given seat, while there may (technically) be any number of tablet tools at a given time. So have a per-tool udata avoids needing to have an extra list of tools that needs to be cleaned up as tools are removed. (Which is mildly annoying, but not really an issue.)
I mean that the other implementations use a "handle" for I haven't looked into how the tablet code is currently handling the locks here, but it should be possible to behave the same way as pointer/keyboard/touch. |
I understand (and somewhat agree with the annoying part). I was just pointing out that the function may be called from the locked handle, so having a UserDataMap in the
Unless you're speaking of another kind of target, they don't. All of them are called from their respective PointerTarget gets the smithay/src/input/pointer/mod.rs Lines 98 to 107 in 7ddcd17 As does the TouchTarget: smithay/src/input/touch/mod.rs Lines 201 to 209 in 7ddcd17 The KeyboardTarget does get a 'Handle', but that's not a handle on the device, but on Keysyms: smithay/src/input/keyboard/mod.rs Lines 36 to 53 in 7ddcd17 EDIT: For completeness sake, Smithay's To go back to your original use-case, I guess you could add the UserDataMap to the |
Ah right. I guess
Yeah, I'll probably just add it to the seat user data in cosmic-comp. |
This is a bit clearer, and amounts to the same thing other than storing an extra `WeakHandle`.
Description
Trying to properly implement tablet tool cursor images for cosmic-comp, I wonder if a
TabletToolDescriptoris the most useful thing to have as an argument. Left as a draft while I still figure out how to use this, and may want other changes. (Perhaps having userdata for the tool handle would be a good place to store the cursor?.)I see
TabletToolTargetalso takesTabletToolDescriptorinstead ofTabletToolHandle. WhileTabletToolGrabinstead takes aTabletToolInnerHandle.Checklist