UI: Make OBSQTDisplay::CreateDisplay() public and allow forcing creation

This will be used by a new event filter, added only when running as a Wayland
client, to force creating the obs_display instance even when not exposed.
This commit is contained in:
Georges Basile Stavracas Neto 2020-08-20 11:57:19 -03:00
parent b629265e7f
commit 226cc22669
2 changed files with 6 additions and 4 deletions

View file

@ -87,9 +87,12 @@ void OBSQTDisplay::UpdateDisplayBackgroundColor()
obs_display_set_background_color(display, backgroundColor);
}
void OBSQTDisplay::CreateDisplay()
void OBSQTDisplay::CreateDisplay(bool force)
{
if (display || !windowHandle()->isExposed())
if (display)
return;
if (!windowHandle()->isExposed() && !force)
return;
QSize size = GetPixelSize(this);

View file

@ -13,8 +13,6 @@ class OBSQTDisplay : public QWidget {
OBSDisplay display;
void CreateDisplay();
void resizeEvent(QResizeEvent *event) override;
void paintEvent(QPaintEvent *event) override;
@ -36,4 +34,5 @@ public:
QColor GetDisplayBackgroundColor() const;
void SetDisplayBackgroundColor(const QColor &color);
void UpdateDisplayBackgroundColor();
void CreateDisplay(bool force = false);
};