mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 08:25:57 +01:00
Merge branch 'hyprwm:main' into main
This commit is contained in:
commit
55489d0c44
9 changed files with 60 additions and 7 deletions
|
@ -615,7 +615,7 @@ void CCompositor::initManagers(eManagersInitStage stage) {
|
||||||
g_pCursorManager = std::make_unique<CCursorManager>();
|
g_pCursorManager = std::make_unique<CCursorManager>();
|
||||||
|
|
||||||
Debug::log(LOG, "Starting XWayland");
|
Debug::log(LOG, "Starting XWayland");
|
||||||
g_pXWayland = std::make_unique<CXWayland>();
|
g_pXWayland = std::make_unique<CXWayland>(g_pCompositor->m_bEnableXwayland);
|
||||||
} break;
|
} break;
|
||||||
default: UNREACHABLE();
|
default: UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ class CCompositor {
|
||||||
CMonitor* m_pUnsafeOutput = nullptr; // fallback output for the unsafe state
|
CMonitor* m_pUnsafeOutput = nullptr; // fallback output for the unsafe state
|
||||||
bool m_bIsShuttingDown = false;
|
bool m_bIsShuttingDown = false;
|
||||||
bool m_bDesktopEnvSet = false;
|
bool m_bDesktopEnvSet = false;
|
||||||
|
bool m_bEnableXwayland = true;
|
||||||
|
|
||||||
// ------------------------------------------------- //
|
// ------------------------------------------------- //
|
||||||
|
|
||||||
|
|
|
@ -742,6 +742,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
.type = CONFIG_OPTION_BOOL,
|
.type = CONFIG_OPTION_BOOL,
|
||||||
.data = SConfigOptionDescription::SBoolData{true},
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
},
|
},
|
||||||
|
SConfigOptionDescription{
|
||||||
|
.value = "group:merge_groups_on_drag",
|
||||||
|
.description = "whether window groups can be dragged into other groups",
|
||||||
|
.type = CONFIG_OPTION_BOOL,
|
||||||
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
|
},
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "general:col.border_active",
|
.value = "general:col.border_active",
|
||||||
.description = "border color for inactive windows",
|
.description = "border color for inactive windows",
|
||||||
|
@ -1115,6 +1121,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
* xwayland:
|
* xwayland:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
SConfigOptionDescription{
|
||||||
|
.value = "xwayland:enabled",
|
||||||
|
.description = "allow running applications using X11",
|
||||||
|
.type = CONFIG_OPTION_BOOL,
|
||||||
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
|
},
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "xwayland:use_nearest_neighbor",
|
.value = "xwayland:use_nearest_neighbor",
|
||||||
.description = "uses the nearest neighbor filtering for xwayland apps, making them pixelated rather than blurry",
|
.description = "uses the nearest neighbor filtering for xwayland apps, making them pixelated rather than blurry",
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "config/ConfigValue.hpp"
|
#include "config/ConfigValue.hpp"
|
||||||
#include "helpers/varlist/VarList.hpp"
|
#include "helpers/varlist/VarList.hpp"
|
||||||
#include "../protocols/LayerShell.hpp"
|
#include "../protocols/LayerShell.hpp"
|
||||||
|
#include "../xwayland/XWayland.hpp"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
@ -361,6 +362,7 @@ CConfigManager::CConfigManager() {
|
||||||
|
|
||||||
m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("group:focus_removed_window", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:focus_removed_window", Hyprlang::INT{1});
|
||||||
|
m_pConfig->addConfigValue("group:merge_groups_on_drag", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("group:groupbar:enabled", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:groupbar:enabled", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("group:groupbar:font_family", {STRVAL_EMPTY});
|
m_pConfig->addConfigValue("group:groupbar:font_family", {STRVAL_EMPTY});
|
||||||
m_pConfig->addConfigValue("group:groupbar:font_size", Hyprlang::INT{8});
|
m_pConfig->addConfigValue("group:groupbar:font_size", Hyprlang::INT{8});
|
||||||
|
@ -523,6 +525,7 @@ CConfigManager::CConfigManager() {
|
||||||
m_pConfig->addConfigValue("gestures:workspace_swipe_touch", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("gestures:workspace_swipe_touch", Hyprlang::INT{0});
|
||||||
m_pConfig->addConfigValue("gestures:workspace_swipe_touch_invert", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("gestures:workspace_swipe_touch_invert", Hyprlang::INT{0});
|
||||||
|
|
||||||
|
m_pConfig->addConfigValue("xwayland:enabled", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("xwayland:use_nearest_neighbor", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("xwayland:use_nearest_neighbor", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("xwayland:force_zero_scaling", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("xwayland:force_zero_scaling", Hyprlang::INT{0});
|
||||||
|
|
||||||
|
@ -860,6 +863,29 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
|
||||||
ensureVRR();
|
ensureVRR();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_XWAYLAND
|
||||||
|
const auto PENABLEXWAYLAND = std::any_cast<Hyprlang::INT>(m_pConfig->getConfigValue("xwayland:enabled"));
|
||||||
|
// enable/disable xwayland usage
|
||||||
|
if (!isFirstLaunch) {
|
||||||
|
bool prevEnabledXwayland = g_pCompositor->m_bEnableXwayland;
|
||||||
|
if (PENABLEXWAYLAND != prevEnabledXwayland) {
|
||||||
|
g_pCompositor->m_bEnableXwayland = PENABLEXWAYLAND;
|
||||||
|
if (PENABLEXWAYLAND) {
|
||||||
|
Debug::log(LOG, "xwayland has been enabled");
|
||||||
|
} else {
|
||||||
|
Debug::log(LOG, "xwayland has been disabled, cleaning up...");
|
||||||
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
if (w->m_pXDGSurface || !w->m_bIsX11)
|
||||||
|
continue;
|
||||||
|
g_pCompositor->closeWindow(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_pXWayland = std::make_unique<CXWayland>(g_pCompositor->m_bEnableXwayland);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
g_pCompositor->m_bEnableXwayland = PENABLEXWAYLAND;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!isFirstLaunch && !g_pCompositor->m_bUnsafeState)
|
if (!isFirstLaunch && !g_pCompositor->m_bUnsafeState)
|
||||||
refreshGroupBarGradients();
|
refreshGroupBarGradients();
|
||||||
|
|
||||||
|
|
|
@ -951,12 +951,16 @@ int CWindow::getGroupSize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWindow::canBeGroupedInto(PHLWINDOW pWindow) {
|
bool CWindow::canBeGroupedInto(PHLWINDOW pWindow) {
|
||||||
|
static auto ALLOWGROUPMERGE = CConfigValue<Hyprlang::INT>("group:merge_groups_on_drag");
|
||||||
|
bool isGroup = m_sGroupData.pNextWindow;
|
||||||
|
bool disallowDragIntoGroup = g_pInputManager->m_bWasDraggingWindow && isGroup && !bool(*ALLOWGROUPMERGE);
|
||||||
return !g_pKeybindManager->m_bGroupsLocked // global group lock disengaged
|
return !g_pKeybindManager->m_bGroupsLocked // global group lock disengaged
|
||||||
&& ((m_eGroupRules & GROUP_INVADE && m_bFirstMap) // window ignore local group locks, or
|
&& ((m_eGroupRules & GROUP_INVADE && m_bFirstMap) // window ignore local group locks, or
|
||||||
|| (!pWindow->getGroupHead()->m_sGroupData.locked // target unlocked
|
|| (!pWindow->getGroupHead()->m_sGroupData.locked // target unlocked
|
||||||
&& !(m_sGroupData.pNextWindow.lock() && getGroupHead()->m_sGroupData.locked))) // source unlocked or isn't group
|
&& !(m_sGroupData.pNextWindow.lock() && getGroupHead()->m_sGroupData.locked))) // source unlocked or isn't group
|
||||||
&& !m_sGroupData.deny // source is not denied entry
|
&& !m_sGroupData.deny // source is not denied entry
|
||||||
&& !(m_eGroupRules & GROUP_BARRED && m_bFirstMap); // group rule doesn't prevent adding window
|
&& !(m_eGroupRules & GROUP_BARRED && m_bFirstMap) // group rule doesn't prevent adding window
|
||||||
|
&& !disallowDragIntoGroup; // config allows groups to be merged
|
||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CWindow::getGroupWindowByIndex(int index) {
|
PHLWINDOW CWindow::getGroupWindowByIndex(int index) {
|
||||||
|
|
|
@ -432,6 +432,7 @@ int CXWaylandServer::ready(int fd, uint32_t mask) {
|
||||||
pipeSource = nullptr;
|
pipeSource = nullptr;
|
||||||
|
|
||||||
// start the wm
|
// start the wm
|
||||||
|
if (!g_pXWayland->pWM)
|
||||||
g_pXWayland->pWM = std::make_unique<CXWM>();
|
g_pXWayland->pWM = std::make_unique<CXWM>();
|
||||||
|
|
||||||
g_pCursorManager->setXWaylandCursor();
|
g_pCursorManager->setXWaylandCursor();
|
||||||
|
|
|
@ -890,6 +890,10 @@ CXWM::~CXWM() {
|
||||||
|
|
||||||
if (eventSource)
|
if (eventSource)
|
||||||
wl_event_source_remove(eventSource);
|
wl_event_source_remove(eventSource);
|
||||||
|
|
||||||
|
for (auto const& sr : surfaces) {
|
||||||
|
sr->events.destroy.emit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWM::setActiveWindow(xcb_window_t window) {
|
void CXWM::setActiveWindow(xcb_window_t window) {
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
#include "XWayland.hpp"
|
#include "XWayland.hpp"
|
||||||
#include "../debug/Log.hpp"
|
#include "../debug/Log.hpp"
|
||||||
|
|
||||||
CXWayland::CXWayland() {
|
CXWayland::CXWayland(const bool enabled) {
|
||||||
#ifndef NO_XWAYLAND
|
#ifndef NO_XWAYLAND
|
||||||
Debug::log(LOG, "Starting up the XWayland server");
|
Debug::log(LOG, "Starting up the XWayland server");
|
||||||
|
|
||||||
pServer = std::make_unique<CXWaylandServer>();
|
pServer = std::make_unique<CXWaylandServer>();
|
||||||
|
|
||||||
|
if (!enabled) {
|
||||||
|
unsetenv("DISPLAY");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!pServer->create()) {
|
if (!pServer->create()) {
|
||||||
Debug::log(ERR, "XWayland failed to start: it will not work.");
|
Debug::log(ERR, "XWayland failed to start: it will not work.");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -17,7 +17,7 @@ class CXWM;
|
||||||
|
|
||||||
class CXWayland {
|
class CXWayland {
|
||||||
public:
|
public:
|
||||||
CXWayland();
|
CXWayland(const bool enabled);
|
||||||
|
|
||||||
#ifndef NO_XWAYLAND
|
#ifndef NO_XWAYLAND
|
||||||
std::unique_ptr<CXWaylandServer> pServer;
|
std::unique_ptr<CXWaylandServer> pServer;
|
||||||
|
|
Loading…
Reference in a new issue