Skip to content
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

Fix TabletBelongsTo deserialization #254

Merged

Conversation

sij1nk
Copy link
Contributor

@sij1nk sij1nk commented Aug 4, 2024

Fixes #253

In the output of hyprctl -j devices, .tablets[].belongsTo is an object, which we try to deserialize into the TabletBelongsTo enum. However, this JSON object is just a "flat" object, containing the fields of one of the enum variants, without a tag specifying which variant it is. So we must use #[serde(untagged)] to correctly deserialize it


edit: technically there is a tag: the type field in the parent object:

{
    "address": "0x627fa3b386f0",
    "type": "tabletPad",                     <--
    "belongsTo": {
      "address": "0x0",
      "name": ""
    }
  },

Lmk if this solution is acceptable or if should instead take that type field into account (practically I don't think there's a difference)

Copy link
Member

@yavko yavko left a comment

Choose a reason for hiding this comment

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

thanksies

@yavko yavko merged commit 9e3b78d into hyprland-community:master Aug 4, 2024
3 checks passed
@sij1nk sij1nk deleted the serde-rename-tabletbelongsto branch August 4, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Devices::get fails if a drawing tablet is connected
2 participants