xcompcap was taking locks in the wrong order resulting in deadlocks on
close. If you had an xcompcap properties window open on close it was
nearly 100% deadlock. This ensures locks are taken in the same order as
libobs takes when shutting down.
Track all windows corresponding to sources and ensure that we only
disable XSelectInput events once all sources for a given window have
been removed. Previously we may have stopped listening for events if
multiple sources captured the same window and one was removed.
We also move window redirection into the helper to avoid similar issues.
Previously we only captured by window name and class. This prevented
capture of windows with the same name and class, and caused captures to
switch from one window to another of the same name and class.
Well, linear SRGB for screen capture. The window capture path failed to
copy between SRGB textures for some reason, so just force nonlinear
formats instead.
RandR has two sets of screen geometry information:
1. CRTC. These are the physical scanout engines in the hardware
2. Monitors. These are the logical partitions of the screen.
By default, each CRTC gets mapped to a Monitor. However, some monitors
actually require two CRTCs to drive them due to limitations in the
scanout hardware. Users can also create 'virtual' monitors to support
VNC or other systems.
This patch makes the RandR code prefer the Monitor mechanism to the
older CRTC mechanism. If the server doesn't support a new enough RandR
version, the existing CRTC code is used instead.
The name of the monitor is also provided in place of the arbitrary
number to help users select the desired source.
Signed-off-by: Keith Packard <keithp@keithp.com>
When cropping the left or top of a window capture, OBS would misalign
the drawn cursor, placing it as if the entire window were being
captured. Instead, offset the captured cursor by the same number of
pixels, thus placing the cursor back where it belongs.
Move xlock after initial window listing
- XErrorLock uses static fields so when you use them recursively
they collide and do weird things. This keeps the two xlocks from
colliding.
Build obs textures based on returned pixmap texture types to ensure
compatibility during copies. (prevents glCopyImageSubData failed due to
texture incompatibilities)
Fix alpha check by using pixmap depth instead of checking channel sizes
(wrong on nvidia and maybe amd hardware)
Fix X error checking, now you will get 1 BadAlloc when pixmap allocation
fails instead "glCopyImageSubData failed" every frame. (occurs on Gnome
under special circumstances)
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.
Rather than inheriting the exact visuals from the window,
find whether the color buffer has alpha, find a config with
the necessary attributes for capture, and match its depth to
the depth of the window instead of the color buffer. Also,
cleanup glxpixmap texture binding before destroying the texture.
Update: Style conformancy changes
Previously toggled swapRedBlue every update regardless of settings being set, which resulted in
moving or resizing of windows causing undesired color-swapping behavior. Also now use more direct
method of comparing visualIDs without type-casting and base the glxpixmap attributes on texture
format being used rather than the bit-depth of the window.
Adds support for windows with alpha channels as well as swapping red
and blue when using GS_BGRX. glXFBConfig now attempts to inherit
its format from the captured window when possible.
Change log message
Some window managers like i3 don't issue Expose events when switching
between workspaces, but send VisibilityNotify events. This causes the
stream to freeze even when the workspace is switched back.
Related issue: #863