Commit graph

14 commits

Author SHA1 Message Date
Norihiro Kamae fd502cbd4d
UI: Fix crash at render_display while shutdown on macOS
The display context was sometimes created again by a resize event after
destruction from `OBSBasic::closeEvent`. That resulted in the display
context alive until reaching the destructor of the `OBSQTDisplay` class
and caused a crash in `render_display` on macOS. To avoid this, destroy
the display context at the event `SurfaceAboutToBeDestroyed` and let not
create the display context again.
2023-08-15 13:40:09 +09:00
Norihiro Kamae fa17168ba2
UI: Removes the workaround of not receiving expose event
The commit e67fdbca79 is a workaround for QtWayland bug that the
`QEvent::Expose` was never received on a certain condition.
The bugfix was introduced to QtWayland 6.1.0 so that the workaround is
not necessary for now.
2023-08-15 13:12:34 +09:00
gxalpha a4834efde9 UI: Remove Qt 5 ifdef guards and code 2023-07-12 13:22:13 -04:00
Kurt Kartaltepe f8d415afbe UI: Close display before native surfaces
This hooks the platform specific events in order to close the obs
display more accurately. Earlier attempts on hooking visiblity, but Qt
does not ensure that visibility is changed before the surface is
destroyed. So we ended up racing with the EGL driver and on some
drivers if you lose the race they hang.

Also only force display creation if the display is actually visible.
When a source type is not video/drawable (or is missing) this would
force the display to be created for the blank window and also hang.

Finally force closure of the preview displays during scene cleanup to
avoid similar ordering issues in Qt. Qt has even less order guarentees
during close and we are sure that displays are no longer needed at this
point in the UI.
2022-05-28 16:54:37 -07:00
jpark37 61ffb5c4d8 UI: Add OBSQTDisplay::OnMove()/OnDisplayChange()
This plumbing will be useful when handling color space changes.

Currently does nothing, and only Windows is wired for now.
2022-02-26 01:09:07 -08:00
Georges Basile Stavracas Neto 226cc22669 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.
2021-02-09 09:39:17 -03:00
Georges Basile Stavracas Neto 60dab2cf1c UI: Destroy display when becoming invisible
When a window is made invisible, then visible again, the
obs_display is reused. Turns out, QT destroys the wl_surface
associated with the previewer on Wayland. However, the EGL
surface created on top of this wl_surface is not, and any
attempt to attach a new buffer to it will crash OBS.

Destroy the obs_display when becoming invisible, and when
running as a Wayland client. Also nullify the display
variable on destruction, to avoid subclasses double-freeing
the obs display.
2021-02-09 09:39:17 -03:00
jpark37 c2ddc428b0 UI: Fix warnings for Qt 5.15
AllDockWidgetFeatures is now deprecated. Use underlying values instead.

Use default QFlags constructor instead of nullptr/0.

Use QWheelEvent::angleDelta() in place of orientation() and delta(), and
position() in place of x() and y().
2020-06-21 18:23:05 -07:00
jp9000 f53df7da64 clang-format: Apply formatting
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed.  Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
2019-06-23 23:49:10 -07:00
SuslikV e2be33956b UI: Correct custom property implementation
- Fixes Q_PROPERTY macro syntax
- Removes excessive notification declaration and slot
- Removes unneeded dynamic property
- Improves Themes versatility
2019-04-17 07:10:12 -07:00
SuslikV 975431a7c7 UI: Add default color for the preview background
If custom theme for obs UI has no record about background custom
property in the qss file, then application can set random color per
display initialization. This fixes this issue.
2019-04-17 06:32:27 -07:00
Shaolin 5d3c6428f7 UI: Fix Q_PROPERTY compiling warnings 2019-03-29 06:22:14 -03:00
cg2121 0ae8a7c0ac UI: Add ability to style preview background color 2018-09-10 04:55:15 -05:00
jp9000 01b274f1da UI: Rename 'obs' dir to 'UI'
This is to prevent confusion both when prefixing commits and when
reading the directory structure for the first time.
2016-08-27 20:19:45 -07:00
Renamed from obs/qt-display.hpp (Browse further)