Added a custom NO_XWAYLAND flag

This commit is contained in:
vaxerski 2022-04-20 15:58:02 +02:00
parent fde68dd8cf
commit bebfe01d73
5 changed files with 30 additions and 13 deletions

View file

@ -24,6 +24,11 @@ IF(LEGACY_RENDERER MATCHES true)
add_definitions( -DLEGACY_RENDERER ) add_definitions( -DLEGACY_RENDERER )
ENDIF(LEGACY_RENDERER MATCHES true) ENDIF(LEGACY_RENDERER MATCHES true)
IF(NO_XWAYLAND MATCHES true)
message(STATUS "Using the NO_XWAYLAND flag, disabling XWayland!")
add_definitions( -DNO_XWAYLAND )
ENDIF(NO_XWAYLAND MATCHES true)
IF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) IF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
message(STATUS "Configuring Hyprland in Debug with CMake!") message(STATUS "Configuring Hyprland in Debug with CMake!")
ELSE() ELSE()

View file

@ -98,6 +98,12 @@ extern "C" {
#include <GLES3/gl3ext.h> #include <GLES3/gl3ext.h>
#endif #endif
#ifdef NO_XWAYLAND
#define XWAYLAND false
#else
#define XWAYLAND true
#endif
#include "helpers/Vector2D.hpp" #include "helpers/Vector2D.hpp"
#include "../ext-workspace-unstable-v1-protocol.h" #include "../ext-workspace-unstable-v1-protocol.h"

View file

@ -89,7 +89,11 @@ bool CKeybindManager::handleInternalKeybinds(xkb_keysym_t keysym) {
// Dispatchers // Dispatchers
void CKeybindManager::spawn(std::string args) { void CKeybindManager::spawn(std::string args) {
if (g_pXWaylandManager->m_sWLRXWayland)
args = "WAYLAND_DISPLAY=" + std::string(g_pCompositor->m_szWLDisplaySocket) + " DISPLAY=" + std::string(g_pXWaylandManager->m_sWLRXWayland->display_name) + " " + args; args = "WAYLAND_DISPLAY=" + std::string(g_pCompositor->m_szWLDisplaySocket) + " DISPLAY=" + std::string(g_pXWaylandManager->m_sWLRXWayland->display_name) + " " + args;
else
args = "WAYLAND_DISPLAY=" + std::string(g_pCompositor->m_szWLDisplaySocket) + " " + args;
Debug::log(LOG, "Executing %s", args.c_str()); Debug::log(LOG, "Executing %s", args.c_str());
if (fork() == 0) { if (fork() == 0) {
execl("/bin/sh", "/bin/sh", "-c", args.c_str(), nullptr); execl("/bin/sh", "/bin/sh", "-c", args.c_str(), nullptr);

View file

@ -3,6 +3,7 @@
#include "../events/Events.hpp" #include "../events/Events.hpp"
CHyprXWaylandManager::CHyprXWaylandManager() { CHyprXWaylandManager::CHyprXWaylandManager() {
if (XWAYLAND) {
m_sWLRXWayland = wlr_xwayland_create(g_pCompositor->m_sWLDisplay, g_pCompositor->m_sWLRCompositor, 1); m_sWLRXWayland = wlr_xwayland_create(g_pCompositor->m_sWLDisplay, g_pCompositor->m_sWLRCompositor, 1);
if (!m_sWLRXWayland) { if (!m_sWLRXWayland) {
@ -16,6 +17,7 @@ CHyprXWaylandManager::CHyprXWaylandManager() {
setenv("DISPLAY", m_sWLRXWayland->display_name, 1); setenv("DISPLAY", m_sWLRXWayland->display_name, 1);
Debug::log(LOG, "CHyprXWaylandManager started on display %s", m_sWLRXWayland->display_name); Debug::log(LOG, "CHyprXWaylandManager started on display %s", m_sWLRXWayland->display_name);
}
} }
CHyprXWaylandManager::~CHyprXWaylandManager() { CHyprXWaylandManager::~CHyprXWaylandManager() {

View file

@ -8,7 +8,7 @@ public:
CHyprXWaylandManager(); CHyprXWaylandManager();
~CHyprXWaylandManager(); ~CHyprXWaylandManager();
wlr_xwayland* m_sWLRXWayland; wlr_xwayland* m_sWLRXWayland = nullptr;
wlr_surface* getWindowSurface(CWindow*); wlr_surface* getWindowSurface(CWindow*);
void activateSurface(wlr_surface*, bool); void activateSurface(wlr_surface*, bool);