mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 23:05:59 +01:00
handle unmanaged X11 setGeometry
This commit is contained in:
parent
75a580feda
commit
491b99c61e
6 changed files with 34 additions and 6 deletions
|
@ -28,6 +28,7 @@ public:
|
||||||
DYNLISTENER(unmapWindow);
|
DYNLISTENER(unmapWindow);
|
||||||
DYNLISTENER(destroyWindow);
|
DYNLISTENER(destroyWindow);
|
||||||
DYNLISTENER(setTitleWindow);
|
DYNLISTENER(setTitleWindow);
|
||||||
|
DYNLISTENER(setGeometryX11U);
|
||||||
DYNLISTENER(fullscreenWindow);
|
DYNLISTENER(fullscreenWindow);
|
||||||
DYNLISTENER(newPopupXDG);
|
DYNLISTENER(newPopupXDG);
|
||||||
// DYNLISTENER(newSubsurfaceWindow);
|
// DYNLISTENER(newSubsurfaceWindow);
|
||||||
|
|
|
@ -49,6 +49,7 @@ namespace Events {
|
||||||
DYNLISTENFUNC(fullscreenWindow);
|
DYNLISTENFUNC(fullscreenWindow);
|
||||||
DYNLISTENFUNC(activateX11);
|
DYNLISTENFUNC(activateX11);
|
||||||
DYNLISTENFUNC(configureX11);
|
DYNLISTENFUNC(configureX11);
|
||||||
|
DYNLISTENFUNC(unmanagedSetGeometry);
|
||||||
|
|
||||||
// Window subsurfaces
|
// Window subsurfaces
|
||||||
// LISTENER(newSubsurfaceWindow);
|
// LISTENER(newSubsurfaceWindow);
|
||||||
|
|
|
@ -92,6 +92,9 @@ void Events::listener_newPopupXDG(void* owner, void* data) {
|
||||||
|
|
||||||
ASSERT(PWINDOW);
|
ASSERT(PWINDOW);
|
||||||
|
|
||||||
|
if (!PWINDOW->m_bIsMapped)
|
||||||
|
return;
|
||||||
|
|
||||||
Debug::log(LOG, "New layer popup created from XDG window %x -> %s", PWINDOW, PWINDOW->m_szTitle.c_str());
|
Debug::log(LOG, "New layer popup created from XDG window %x -> %s", PWINDOW, PWINDOW->m_szTitle.c_str());
|
||||||
|
|
||||||
const auto WLRPOPUP = (wlr_xdg_popup*)data;
|
const auto WLRPOPUP = (wlr_xdg_popup*)data;
|
||||||
|
|
|
@ -250,6 +250,9 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW, "XWayland Window Late");
|
PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW, "XWayland Window Late");
|
||||||
PWINDOW->hyprListener_configureX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_configure, &Events::listener_configureX11, PWINDOW, "XWayland Window Late");
|
PWINDOW->hyprListener_configureX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_configure, &Events::listener_configureX11, PWINDOW, "XWayland Window Late");
|
||||||
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XWayland Window Late");
|
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XWayland Window Late");
|
||||||
|
|
||||||
|
if (PWINDOW->m_iX11Type == 2)
|
||||||
|
PWINDOW->hyprListener_setGeometryX11U.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_geometry, &Events::listener_unmanagedSetGeometry, PWINDOW, "XWayland Window Late");
|
||||||
}
|
}
|
||||||
|
|
||||||
// do the animation thing
|
// do the animation thing
|
||||||
|
@ -306,6 +309,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
PWINDOW->hyprListener_activateX11.removeCallback();
|
PWINDOW->hyprListener_activateX11.removeCallback();
|
||||||
PWINDOW->hyprListener_configureX11.removeCallback();
|
PWINDOW->hyprListener_configureX11.removeCallback();
|
||||||
PWINDOW->hyprListener_setTitleWindow.removeCallback();
|
PWINDOW->hyprListener_setTitleWindow.removeCallback();
|
||||||
|
PWINDOW->hyprListener_setGeometryX11U.removeCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PWINDOW->m_bIsFullscreen) {
|
if (PWINDOW->m_bIsFullscreen) {
|
||||||
|
@ -371,7 +375,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
void Events::listener_commitWindow(void* owner, void* data) {
|
void Events::listener_commitWindow(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
CWindow* PWINDOW = (CWindow*)owner;
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
if (!PWINDOW->m_bMappedX11 || PWINDOW->m_bHidden || (PWINDOW->m_bIsX11 && !PWINDOW->m_bMappedX11))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pHyprRenderer->damageSurface(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y);
|
g_pHyprRenderer->damageSurface(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y);
|
||||||
|
@ -490,6 +494,23 @@ void Events::listener_configureX11(void* owner, void* data) {
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
|
||||||
|
CWindow* PWINDOW = (CWindow*)owner;
|
||||||
|
|
||||||
|
if (!PWINDOW->m_bMappedX11 || PWINDOW->m_bHidden)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto POS = PWINDOW->m_vRealPosition.goalv();
|
||||||
|
|
||||||
|
if (floor(POS.x) != PWINDOW->m_uSurface.xwayland->x || floor(POS.x) != PWINDOW->m_uSurface.xwayland->y) {
|
||||||
|
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||||
|
PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y));
|
||||||
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.vec());
|
||||||
|
g_pCompositor->moveWindowToTop(PWINDOW);
|
||||||
|
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
|
void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
|
||||||
const auto XWSURFACE = (wlr_xwayland_surface*)data;
|
const auto XWSURFACE = (wlr_xwayland_surface*)data;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
||||||
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->isPointOnAnyMonitor(middlePoint) || (desiredGeometry.x == 0 && desiredGeometry.y == 0)) {
|
if ((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 {
|
||||||
|
@ -65,11 +65,13 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
||||||
pWindow->m_vRealSize.setValue(pWindow->m_vRealSize.goalv());
|
pWindow->m_vRealSize.setValue(pWindow->m_vRealSize.goalv());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pWindow->m_iX11Type != 2) {
|
||||||
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv());
|
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv());
|
||||||
g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace);
|
g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace);
|
||||||
|
|
||||||
g_pCompositor->moveWindowToTop(pWindow);
|
g_pCompositor->moveWindowToTop(pWindow);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void IHyprLayout::onBeginDragWindow() {
|
void IHyprLayout::onBeginDragWindow() {
|
||||||
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow;
|
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow;
|
||||||
|
|
|
@ -191,7 +191,7 @@ void CAnimationManager::tick() {
|
||||||
|
|
||||||
|
|
||||||
// set size and pos if valid, but only if damage policy entire (dont if border for example)
|
// set size and pos if valid, but only if damage policy entire (dont if border for example)
|
||||||
if (g_pCompositor->windowValidMapped(PWINDOW) && av->m_eDamagePolicy == AVARDAMAGE_ENTIRE)
|
if (g_pCompositor->windowValidMapped(PWINDOW) && av->m_eDamagePolicy == AVARDAMAGE_ENTIRE && PWINDOW->m_iX11Type != 2)
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
||||||
|
|
||||||
// manually schedule a frame
|
// manually schedule a frame
|
||||||
|
|
Loading…
Reference in a new issue