remove old comment and fixup lsl var name

This commit is contained in:
Vaxry 2023-01-22 17:03:25 +01:00
parent 147be3e10b
commit cb98242ea7
9 changed files with 41 additions and 43 deletions

View file

@ -1197,7 +1197,7 @@ void CCompositor::cleanupFadingOut(const int& monid) {
// sometimes somehow fucking happens wtf // sometimes somehow fucking happens wtf
bool exists = false; bool exists = false;
for (auto& m : m_vMonitors) { for (auto& m : m_vMonitors) {
for (auto& lsl : m->m_aLayerSurfaceLists) { for (auto& lsl : m->m_aLayerSurfaceLayers) {
for (auto& lsp : lsl) { for (auto& lsp : lsl) {
if (lsp.get() == ls) { if (lsp.get() == ls) {
exists = true; exists = true;
@ -1233,7 +1233,7 @@ void CCompositor::cleanupFadingOut(const int& monid) {
g_pHyprOpenGL->m_mLayerFramebuffers.erase(ls); g_pHyprOpenGL->m_mLayerFramebuffers.erase(ls);
for (auto& m : m_vMonitors) { for (auto& m : m_vMonitors) {
for (auto& lsl : m->m_aLayerSurfaceLists) { for (auto& lsl : m->m_aLayerSurfaceLayers) {
if (!lsl.empty() && std::find_if(lsl.begin(), lsl.end(), [&](std::unique_ptr<SLayerSurface>& other) { return other.get() == ls; }) != lsl.end()) { if (!lsl.empty() && std::find_if(lsl.begin(), lsl.end(), [&](std::unique_ptr<SLayerSurface>& other) { return other.get() == ls; }) != lsl.end()) {
std::erase_if(lsl, [&](std::unique_ptr<SLayerSurface>& other) { return other.get() == ls; }); std::erase_if(lsl, [&](std::unique_ptr<SLayerSurface>& other) { return other.get() == ls; });
} }
@ -1890,7 +1890,7 @@ void CCompositor::setWindowFullscreen(CWindow* pWindow, bool on, eFullscreenMode
} }
} }
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
if (!ls->fadingOut) if (!ls->fadingOut)
ls->alpha = pWindow->m_bIsFullscreen && mode == FULLSCREEN_FULL ? 0.f : 1.f; ls->alpha = pWindow->m_bIsFullscreen && mode == FULLSCREEN_FULL ? 0.f : 1.f;
} }
@ -2022,7 +2022,7 @@ void CCompositor::warpCursorTo(const Vector2D& pos) {
SLayerSurface* CCompositor::getLayerSurfaceFromWlr(wlr_layer_surface_v1* pLS) { SLayerSurface* CCompositor::getLayerSurfaceFromWlr(wlr_layer_surface_v1* pLS) {
for (auto& m : m_vMonitors) { for (auto& m : m_vMonitors) {
for (auto& lsl : m->m_aLayerSurfaceLists) { for (auto& lsl : m->m_aLayerSurfaceLayers) {
for (auto& ls : lsl) { for (auto& ls : lsl) {
if (ls->layerSurface == pLS) if (ls->layerSurface == pLS)
return ls.get(); return ls.get();
@ -2041,7 +2041,7 @@ void CCompositor::closeWindow(CWindow* pWindow) {
SLayerSurface* CCompositor::getLayerSurfaceFromSurface(wlr_surface* pSurface) { SLayerSurface* CCompositor::getLayerSurfaceFromSurface(wlr_surface* pSurface) {
for (auto& m : m_vMonitors) { for (auto& m : m_vMonitors) {
for (auto& lsl : m->m_aLayerSurfaceLists) { for (auto& lsl : m->m_aLayerSurfaceLayers) {
for (auto& ls : lsl) { for (auto& ls : lsl) {
if (ls->layerSurface && ls->layerSurface->surface == pSurface) if (ls->layerSurface && ls->layerSurface->surface == pSurface)
return ls.get(); return ls.get();

View file

@ -239,7 +239,7 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
escapeJSONStrings(mon->szName).c_str()); escapeJSONStrings(mon->szName).c_str());
int layerLevel = 0; int layerLevel = 0;
for (auto& level : mon->m_aLayerSurfaceLists) { for (auto& level : mon->m_aLayerSurfaceLayers) {
result += getFormat( result += getFormat(
R"#( R"#(
"%i": [ "%i": [
@ -285,7 +285,7 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
result += getFormat("Monitor %s:\n", mon->szName.c_str()); result += getFormat("Monitor %s:\n", mon->szName.c_str());
int layerLevel = 0; int layerLevel = 0;
static const std::array<std::string, 4> levelNames = {"background", "bottom", "top", "overlay"}; static const std::array<std::string, 4> levelNames = {"background", "bottom", "top", "overlay"};
for (auto& level : mon->m_aLayerSurfaceLists) { for (auto& level : mon->m_aLayerSurfaceLayers) {
result += getFormat("\tLayer level %i (%s):\n", layerLevel, levelNames[layerLevel].c_str()); result += getFormat("\tLayer level %i (%s):\n", layerLevel, levelNames[layerLevel].c_str());
for (auto& layer : level) { for (auto& layer : level) {

View file

@ -38,7 +38,7 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
WLRLAYERSURFACE->output = PMONITOR->output; // TODO: current mon WLRLAYERSURFACE->output = PMONITOR->output; // TODO: current mon
} }
SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].emplace_back(std::make_unique<SLayerSurface>()).get(); SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLayers[WLRLAYERSURFACE->pending.layer].emplace_back(std::make_unique<SLayerSurface>()).get();
layerSurface->szNamespace = WLRLAYERSURFACE->_namespace; layerSurface->szNamespace = WLRLAYERSURFACE->_namespace;
@ -123,10 +123,10 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
if ((uint64_t)layersurface->monitorID != PMONITOR->ID) { if ((uint64_t)layersurface->monitorID != PMONITOR->ID) {
const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID); const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID);
for (auto it = POLDMON->m_aLayerSurfaceLists[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLists[layersurface->layer].end(); it++) { for (auto it = POLDMON->m_aLayerSurfaceLayers[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLayers[layersurface->layer].end(); it++) {
if (it->get() == layersurface) { if (it->get() == layersurface) {
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].emplace_back(std::move(*it)); PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].emplace_back(std::move(*it));
POLDMON->m_aLayerSurfaceLists[layersurface->layer].erase(it); POLDMON->m_aLayerSurfaceLayers[layersurface->layer].erase(it);
break; break;
} }
} }
@ -214,11 +214,11 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
g_pCompositor->m_pLastFocus = nullptr; g_pCompositor->m_pLastFocus = nullptr;
// find LS-es to focus // find LS-es to focus
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
&surfaceCoords, &pFoundLayerSurface); &surfaceCoords, &pFoundLayerSurface);
if (!foundSurface) if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
&surfaceCoords, &pFoundLayerSurface); &surfaceCoords, &pFoundLayerSurface);
if (!foundSurface) { if (!foundSurface) {
@ -266,10 +266,10 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
if ((uint64_t)layersurface->monitorID != PMONITOR->ID) { if ((uint64_t)layersurface->monitorID != PMONITOR->ID) {
const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID); const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID);
for (auto it = POLDMON->m_aLayerSurfaceLists[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLists[layersurface->layer].end(); it++) { for (auto it = POLDMON->m_aLayerSurfaceLayers[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLayers[layersurface->layer].end(); it++) {
if (it->get() == layersurface) { if (it->get() == layersurface) {
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].emplace_back(std::move(*it)); PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].emplace_back(std::move(*it));
POLDMON->m_aLayerSurfaceLists[layersurface->layer].erase(it); POLDMON->m_aLayerSurfaceLayers[layersurface->layer].erase(it);
break; break;
} }
} }
@ -282,10 +282,10 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
if (layersurface->layerSurface->current.committed != 0) { if (layersurface->layerSurface->current.committed != 0) {
if (layersurface->layer != layersurface->layerSurface->current.layer) { if (layersurface->layer != layersurface->layerSurface->current.layer) {
for (auto it = PMONITOR->m_aLayerSurfaceLists[layersurface->layer].begin(); it != PMONITOR->m_aLayerSurfaceLists[layersurface->layer].end(); it++) { for (auto it = PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].end(); it++) {
if (it->get() == layersurface) { if (it->get() == layersurface) {
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->current.layer].emplace_back(std::move(*it)); PMONITOR->m_aLayerSurfaceLayers[layersurface->layerSurface->current.layer].emplace_back(std::move(*it));
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].erase(it); PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].erase(it);
break; break;
} }
} }

View file

@ -193,10 +193,10 @@ void CMonitor::onDisconnect() {
hyprListener_monitorFrame.removeCallback(); hyprListener_monitorFrame.removeCallback();
for (size_t i = 0; i < 4; ++i) { for (size_t i = 0; i < 4; ++i) {
for (auto& ls : m_aLayerSurfaceLists[i]) { for (auto& ls : m_aLayerSurfaceLayers[i]) {
wlr_layer_surface_v1_destroy(ls->layerSurface); wlr_layer_surface_v1_destroy(ls->layerSurface);
} }
m_aLayerSurfaceLists[i].clear(); m_aLayerSurfaceLayers[i].clear();
} }
Debug::log(LOG, "Removed monitor %s!", szName.c_str()); Debug::log(LOG, "Removed monitor %s!", szName.c_str());

View file

@ -49,10 +49,7 @@ class CMonitor {
// for the special workspace. 0 means not open. // for the special workspace. 0 means not open.
int specialWorkspaceID = 0; int specialWorkspaceID = 0;
// Double-linked list because we need to have constant mem addresses for signals std::array<std::vector<std::unique_ptr<SLayerSurface>>, 4> m_aLayerSurfaceLayers;
// We have to store pointers and use raw new/delete because they might be moved between them
// and I am lazy
std::array<std::vector<std::unique_ptr<SLayerSurface>>, 4> m_aLayerSurfaceLists;
DYNLISTENER(monitorFrame); DYNLISTENER(monitorFrame);
DYNLISTENER(monitorDestroy); DYNLISTENER(monitorDestroy);

View file

@ -100,7 +100,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
// check LS-es // check LS-es
if (in && !m_bIsSpecialWorkspace) { if (in && !m_bIsSpecialWorkspace) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
if (!ls->fadingOut) if (!ls->fadingOut)
ls->alpha = m_bHasFullscreenWindow && m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 1.f; ls->alpha = m_bHasFullscreenWindow && m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 1.f;
} }

View file

@ -142,10 +142,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
// overlay is above fullscreen // overlay is above fullscreen
if (!foundSurface) if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface);
if (!foundSurface) if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface); foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface);
// then, we check if the workspace doesnt have a fullscreen window // then, we check if the workspace doesnt have a fullscreen window
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
@ -215,10 +215,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
// then surfaces below // then surfaces below
if (!foundSurface) if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, &pFoundLayerSurface); foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, &pFoundLayerSurface);
if (!foundSurface) if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface); foundSurface =
g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface);
g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_pLastMonitor); g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_pLastMonitor);

View file

@ -34,7 +34,7 @@ void CInputManager::beginWorkspaceSwipe() {
m_sActiveSwipe.speedPoints = 0; m_sActiveSwipe.speedPoints = 0;
if (PWORKSPACE->m_bHasFullscreenWindow) { if (PWORKSPACE->m_bHasFullscreenWindow) {
for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
ls->alpha = 1.f; ls->alpha = 1.f;
} }
} }
@ -165,7 +165,7 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
g_pInputManager->refocus(); g_pInputManager->refocus();
// apply alpha // apply alpha
for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 1.f; ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 1.f;
} }
} }

View file

@ -199,12 +199,12 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWor
} }
// and the overlay layers // and the overlay layers
for (auto& ls : pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
if (ls->alpha.fl() != 0.f) if (ls->alpha.fl() != 0.f)
renderLayer(ls.get(), pMonitor, time); renderLayer(ls.get(), pMonitor, time);
} }
for (auto& ls : pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) { for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
renderLayer(ls.get(), pMonitor, time); renderLayer(ls.get(), pMonitor, time);
} }
@ -387,10 +387,10 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
return; return;
// Render layer surfaces below windows for monitor // Render layer surfaces below windows for monitor
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) { for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
renderLayer(ls.get(), PMONITOR, time); renderLayer(ls.get(), PMONITOR, time);
} }
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) { for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
renderLayer(ls.get(), PMONITOR, time); renderLayer(ls.get(), PMONITOR, time);
} }
@ -522,7 +522,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
} }
// Render surfaces above windows for monitor // Render surfaces above windows for monitor
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
renderLayer(ls.get(), PMONITOR, time); renderLayer(ls.get(), PMONITOR, time);
} }
@ -531,7 +531,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
renderIMEPopup(&imep, PMONITOR, time); renderIMEPopup(&imep, PMONITOR, time);
} }
for (auto ls = PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].rbegin(); ls != PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].rend(); for (auto ls = PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].rbegin(); ls != PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].rend();
ls++) { ls++) {
renderLayer(ls->get(), PMONITOR, time); renderLayer(ls->get(), PMONITOR, time);
} }
@ -632,10 +632,10 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) {
PCANDIDATE->m_vRealSize.isBeingAnimated()) PCANDIDATE->m_vRealSize.isBeingAnimated())
return false; return false;
if (!pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].empty()) if (!pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].empty())
return false; return false;
for (auto& topls : pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { for (auto& topls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
if (topls->alpha.fl() != 0.f) if (topls->alpha.fl() != 0.f)
return false; return false;
} }
@ -958,10 +958,10 @@ void CHyprRenderer::arrangeLayersForMonitor(const int& monitor) {
wlr_box usableArea = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; wlr_box usableArea = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
for (auto& la : PMONITOR->m_aLayerSurfaceLists) for (auto& la : PMONITOR->m_aLayerSurfaceLayers)
arrangeLayerArray(PMONITOR, la, true, &usableArea); arrangeLayerArray(PMONITOR, la, true, &usableArea);
for (auto& la : PMONITOR->m_aLayerSurfaceLists) for (auto& la : PMONITOR->m_aLayerSurfaceLayers)
arrangeLayerArray(PMONITOR, la, false, &usableArea); arrangeLayerArray(PMONITOR, la, false, &usableArea);
PMONITOR->vecReservedTopLeft = Vector2D(usableArea.x, usableArea.y) - PMONITOR->vecPosition; PMONITOR->vecReservedTopLeft = Vector2D(usableArea.x, usableArea.y) - PMONITOR->vecPosition;