mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 00:25:57 +01:00
fixes for xwayland popups, autofloat pop-up and task_dialog
This commit is contained in:
parent
86bb95c125
commit
c35517d44e
4 changed files with 23 additions and 2 deletions
|
@ -761,3 +761,12 @@ CWorkspace* CCompositor::getWorkspaceByString(const std::string& str) {
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCompositor::isPointOnAnyMonitor(const Vector2D& point) {
|
||||||
|
for (auto& m : m_lMonitors) {
|
||||||
|
if (VECINRECT(point, m.vecPosition.x, m.vecPosition.y, m.vecSize.x + m.vecPosition.x, m.vecSize.y + m.vecPosition.y))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -111,6 +111,7 @@ public:
|
||||||
void deactivateAllWLRWorkspaces();
|
void deactivateAllWLRWorkspaces();
|
||||||
CWindow* getNextWindowOnWorkspace(CWindow*);
|
CWindow* getNextWindowOnWorkspace(CWindow*);
|
||||||
int getNextAvailableNamedWorkspace();
|
int getNextAvailableNamedWorkspace();
|
||||||
|
bool isPointOnAnyMonitor(const Vector2D&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAllSignals();
|
void initAllSignals();
|
||||||
|
|
|
@ -551,8 +551,8 @@ void CHyprDwindleLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
||||||
// check if it's on the correct monitor!
|
// check if it's on the correct monitor!
|
||||||
Vector2D middlePoint = Vector2D(desiredGeometry.x, desiredGeometry.y) + Vector2D(desiredGeometry.width, desiredGeometry.height) / 2.f;
|
Vector2D middlePoint = Vector2D(desiredGeometry.x, desiredGeometry.y) + Vector2D(desiredGeometry.width, desiredGeometry.height) / 2.f;
|
||||||
|
|
||||||
// TODO: detect a popup in a more consistent way.
|
// TODO: detect a popup in a more consistent way.
|
||||||
if ((g_pCompositor->getMonitorFromVector(middlePoint) && g_pCompositor->getMonitorFromVector(middlePoint)->ID != pWindow->m_iMonitorID) || (desiredGeometry.x == 0 && desiredGeometry.y == 0)) {
|
if (!g_pCompositor->isPointOnAnyMonitor(middlePoint) || (desiredGeometry.x == 0 && desiredGeometry.y == 0)) {
|
||||||
// if it's not, fall back to the center placement
|
// if it's not, fall back to the center placement
|
||||||
pWindow->m_vRealPosition = PMONITOR->vecPosition + Vector2D((PMONITOR->vecSize.x - desiredGeometry.width) / 2.f, (PMONITOR->vecSize.y - desiredGeometry.height) / 2.f);
|
pWindow->m_vRealPosition = PMONITOR->vecPosition + Vector2D((PMONITOR->vecSize.x - desiredGeometry.width) / 2.f, (PMONITOR->vecSize.y - desiredGeometry.height) / 2.f);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -145,6 +145,17 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pWindow->m_uSurface.xwayland->role) {
|
||||||
|
try {
|
||||||
|
std::string winrole = std::string(pWindow->m_uSurface.xwayland->role);
|
||||||
|
if (winrole.find("pop-up") != std::string::npos || winrole.find("task_dialog") != std::string::npos) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
Debug::log(ERR, "Error in shouldBeFloated, winrole threw %s", e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pWindow->m_uSurface.xwayland->modal) {
|
if (pWindow->m_uSurface.xwayland->modal) {
|
||||||
pWindow->m_bIsModal = true;
|
pWindow->m_bIsModal = true;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue