mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 09:57:35 +00:00
SoundPlayer: Show the context menu right under the cursor
The context menu used the mouse position by window, which resulted in a pop-up menu in the upper left corner of the screen.
This commit is contained in:
parent
da0095855e
commit
9d36369c58
2 changed files with 3 additions and 6 deletions
|
@ -117,12 +117,9 @@ void BarsVisualizationWidget::set_buffer(RefPtr<Audio::Buffer> buffer)
|
||||||
set_buffer(buffer, buffer->sample_count());
|
set_buffer(buffer, buffer->sample_count());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarsVisualizationWidget::mousedown_event(GUI::MouseEvent& event)
|
void BarsVisualizationWidget::context_menu_event(GUI::ContextMenuEvent& event)
|
||||||
{
|
{
|
||||||
Widget::mousedown_event(event);
|
m_context_menu->popup(event.screen_position());
|
||||||
if (event.button() == GUI::Right) {
|
|
||||||
m_context_menu->popup(event.position());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarsVisualizationWidget::set_samplerate(int samplerate)
|
void BarsVisualizationWidget::set_samplerate(int samplerate)
|
||||||
|
|
|
@ -25,7 +25,7 @@ private:
|
||||||
void set_buffer(RefPtr<Audio::Buffer> buffer, int samples_to_use);
|
void set_buffer(RefPtr<Audio::Buffer> buffer, int samples_to_use);
|
||||||
|
|
||||||
void paint_event(GUI::PaintEvent&) override;
|
void paint_event(GUI::PaintEvent&) override;
|
||||||
void mousedown_event(GUI::MouseEvent& event) override;
|
void context_menu_event(GUI::ContextMenuEvent& event) override;
|
||||||
|
|
||||||
Vector<Complex<double>> m_sample_buffer;
|
Vector<Complex<double>> m_sample_buffer;
|
||||||
Vector<int> m_gfx_falling_bars;
|
Vector<int> m_gfx_falling_bars;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue