[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: link with xcb_xfixes
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Thu Jan 27 18:57:08 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
706bfd4e by Pierre Lamot at 2022-01-27T17:49:57+00:00
qt: link with xcb_xfixes
- - - - -
6e505fdf by Pierre Lamot at 2022-01-27T17:49:57+00:00
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)
- - - - -
6 changed files:
- configure.ac
- modules/gui/qt/Makefile.am
- modules/gui/qt/maininterface/compositor_x11.cpp
- modules/gui/qt/maininterface/compositor_x11_renderwindow.cpp
- modules/gui/qt/maininterface/compositor_x11_utils.cpp
- modules/gui/qt/maininterface/compositor_x11_utils.hpp
Changes:
=====================================
configure.ac
=====================================
@@ -3248,6 +3248,7 @@ have_xcb="no"
have_xkbcommon_x11="no"
have_xcb_keysyms="no"
have_xcb_damage="no"
+have_xcb_xfixes="no"
AS_IF([test "${enable_xcb}" != "no"], [
xcb_err=""
@@ -3294,12 +3295,21 @@ AS_IF([test "${enable_xcb}" != "no"], [
AC_MSG_WARN([${XCB_DAMAGE_PKG_ERRORS}. Qt X11 composition disabled.])
])
+ dnl xcb-fixes
+ PKG_CHECK_MODULES([XCB_XFIXES], [xcb-xfixes], [
+ have_xcb_xfixes="yes"
+ ], [
+ AC_MSG_WARN([${XCB_XFIXES_PKG_ERRORS}. Qt X11 composition disabled.])
+ ])
+
+
have_xcb="yes"
])
AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
AM_CONDITIONAL([HAVE_XKBCOMMON_X11], [test "${have_xkbcommon_x11}" = "yes"])
AM_CONDITIONAL([HAVE_XCB_KEYSYMS], [test "${have_xcb_keysyms}" = "yes"])
AM_CONDITIONAL([HAVE_XCB_DAMAGE], [test "${have_xcb_damage}" = "yes"])
+AM_CONDITIONAL([HAVE_XCB_XFIXES], [test "${have_xcb_xfixes}" = "yes"])
dnl
dnl VDPAU needs X11
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -41,9 +41,11 @@ if HAVE_XCB
libqt_plugin_la_CXXFLAGS += -DQT5_HAS_XCB $(XCB_CFLAGS)
libqt_plugin_la_LIBADD += $(XCB_LIBS)
if HAVE_XCB_DAMAGE
+if HAVE_XCB_XFIXES
libqt_plugin_la_CXXFLAGS += -DQT5_HAS_X11_COMPOSITOR \
- $(XCB_RENDER_CFLAGS) $(XCB_COMPOSITE_CFLAGS) $(XLCB_DAMAGE_CFLAGS)
-libqt_plugin_la_LIBADD += $(XCB_RENDER_LIBS) $(XCB_COMPOSITE_LIBS) $(XCB_DAMAGE_LIBS)
+ $(XCB_RENDER_CFLAGS) $(XCB_COMPOSITE_CFLAGS) $(XLCB_DAMAGE_CFLAGS) $(XCB_XFIXES_CFLAGS)
+libqt_plugin_la_LIBADD += $(XCB_RENDER_LIBS) $(XCB_COMPOSITE_LIBS) $(XCB_DAMAGE_LIBS) $(XCB_XFIXES_LIBS)
+endif
endif
endif
@@ -301,6 +303,7 @@ endif
if HAVE_XCB
if HAVE_XCB_DAMAGE
+if HAVE_XCB_XFIXES
libqt_plugin_la_SOURCES += \
gui/qt/maininterface/compositor_x11.cpp \
gui/qt/maininterface/compositor_x11.hpp \
@@ -314,6 +317,7 @@ libqt_plugin_la_SOURCES += \
gui/qt/maininterface/compositor_x11_utils.hpp
endif
endif
+endif
# Meta-object compilation
@@ -456,6 +460,7 @@ endif
if HAVE_XCB
if HAVE_XCB_DAMAGE
+if HAVE_XCB_XFIXES
nodist_libqt_plugin_la_SOURCES += \
gui/qt/maininterface/compositor_x11.moc.cpp \
gui/qt/maininterface/compositor_x11_renderclient.moc.cpp \
@@ -464,6 +469,7 @@ nodist_libqt_plugin_la_SOURCES += \
gui/qt/maininterface/compositor_x11_utils.moc.cpp
endif
endif
+endif
nodist_libqt_plugin_la_SOURCES += \
gui/qt/dialogs/extended/ui_equalizer.h \
=====================================
modules/gui/qt/maininterface/compositor_x11.cpp
=====================================
@@ -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();
=====================================
modules/gui/qt/maininterface/compositor_x11_renderwindow.cpp
=====================================
@@ -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());
}
=====================================
modules/gui/qt/maininterface/compositor_x11_utils.cpp
=====================================
@@ -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);
+}
+
}
=====================================
modules/gui/qt/maininterface/compositor_x11_utils.hpp
=====================================
@@ -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);
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/39e74833b4b06a831f22cfbffc273ebefcdba8c2...6e505fdf088799821c6883a5af0c78db38632d39
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/39e74833b4b06a831f22cfbffc273ebefcdba8c2...6e505fdf088799821c6883a5af0c78db38632d39
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list