Skip to content

Commit

Permalink
internal: nuke CWindow::m_bMappedX11
Browse files Browse the repository at this point in the history
it's useless. m_bIsMapped is the same.
  • Loading branch information
vaxerski committed Dec 17, 2023
1 parent bf73740 commit 9fd928e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 20 deletions.
9 changes: 3 additions & 6 deletions src/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,9 +1065,6 @@ bool CCompositor::windowValidMapped(CWindow* pWindow) {
if (!windowExists(pWindow))
return false;

if (pWindow->m_bIsX11 && !pWindow->m_bMappedX11)
return false;

if (!pWindow->m_bIsMapped)
return false;

Expand Down Expand Up @@ -1131,7 +1128,7 @@ SIMEPopup* CCompositor::vectorToIMEPopup(const Vector2D& pos, std::list<SIMEPopu

CWindow* CCompositor::getWindowFromSurface(wlr_surface* pSurface) {
for (auto& w : m_vWindows) {
if (!w->m_bIsMapped || w->m_bFadingOut || !w->m_bMappedX11)
if (!w->m_bIsMapped || w->m_bFadingOut)
continue;

if (w->m_pWLSurface.wlr() == pSurface)
Expand Down Expand Up @@ -1374,7 +1371,7 @@ void CCompositor::changeWindowZOrder(CWindow* pWindow, bool top) {
toMove.emplace_front(pw);

for (auto& w : m_vWindows) {
if (w->m_bIsMapped && w->m_bMappedX11 && !w->isHidden() && w->m_bIsX11 && w->X11TransientFor() == pw) {
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsX11 && w->X11TransientFor() == pw) {
x11Stack(w.get(), top, x11Stack);
}
}
Expand Down Expand Up @@ -1729,7 +1726,7 @@ CWindow* CCompositor::getConstraintWindow(SMouse* pMouse) {
const auto PSURFACE = pMouse->currentConstraint->surface;

for (auto& w : m_vWindows) {
if (w->isHidden() || !w->m_bMappedX11 || !w->m_bIsMapped || !w->m_pWLSurface.exists())
if (w->isHidden() || !w->m_bIsMapped || !w->m_pWLSurface.exists())
continue;

if (w->m_bIsX11) {
Expand Down
4 changes: 2 additions & 2 deletions src/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pid_t CWindow::getPID() {

wl_client_get_credentials(wl_resource_get_client(m_uSurface.xdg->resource), &PID, nullptr, nullptr);
} else {
if (!m_bIsMapped || !m_bMappedX11)
if (!m_bIsMapped)
return -1;

PID = m_uSurface.xwayland->pid;
Expand Down Expand Up @@ -322,7 +322,7 @@ void sendLeaveIter(wlr_surface* pSurface, int x, int y, void* data) {
}

void CWindow::updateSurfaceOutputs() {
if (m_iLastSurfaceMonitorID == m_iMonitorID || !m_bIsMapped || m_bHidden || !m_bMappedX11)
if (m_iLastSurfaceMonitorID == m_iMonitorID || !m_bIsMapped || m_bHidden)
return;

const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(m_iLastSurfaceMonitorID);
Expand Down
1 change: 0 additions & 1 deletion src/Window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ class CWindow {

// XWayland stuff
bool m_bIsX11 = false;
bool m_bMappedX11 = false;
CWindow* m_pX11Parent = nullptr;
uint64_t m_iX11Type = 0;
bool m_bIsModal = false;
Expand Down
13 changes: 5 additions & 8 deletions src/events/Windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ void Events::listener_mapWindow(void* owner, void* data) {
const auto PWORKSPACE =
PMONITOR->specialWorkspaceID ? g_pCompositor->getWorkspaceByID(PMONITOR->specialWorkspaceID) : g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
PWINDOW->m_iMonitorID = PMONITOR->ID;
PWINDOW->m_bMappedX11 = true;
PWINDOW->m_iWorkspaceID = PMONITOR->specialWorkspaceID ? PMONITOR->specialWorkspaceID : PMONITOR->activeWorkspace;
PWINDOW->m_bIsMapped = true;
PWINDOW->m_bReadyToDelete = false;
Expand Down Expand Up @@ -712,8 +711,6 @@ void Events::listener_unmapWindow(void* owner, void* data) {
g_pInputManager->releaseAllMouseButtons();
}

PWINDOW->m_bMappedX11 = false;

// remove the fullscreen window status from workspace if we closed it
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);

Expand Down Expand Up @@ -794,7 +791,7 @@ void Events::listener_ackConfigure(void* owner, void* data) {
void Events::listener_commitWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;

if (!PWINDOW->m_bMappedX11 || PWINDOW->isHidden() || (PWINDOW->m_bIsX11 && !PWINDOW->m_bMappedX11))
if (!PWINDOW->m_bIsMapped || PWINDOW->isHidden())
return;

if (PWINDOW->m_bIsX11)
Expand Down Expand Up @@ -1027,7 +1024,7 @@ void Events::listener_configureX11(void* owner, void* data) {

const auto E = (wlr_xwayland_surface_configure_event*)data;

if (!PWINDOW->m_uSurface.xwayland->surface || !PWINDOW->m_uSurface.xwayland->surface->mapped || !PWINDOW->m_bMappedX11) {
if (!PWINDOW->m_uSurface.xwayland->surface || !PWINDOW->m_uSurface.xwayland->surface->mapped || !PWINDOW->m_bIsMapped) {
wlr_xwayland_surface_configure(PWINDOW->m_uSurface.xwayland, E->x, E->y, E->width, E->height);
PWINDOW->m_vPendingReportedSize = {E->width, E->height};
PWINDOW->m_vReportedSize = {E->width, E->height};
Expand Down Expand Up @@ -1090,7 +1087,7 @@ void Events::listener_configureX11(void* owner, void* data) {
void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;

if (!PWINDOW->m_bMappedX11)
if (!PWINDOW->m_bIsMapped)
return;

const auto POS = PWINDOW->m_vRealPosition.goalv();
Expand Down Expand Up @@ -1223,7 +1220,7 @@ void Events::listener_requestMaximize(void* owner, void* data) {

wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
} else {
if (!PWINDOW->m_bMappedX11 || PWINDOW->m_iX11Type != 1)
if (!PWINDOW->m_bIsMapped || PWINDOW->m_iX11Type != 1)
return;

g_pCompositor->setWindowFullscreen(PWINDOW, !PWINDOW->m_bIsFullscreen, FULLSCREEN_MAXIMIZED);
Expand All @@ -1236,7 +1233,7 @@ void Events::listener_requestMinimize(void* owner, void* data) {
Debug::log(LOG, "Minimize request for {}", PWINDOW);

if (PWINDOW->m_bIsX11) {
if (!PWINDOW->m_bMappedX11 || PWINDOW->m_iX11Type != 1)
if (!PWINDOW->m_bIsMapped || PWINDOW->m_iX11Type != 1)
return;

const auto E = (wlr_xwayland_minimize_event*)data;
Expand Down
2 changes: 1 addition & 1 deletion src/layout/DwindleLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ std::string CHyprDwindleLayout::getLayoutName() {

void CHyprDwindleLayout::onEnable() {
for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_bIsFloating || !w->m_bMappedX11 || !w->m_bIsMapped || w->isHidden())
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
continue;

onWindowCreatedTiling(w.get());
Expand Down
2 changes: 1 addition & 1 deletion src/layout/MasterLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ void CHyprMasterLayout::replaceWindowDataWith(CWindow* from, CWindow* to) {

void CHyprMasterLayout::onEnable() {
for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_bIsFloating || !w->m_bMappedX11 || !w->m_bIsMapped || w->isHidden())
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
continue;

onWindowCreatedTiling(w.get());
Expand Down
2 changes: 1 addition & 1 deletion src/managers/XWaylandManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ std::string CHyprXWaylandManager::getTitle(CWindow* pWindow) {
}

std::string CHyprXWaylandManager::getAppIDClass(CWindow* pWindow) {
if (!pWindow->m_bMappedX11 || !pWindow->m_bIsMapped)
if (!pWindow->m_bIsMapped)
return "";

try {
Expand Down

0 comments on commit 9fd928e

Please sign in to comment.