xwaylandmanager: fixup style

This commit is contained in:
Vaxry 2023-06-18 18:14:48 +02:00
parent 74ca81cc79
commit 2295bbdd80

View file

@ -36,10 +36,9 @@ void CHyprXWaylandManager::activateSurface(wlr_surface* pSurface, bool activate)
return;
if (wlr_xdg_surface_try_from_wlr_surface(pSurface)) {
const auto PSURF = wlr_xdg_surface_try_from_wlr_surface(pSurface);
if (PSURF && PSURF->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
if (const auto PSURF = wlr_xdg_surface_try_from_wlr_surface(pSurface); PSURF && PSURF->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL)
wlr_xdg_toplevel_set_activated(PSURF->toplevel, activate);
}
} else if (wlr_xwayland_surface_try_from_wlr_surface(pSurface)) {
wlr_xwayland_surface_activate(wlr_xwayland_surface_try_from_wlr_surface(pSurface), activate);
@ -84,9 +83,8 @@ void CHyprXWaylandManager::getGeometryForWindow(CWindow* pWindow, wlr_box* pbox)
pbox->width = pWindow->m_uSurface.xwayland->width;
pbox->height = pWindow->m_uSurface.xwayland->height;
}
} else {
} else
wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, pbox);
}
}
std::string CHyprXWaylandManager::getTitle(CWindow* pWindow) {
@ -123,20 +121,18 @@ std::string CHyprXWaylandManager::getAppIDClass(CWindow* pWindow) {
if (pWindow->m_uSurface.xdg->toplevel && pWindow->m_uSurface.xdg->toplevel->app_id) {
return std::string(pWindow->m_uSurface.xdg->toplevel->app_id);
}
} else {
} else
return "";
}
} catch (std::logic_error& e) { Debug::log(ERR, "Error in getAppIDClass: %s", e.what()); }
return "";
}
void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
if (pWindow->m_bIsX11) {
if (pWindow->m_bIsX11)
wlr_xwayland_surface_close(pWindow->m_uSurface.xwayland);
} else {
else
wlr_xdg_toplevel_send_close(pWindow->m_uSurface.xdg->toplevel);
}
}
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool force) {
@ -215,9 +211,8 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
return true;
}
if (pWindow->m_iX11Type == 2) {
if (pWindow->m_iX11Type == 2)
return true; // override_redirect
}
const auto SIZEHINTS = pWindow->m_uSurface.xwayland->size_hints;
if (SIZEHINTS && (pWindow->m_uSurface.xwayland->parent || ((SIZEHINTS->min_width == SIZEHINTS->max_width) && (SIZEHINTS->min_height == SIZEHINTS->max_height))))
@ -237,9 +232,10 @@ void CHyprXWaylandManager::moveXWaylandWindow(CWindow* pWindow, const Vector2D&
if (!g_pCompositor->windowValidMapped(pWindow))
return;
if (pWindow->m_bIsX11) {
if (!pWindow->m_bIsX11)
return;
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pos.x, pos.y, pWindow->m_vRealSize.vec().x, pWindow->m_vRealSize.vec().y);
}
}
void CHyprXWaylandManager::checkBorders(CWindow* pWindow) {
@ -266,11 +262,10 @@ void CHyprXWaylandManager::checkBorders(CWindow* pWindow) {
}
void CHyprXWaylandManager::setWindowFullscreen(CWindow* pWindow, bool fullscreen) {
if (pWindow->m_bIsX11) {
if (pWindow->m_bIsX11)
wlr_xwayland_surface_set_fullscreen(pWindow->m_uSurface.xwayland, fullscreen);
} else {
else
wlr_xdg_toplevel_set_fullscreen(pWindow->m_uSurface.xdg->toplevel, fullscreen);
}
if (pWindow->m_phForeignToplevel)
wlr_foreign_toplevel_handle_v1_set_fullscreen(pWindow->m_phForeignToplevel, fullscreen);