Skip to content
Snippets Groups Projects
Commit 6e505fdf authored by Pierre Lamot's avatar Pierre Lamot Committed by Hugo Beauzée-Luyssen
Browse files

qt: fix composition with xcb_render vout display

widget would normally require WindowTransparentForInput, without this we end up
with an invisible area within our window that grabs our mouse events. But using
this this causes rendering issues with some VoutDisplay (xcb_render for
instance) instead, we manually, set a null intput region afterwards (see
setTransparentForMouseEvent)
parent 706bfd4e
No related branches found
No related tags found
No related merge requests found
......@@ -115,6 +115,13 @@ bool CompositorX11::init()
"X11 Composite version is too old, 0.2+ is required");
REGISTER_XCB_EXTENSION(m_conn, composite, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION);
if (!checkExtensionPresent(m_intf, m_conn, "XFIXES"))
return false;
//2.x is required for SetWindowShapeRegion
static_assert (XCB_XFIXES_MAJOR_VERSION >= 2,
"X11 Fixes version is too old, 2.0+ is required");
REGISTER_XCB_EXTENSION(m_conn, xfixes, XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION);
// check whether we're running under "XWAYLAND"
auto screens = qApp->screens();
bool isXWayland = std::any_of(screens.begin(), screens.end(), [](QScreen* screen){
......@@ -147,9 +154,13 @@ bool CompositorX11::makeMainInterface(MainCtx* mainCtx)
m_mainCtx = mainCtx;
m_videoWidget = std::make_unique<DummyNativeWidget>();
m_videoWidget->setWindowFlag(Qt::WindowType::BypassWindowManagerHint);
m_videoWidget->setWindowFlag(Qt::WindowType::WindowTransparentForInput);
// widget would normally require WindowTransparentForInput, without this
// we end up with an invisible area within our window that grabs our mouse events.
// But using this this causes rendering issues with some VoutDisplay
// (xcb_render for instance) instead, we manually, set a null intput region afterwards
// see setTransparentForMouseEvent
m_videoWidget->winId();
m_videoWidget->setWindowFlag(Qt::WindowStaysOnBottomHint);
m_videoWidget->show();
bool useCSD = m_mainCtx->useClientSideDecoration();
......
......@@ -31,6 +31,7 @@
#include "compositor_x11_renderwindow.hpp"
#include "compositor_x11_renderclient.hpp"
#include "compositor_x11_uisurface.hpp"
#include "compositor_x11_utils.hpp"
#include <vlc_cxx_helpers.hpp>
......@@ -553,6 +554,7 @@ void CompositorX11RenderWindow::setVideoWindow( QWindow* window)
xcb_flush(QX11Info::connection());
m_videoClient = std::make_unique<CompositorX11RenderClient>(m_intf, m_conn, window);
m_videoPosition = QRect(0,0,0,0);
setTransparentForMouseEvent(QX11Info::connection(), window->winId());
m_videoWindow = window;
emit videoSurfaceChanged(m_videoClient.get());
}
......
......@@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <xcb/xfixes.h>
#include <vlc_cxx_helpers.hpp>
#include "compositor_x11_utils.hpp"
......@@ -105,4 +106,15 @@ xcb_atom_t getInternAtom(xcb_connection_t* conn, const char* atomName)
return atomReply->atom;
}
void setTransparentForMouseEvent(xcb_connection_t* conn, xcb_window_t window)
{
xcb_rectangle_t *rect = 0;
int nrect = 0;
xcb_xfixes_region_t region = xcb_generate_id(conn);
xcb_xfixes_create_region(conn, region, nrect, rect);
xcb_xfixes_set_window_shape_region(conn, window, XCB_SHAPE_SK_INPUT, 0, 0, region);
xcb_xfixes_destroy_region(conn, region);
}
}
......@@ -108,6 +108,8 @@ bool queryExtension(xcb_connection_t* conn, const char* name, uint8_t* first_eve
bool findVisualFormat(xcb_connection_t* conn, xcb_visualid_t visual, xcb_render_pictformat_t* fmtOut, uint8_t* depthOut);
xcb_atom_t getInternAtom(xcb_connection_t* conn, const char* atomName);
void setTransparentForMouseEvent(xcb_connection_t* conn, xcb_window_t window);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment