bar now shows the moused workspace

This commit is contained in:
vaxerski 2021-11-21 20:21:58 +01:00
parent d9fc533725
commit 7b3fc10ef2
2 changed files with 6 additions and 3 deletions

View file

@ -137,18 +137,21 @@ void CStatusBar::draw() {
const auto WORKSPACE = g_pWindowManager->getWorkspaceByID(i); const auto WORKSPACE = g_pWindowManager->getWorkspaceByID(i);
// The LastWindow may be on a different one. This is where the mouse is.
const auto MOUSEWORKSPACEID = g_pWindowManager->activeWorkspaces[g_pWindowManager->getMonitorFromCursor()->ID];
if (!WORKSPACE) if (!WORKSPACE)
continue; continue;
std::string workspaceName = std::to_string(i); std::string workspaceName = std::to_string(i);
if (WORKSPACE->getID() == g_pWindowManager->activeWorkspaces[m_iMonitorID]) { if (WORKSPACE->getID() == MOUSEWORKSPACEID) {
xcb_rectangle_t rectangleActive[] = { { m_vecSize.y * drawnWorkspaces, 0, m_vecSize.y, m_vecSize.y } }; xcb_rectangle_t rectangleActive[] = { { m_vecSize.y * drawnWorkspaces, 0, m_vecSize.y, m_vecSize.y } };
xcb_poly_fill_rectangle(g_pWindowManager->DisplayConnection, m_iPixmap, m_mContexts["MEDBG"].GContext, 1, rectangleActive); xcb_poly_fill_rectangle(g_pWindowManager->DisplayConnection, m_iPixmap, m_mContexts["MEDBG"].GContext, 1, rectangleActive);
} }
xcb_image_text_8(g_pWindowManager->DisplayConnection, workspaceName.length(), m_iPixmap, xcb_image_text_8(g_pWindowManager->DisplayConnection, workspaceName.length(), m_iPixmap,
WORKSPACE->getID() == g_pWindowManager->activeWorkspaces[m_iMonitorID] ? m_mContexts["HITEXT"].GContext : m_mContexts["BASETEXT"].GContext, WORKSPACE->getID() == MOUSEWORKSPACEID ? m_mContexts["HITEXT"].GContext : m_mContexts["BASETEXT"].GContext,
m_vecSize.y * drawnWorkspaces + m_vecSize.y / 2.f - 2, m_vecSize.y - (m_vecSize.y - 10) / 2, workspaceName.c_str()); m_vecSize.y * drawnWorkspaces + m_vecSize.y / 2.f - 2, m_vecSize.y - (m_vecSize.y - 10) / 2, workspaceName.c_str());
drawnWorkspaces++; drawnWorkspaces++;

View file

@ -57,6 +57,7 @@ public:
void setAllWorkspaceWindowsDirtyByID(int); void setAllWorkspaceWindowsDirtyByID(int);
int getHighestWorkspaceID(); int getHighestWorkspaceID();
CWorkspace* getWorkspaceByID(int); CWorkspace* getWorkspaceByID(int);
bool isWorkspaceVisible(int workspaceID);
void setAllWindowsDirty(); void setAllWindowsDirty();
@ -79,7 +80,6 @@ public:
void setEffectiveSizePosUsingConfig(CWindow* pWindow); void setEffectiveSizePosUsingConfig(CWindow* pWindow);
void cleanupUnusedWorkspaces(); void cleanupUnusedWorkspaces();
xcb_visualtype_t* setupColors(); xcb_visualtype_t* setupColors();
bool isWorkspaceVisible(int workspaceID);
}; };