aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/xwayland
diff options
context:
space:
mode:
authortrianta <[email protected]>2024-09-05 11:26:46 -0500
committerGitHub <[email protected]>2024-09-05 17:26:46 +0100
commitbd6d6e7f3378c08fe48c179ba4ec3517fe10ae3f (patch)
tree5f50dea8f863e5d5ae77cb3e088440dff8d84ff6 /src/xwayland
parent027140b7315efe3cd2e7b78fa608bd36da839894 (diff)
downloadHyprland-bd6d6e7f3378c08fe48c179ba4ec3517fe10ae3f.tar.gz
Hyprland-bd6d6e7f3378c08fe48c179ba4ec3517fe10ae3f.zip
xwayland: add option to enable/disable xwayland (#7633)
* config: add xwayland enabled option to config * xwayland: use DISPLAY env variable for enable/disable of new launches * xwayland: close X11 windows when turning of XWayland * clang: format fix * config: add better description for xwayland:enabled * xwayland: close X11 windows on disable without crashes * xwayland: better method of informing CXWayland if xwayland enabled * xwayland: prevent closing non-xwayland windows on disable * misc: loop formatting
Diffstat (limited to 'src/xwayland')
-rw-r--r--src/xwayland/Server.cpp3
-rw-r--r--src/xwayland/XWM.cpp4
-rw-r--r--src/xwayland/XWayland.cpp9
-rw-r--r--src/xwayland/XWayland.hpp4
4 files changed, 15 insertions, 5 deletions
diff --git a/src/xwayland/Server.cpp b/src/xwayland/Server.cpp
index 200bec70..f3bf5768 100644
--- a/src/xwayland/Server.cpp
+++ b/src/xwayland/Server.cpp
@@ -432,7 +432,8 @@ int CXWaylandServer::ready(int fd, uint32_t mask) {
pipeSource = nullptr;
// start the wm
- g_pXWayland->pWM = std::make_unique<CXWM>();
+ if (!g_pXWayland->pWM)
+ g_pXWayland->pWM = std::make_unique<CXWM>();
g_pCursorManager->setXWaylandCursor();
diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp
index cb4d8f4d..e8e2258a 100644
--- a/src/xwayland/XWM.cpp
+++ b/src/xwayland/XWM.cpp
@@ -890,6 +890,10 @@ CXWM::~CXWM() {
if (eventSource)
wl_event_source_remove(eventSource);
+
+ for (auto const& sr : surfaces) {
+ sr->events.destroy.emit();
+ }
}
void CXWM::setActiveWindow(xcb_window_t window) {
diff --git a/src/xwayland/XWayland.cpp b/src/xwayland/XWayland.cpp
index 8d45fa63..8cdb1fca 100644
--- a/src/xwayland/XWayland.cpp
+++ b/src/xwayland/XWayland.cpp
@@ -1,12 +1,17 @@
#include "XWayland.hpp"
#include "../debug/Log.hpp"
-CXWayland::CXWayland() {
+CXWayland::CXWayland(const bool enabled) {
#ifndef NO_XWAYLAND
Debug::log(LOG, "Starting up the XWayland server");
pServer = std::make_unique<CXWaylandServer>();
+ if (!enabled) {
+ unsetenv("DISPLAY");
+ return;
+ }
+
if (!pServer->create()) {
Debug::log(ERR, "XWayland failed to start: it will not work.");
return;
@@ -25,4 +30,4 @@ void CXWayland::setCursor(unsigned char* pixData, uint32_t stride, const Vector2
pWM->setCursor(pixData, stride, size, hotspot);
#endif
-} \ No newline at end of file
+}
diff --git a/src/xwayland/XWayland.hpp b/src/xwayland/XWayland.hpp
index 40c0ba65..96253d19 100644
--- a/src/xwayland/XWayland.hpp
+++ b/src/xwayland/XWayland.hpp
@@ -17,7 +17,7 @@ class CXWM;
class CXWayland {
public:
- CXWayland();
+ CXWayland(const bool enabled);
#ifndef NO_XWAYLAND
std::unique_ptr<CXWaylandServer> pServer;
@@ -126,4 +126,4 @@ inline std::unordered_map<std::string, uint32_t> HYPRATOMS = {
HYPRATOM("DELETE"),
HYPRATOM("TEXT"),
HYPRATOM("INCR"),
-}; \ No newline at end of file
+};