diff options
| author | Calvin Morrison <calvin@pobox.com> | 2026-05-18 00:00:17 -0400 |
|---|---|---|
| committer | Calvin Morrison <calvin@pobox.com> | 2026-05-18 00:00:17 -0400 |
| commit | 65c7ea9fbf4886fa3d6127c5fa699520f30f386c (patch) | |
| tree | bca364e1c1f0244d477349345ec7dd531b8032f8 /src/ui/oss/osspopup.cpp | |
| parent | 3909a06fe6786027c83e3adaef89c343cde4fbe3 (diff) | |
OSS backend for FreeBSD support
Adds a complete OSS audio backend alongside PulseAudio and ALSA:
- OssDevice/OssModel: enumerate /dev/mixer*, poll for changes at 500ms
- Full UI layer: mixer window, system tray, mini popup, per-channel widgets
- Fake mute (saves/restores volume since OSS has no mute bit)
- BackendController and PreferencesDlg updated; backend combo now uses
m_backendIds list so any combination of compiled-in backends works
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/ui/oss/osspopup.cpp')
| -rw-r--r-- | src/ui/oss/osspopup.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/ui/oss/osspopup.cpp b/src/ui/oss/osspopup.cpp new file mode 100644 index 0000000..39279b5 --- /dev/null +++ b/src/ui/oss/osspopup.cpp @@ -0,0 +1,78 @@ +#include "osspopup.h" +#include "ossdevicewidget.h" +#include "../../model/ossmodel.h" +#include "../../model/ossdevice.h" + +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqapplication.h> +#include <tqdesktopwidget.h> +#include <twin.h> +#include <tdelocale.h> + +OssPopup::OssPopup( OssModel *model, TQWidget *parent ) + : TQWidget( parent, "OssPopup", + WStyle_Customize | WType_Popup | WStyle_DialogBorder ), + m_model(model), m_container(0), m_widget(0) +{ + TQVBoxLayout *outer = new TQVBoxLayout(this, 4, 0); + m_container = new TQWidget(this); + outer->addWidget(m_container); + + connect(model, TQ_SIGNAL(deviceAdded(OssDevice*)), this, TQ_SLOT(rebuild())); + connect(model, TQ_SIGNAL(preferredOutputChanged(OssDevice*)), this, TQ_SLOT(rebuild())); + + rebuild(); +} + +void OssPopup::rebuild() +{ + delete m_container->layout(); + if ( m_widget ) { delete m_widget; m_widget = 0; } + + TQVBoxLayout *vbox = new TQVBoxLayout(m_container, 4, 0); + OssDevice *dev = m_model->preferredOutput(); + if ( dev ) { + m_widget = new OssDeviceWidget(dev, m_container); + vbox->addWidget(m_widget); + m_widget->show(); + } else { + vbox->addWidget(new TQLabel(i18n("No output device."), m_container)); + } + + if ( isVisible() ) adjustSize(); +} + +void OssPopup::toggleAt( const TQPoint &trayPos, const TQSize &traySize ) +{ + if ( isVisible() ) { hide(); return; } + + rebuild(); + adjustSize(); + + TQRect screen = TQApplication::desktop()->screenGeometry(trayPos); + int x = trayPos.x() + traySize.width() / 2 - width() / 2; + int y = trayPos.y() - height(); + if ( y < screen.top() ) y = trayPos.y() + traySize.height(); + if ( x + width() > screen.right() ) x = screen.right() - width(); + if ( x < screen.left() ) x = screen.left(); + + move(x, y); + show(); + + KWin::setState(winId(), NET::KeepAbove | NET::SkipTaskbar | NET::SkipPager); + KWin::setOnAllDesktops(winId(), true); +} + +bool OssPopup::justHidden() const +{ + return m_hideTime.isValid() && m_hideTime.elapsed() < 100; +} + +void OssPopup::hideEvent( TQHideEvent *e ) +{ + TQWidget::hideEvent(e); + m_hideTime.start(); +} + +#include "osspopup.moc" |
