0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 04:42:18 +02:00

UI: Remove x11info dependency

This moves X11 platform to the qt private functions, as x11info was
removed from Qt6 so this is required for a clean Qt5/6 transition.

This is the implementation of x11info::getdisplay so it should still
work on older platforms. This "API" doesnt really guarantee anything
though.

Also clean up wayland only bits as we use them for all windowing systems
now, and the name of the native pointer we want is the same on both
platforms for now.
This commit is contained in:
Kurt Kartaltepe 2021-03-15 22:47:51 -07:00 committed by Jim
parent db7daa6eaf
commit 346e268a3d
2 changed files with 15 additions and 30 deletions

View File

@ -123,13 +123,17 @@ elseif(APPLE)
endif() endif()
elseif(UNIX) elseif(UNIX)
find_package(Qt5X11Extras REQUIRED) find_package(Qt5Gui REQUIRED)
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
set(obs_PLATFORM_SOURCES set(obs_PLATFORM_SOURCES
platform-x11.cpp) platform-x11.cpp)
set(obs_PLATFORM_LIBRARIES set(obs_PLATFORM_LIBRARIES
Qt5::X11Extras) ${obs_PLATFORM_LIBRARIES}
Qt5::Gui
Qt5::GuiPrivate)
if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD") if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
list(APPEND obs_PLATFORM_LIBRARIES list(APPEND obs_PLATFORM_LIBRARIES
@ -396,16 +400,6 @@ if(WIN32)
OUTPUT_NAME "obs${_output_suffix}") OUTPUT_NAME "obs${_output_suffix}")
endif() endif()
if (ENABLE_WAYLAND)
find_package(Qt5Gui REQUIRED)
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
set(obs_PLATFORM_LIBRARIES
${obs_PLATFORM_LIBRARIES}
Qt5::Gui
Qt5::GuiPrivate)
endif()
target_link_libraries(obs target_link_libraries(obs
libobs libobs
Qt5::Widgets Qt5::Widgets

View File

@ -61,14 +61,9 @@
#if !defined(_WIN32) && !defined(__APPLE__) #if !defined(_WIN32) && !defined(__APPLE__)
#include <obs-nix-platform.h> #include <obs-nix-platform.h>
#include <QX11Info>
#ifdef ENABLE_WAYLAND
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>
#endif #endif
#endif
#include <iostream> #include <iostream>
#include "ui-config.h" #include "ui-config.h"
@ -1398,27 +1393,23 @@ bool OBSApp::OBSInit()
#if !defined(_WIN32) && !defined(__APPLE__) #if !defined(_WIN32) && !defined(__APPLE__)
obs_set_nix_platform(OBS_NIX_PLATFORM_X11_GLX); obs_set_nix_platform(OBS_NIX_PLATFORM_X11_GLX);
if (QApplication::platformName() == "xcb") { if (QApplication::platformName() == "xcb" && getenv("OBS_USE_EGL")) {
if (getenv("OBS_USE_EGL")) { obs_set_nix_platform(OBS_NIX_PLATFORM_X11_EGL);
blog(LOG_INFO, "Using EGL/X11"); blog(LOG_INFO, "Using EGL/X11");
obs_set_nix_platform(OBS_NIX_PLATFORM_X11_EGL);
}
obs_set_nix_platform_display(QX11Info::display());
} }
#ifdef ENABLE_WAYLAND #ifdef ENABLE_WAYLAND
if (QApplication::platformName().contains("wayland")) { if (QApplication::platformName().contains("wayland")) {
obs_set_nix_platform(OBS_NIX_PLATFORM_WAYLAND); obs_set_nix_platform(OBS_NIX_PLATFORM_WAYLAND);
QPlatformNativeInterface *native =
QGuiApplication::platformNativeInterface();
obs_set_nix_platform_display(
native->nativeResourceForIntegration("display"));
setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
blog(LOG_INFO, "Platform: Wayland"); blog(LOG_INFO, "Platform: Wayland");
} }
#endif #endif
QPlatformNativeInterface *native =
QGuiApplication::platformNativeInterface();
obs_set_nix_platform_display(
native->nativeResourceForIntegration("display"));
#endif #endif
if (!StartupOBS(locale.c_str(), GetProfilerNameStore())) if (!StartupOBS(locale.c_str(), GetProfilerNameStore()))