mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
Piano: Use CEventLoop::wake() to trigger repaint from sound thread.
In order to repaint the GUI after the sound thread has produced some sweet new waves, we post a CCustomEvent to the main thread's event loop and then wake up that event loop via CEventLoop::wake().
This commit is contained in:
parent
17ee548bcd
commit
1ecb7462b7
3 changed files with 16 additions and 19 deletions
|
@ -354,3 +354,11 @@ void PianoWidget::render_knobs(GPainter& painter)
|
|||
painter.draw_rect(wave_knob_rect, Color(r, g, b));
|
||||
painter.draw_text(wave_knob_rect, wave_name, TextAlignment::Center, Color(r, g, b));
|
||||
}
|
||||
|
||||
void PianoWidget::event(CEvent& event)
|
||||
{
|
||||
if (event.type() == CEvent::Custom) {
|
||||
update();
|
||||
}
|
||||
GWidget::event(event);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue