Hey guys,
Got a weird one. I began testing one of our apps on Linux today and noticed the UI was intermittently being ‘weird’, buttons wouldn’t trigger, sliders wouldn’t drag, etc.
I made a little debug ‘paint’ app to show what positions I was receiving in the mouse event methods and the results are …interesting.
On Windows, you can see the drawing is smooth and as expected
On Linux I get…
Sometimes it works correctly after a reboot but it will fail when run again.
Sometimes I can draw vertical lines only.
This happens on 3 separate (x86) machines, 3 different Linux distros and various tested touch/mouse devices. Other apps are not effected (firefox, dragging the mouse etc).
The test code is pretty simple:
struct Paint : Component
{
OpenGLContext gl;
Image image;
Paint()
{
gl.attachTo(*this);
setOpaque(true);
}
void paint(Graphics& g) override
{
g.fillAll(Colours::white);
g.drawImage(
image,
getLocalBounds().toFloat()
);
}
void resized() override
{
image = Image(Image::PixelFormat::RGB, getWidth(), getHeight(), true);
Graphics(image).fillAll(Colours::white);
}
void mouseDrag(const MouseEvent& e) override
{
Graphics g(image);
g.setColour(Colours::black);
g.fillEllipse(
e.getPosition().x - 5, e.getPosition().y - 5,
10, 10
);
repaint();
}
};