mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-04-26 09:28:48 -04:00
UI: Allow resize without timers
This prevents the weird stretching effect that occurs whenever a windows is in the process of being resized by the user. Originally it was intended as an optimization, but even on half-decent computers it doesn't really have much benefit.
This commit is contained in:
@@ -31,7 +31,6 @@ using namespace std;
|
||||
OBSBasicInteraction::OBSBasicInteraction(QWidget *parent, OBSSource source_)
|
||||
: QDialog (parent),
|
||||
main (qobject_cast<OBSBasic*>(parent)),
|
||||
resizeTimer (0),
|
||||
ui (new Ui::OBSBasicInteraction),
|
||||
source (source_),
|
||||
removedSignal (obs_source_get_signal_handler(source), "remove",
|
||||
@@ -58,9 +57,8 @@ OBSBasicInteraction::OBSBasicInteraction(QWidget *parent, OBSSource source_)
|
||||
obs_data_release(settings);
|
||||
|
||||
connect(windowHandle(), &QWindow::screenChanged, [this]() {
|
||||
if (resizeTimer)
|
||||
killTimer(resizeTimer);
|
||||
resizeTimer = startTimer(100);
|
||||
QSize size = GetPixelSize(ui->preview);
|
||||
obs_display_resize(display, size.width(), size.height());
|
||||
});
|
||||
|
||||
const char *name = obs_source_get_name(source);
|
||||
@@ -159,31 +157,18 @@ void OBSBasicInteraction::DrawPreview(void *data, uint32_t cx, uint32_t cy)
|
||||
|
||||
void OBSBasicInteraction::OnInteractionResized()
|
||||
{
|
||||
if (resizeTimer)
|
||||
killTimer(resizeTimer);
|
||||
resizeTimer = startTimer(100);
|
||||
QSize size = GetPixelSize(ui->preview);
|
||||
obs_display_resize(display, size.width(), size.height());
|
||||
}
|
||||
|
||||
void OBSBasicInteraction::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
if (isVisible()) {
|
||||
if (resizeTimer)
|
||||
killTimer(resizeTimer);
|
||||
resizeTimer = startTimer(100);
|
||||
}
|
||||
|
||||
UNUSED_PARAMETER(event);
|
||||
}
|
||||
|
||||
void OBSBasicInteraction::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if (event->timerId() == resizeTimer) {
|
||||
killTimer(resizeTimer);
|
||||
resizeTimer = 0;
|
||||
|
||||
QSize size = GetPixelSize(ui->preview);
|
||||
obs_display_resize(display, size.width(), size.height());
|
||||
}
|
||||
|
||||
QDialog::resizeEvent(event);
|
||||
}
|
||||
|
||||
void OBSBasicInteraction::closeEvent(QCloseEvent *event)
|
||||
|
||||
Reference in New Issue
Block a user