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:
parent
b4fe4ae5b4
commit
b566428233
@ -395,9 +395,8 @@ void OBSBasicFilters::AddFilterFromAction()
|
||||
|
||||
void OBSBasicFilters::OnPreviewResized()
|
||||
{
|
||||
if (resizeTimer)
|
||||
killTimer(resizeTimer);
|
||||
resizeTimer = startTimer(100);
|
||||
QSize size = GetPixelSize(ui->preview);
|
||||
obs_display_resize(display, size.width(), size.height());
|
||||
}
|
||||
|
||||
void OBSBasicFilters::closeEvent(QCloseEvent *event)
|
||||
@ -415,17 +414,6 @@ void OBSBasicFilters::closeEvent(QCloseEvent *event)
|
||||
main->SaveProject();
|
||||
}
|
||||
|
||||
void OBSBasicFilters::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if (event->timerId() == resizeTimer) {
|
||||
killTimer(resizeTimer);
|
||||
resizeTimer = 0;
|
||||
|
||||
QSize size = GetPixelSize(ui->preview);
|
||||
obs_display_resize(display, size.width(), size.height());
|
||||
}
|
||||
}
|
||||
|
||||
/* OBS Signals */
|
||||
|
||||
void OBSBasicFilters::OBSSourceFilterAdded(void *param, calldata_t *data)
|
||||
|
@ -36,7 +36,6 @@ private:
|
||||
OBSBasic *main;
|
||||
|
||||
std::unique_ptr<Ui::OBSBasicFilters> ui;
|
||||
int resizeTimer = 0;
|
||||
OBSSource source;
|
||||
OBSPropertiesView *view = nullptr;
|
||||
|
||||
@ -110,5 +109,4 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual void timerEvent(QTimerEvent *event) override;
|
||||
};
|
||||
|
@ -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)
|
||||
|
@ -36,7 +36,6 @@ class OBSBasicInteraction : public QDialog {
|
||||
|
||||
private:
|
||||
OBSBasic *main;
|
||||
int resizeTimer;
|
||||
|
||||
std::unique_ptr<Ui::OBSBasicInteraction> ui;
|
||||
OBSSource source;
|
||||
@ -70,7 +69,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
virtual void timerEvent(QTimerEvent *event) override;
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
};
|
||||
|
||||
|
@ -1956,9 +1956,8 @@ void OBSBasic::ResizePreview(uint32_t cx, uint32_t cy)
|
||||
previewY += float(PREVIEW_EDGE_SIZE);
|
||||
|
||||
if (isVisible()) {
|
||||
if (resizeTimer)
|
||||
killTimer(resizeTimer);
|
||||
resizeTimer = startTimer(100);
|
||||
QSize size = GetPixelSize(ui->preview);
|
||||
obs_resize(size.width(), size.height());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2057,18 +2056,7 @@ void OBSBasic::resizeEvent(QResizeEvent *event)
|
||||
if (obs_get_video_info(&ovi))
|
||||
ResizePreview(ovi.base_width, ovi.base_height);
|
||||
|
||||
UNUSED_PARAMETER(event);
|
||||
}
|
||||
|
||||
void OBSBasic::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if (event->timerId() == resizeTimer) {
|
||||
killTimer(resizeTimer);
|
||||
resizeTimer = 0;
|
||||
|
||||
QSize size = GetPixelSize(ui->preview);
|
||||
obs_resize(size.width(), size.height());
|
||||
}
|
||||
OBSMainWindow::resizeEvent(event);
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionShow_Recordings_triggered()
|
||||
|
@ -100,7 +100,6 @@ private:
|
||||
int previewX = 0, previewY = 0;
|
||||
int previewCX = 0, previewCY = 0;
|
||||
float previewScale = 0.0f;
|
||||
int resizeTimer = 0;
|
||||
|
||||
ConfigFile basicConfig;
|
||||
|
||||
@ -275,7 +274,6 @@ protected:
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual void changeEvent(QEvent *event) override;
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
virtual void timerEvent(QTimerEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void on_actionShow_Recordings_triggered();
|
||||
|
@ -32,7 +32,6 @@ using namespace std;
|
||||
OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
||||
: QDialog (parent),
|
||||
main (qobject_cast<OBSBasic*>(parent)),
|
||||
resizeTimer (0),
|
||||
acceptClicked (false),
|
||||
ui (new Ui::OBSBasicProperties),
|
||||
source (source_),
|
||||
@ -84,9 +83,8 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
||||
this, SLOT(OnPropertiesResized()));
|
||||
|
||||
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);
|
||||
@ -188,31 +186,18 @@ void OBSBasicProperties::DrawPreview(void *data, uint32_t cx, uint32_t cy)
|
||||
|
||||
void OBSBasicProperties::OnPropertiesResized()
|
||||
{
|
||||
if (resizeTimer)
|
||||
killTimer(resizeTimer);
|
||||
resizeTimer = startTimer(100);
|
||||
QSize size = GetPixelSize(ui->preview);
|
||||
obs_display_resize(display, size.width(), size.height());
|
||||
}
|
||||
|
||||
void OBSBasicProperties::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
if (isVisible()) {
|
||||
if (resizeTimer)
|
||||
killTimer(resizeTimer);
|
||||
resizeTimer = startTimer(100);
|
||||
}
|
||||
|
||||
QDialog::resizeEvent(event);
|
||||
}
|
||||
|
||||
void OBSBasicProperties::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 OBSBasicProperties::Cleanup()
|
||||
|
@ -32,7 +32,6 @@ class OBSBasicProperties : public QDialog {
|
||||
|
||||
private:
|
||||
OBSBasic *main;
|
||||
int resizeTimer;
|
||||
bool acceptClicked;
|
||||
|
||||
std::unique_ptr<Ui::OBSBasicProperties> ui;
|
||||
@ -65,7 +64,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
virtual void timerEvent(QTimerEvent *event) override;
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual void reject() override;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user