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

The built-in KeyImage.Black does not always work #58

Open
wojciechsura opened this issue Jun 27, 2024 · 2 comments
Open

The built-in KeyImage.Black does not always work #58

wojciechsura opened this issue Jun 27, 2024 · 2 comments

Comments

@wojciechsura
Copy link

wojciechsura commented Jun 27, 2024

Occasionally, when button image is replaced with KeyImage.Black, it does not get replaced at all, leaving images from previous screen. This happens when all buttons are replaced in sequence (e.g. when switching the whole screen to a different one).

Workaround: create a black (e.g.) 72x72 image manually and pass it instead of KeyImage.Black.

@wischi-chr
Copy link
Member

Can you post a code snippet to reproduce that behavior?

@wojciechsura
Copy link
Author

wojciechsura commented Jun 27, 2024

Again, I don't have short code, but you may reproduce it in my project.

        public override void UpdateVisuals(List<KeyboardElementVisuals> buttons, List<KeyboardElementVisuals> encoders)
        {
            if (deck == null)
                return;

            if (sleep)
            {
                deck.SetBrightness(brightness);
                sleep = false;
            }

            // Prepare images to display            

            for (int i = 0; i < buttons.Count; i++)
            {
                RawImage? image = buttons[i].CustomCache as RawImage;
                if (image != null)
                    deck.SetKeyBitmap(i, KeyBitmap.Create.FromBgra32Array(image.Width, image.Height, image.Argb));
                else
                    deck.SetKeyBitmap(i, KeyBitmap.Black);
            }
        }

The last line sets the image of a button to black if there is no image set by the user.

  • Rebuild whole solution (important!)
  • Start the application
  • Add a Stream Deck keyboard
  • Configure layout
  • Add some images to buttons (may be the same)
  • Make one button a folder (drag the folder macro from the list onto the button)
  • Add some (different) images to buttons in the folder
  • Confirm layout
  • Use the Stream Deck to open the folder and close it multiple times. The bug should manifest itself by buttons not being cleared every time (in my case it happened roughly once for 3-4 attempts).

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

No branches or pull requests

2 participants