fix rare crash in the bar

This commit is contained in:
vaxerski 2021-11-23 16:51:56 +01:00
parent 1fd1e09dbc
commit 029c66b2bc
2 changed files with 3 additions and 3 deletions

View File

@ -134,7 +134,7 @@ void CStatusBar::draw() {
const auto WORKSPACE = g_pWindowManager->getWorkspaceByID(g_pWindowManager->activeWorkspaces[m_iMonitorID]);
if (WORKSPACE->getHasFullscreenWindow()) // TODO: fix this
if (!WORKSPACE || WORKSPACE->getHasFullscreenWindow()) // TODO: fix this
return; // Do not draw a bar on a fullscreen window.
xcb_rectangle_t rectangles[] = {{(int)0, (int)0, (int)m_vecSize.x, (int)m_vecSize.y}};

View File

@ -130,11 +130,11 @@ void CWindowManager::setupRandrMonitors() {
void CWindowManager::setupManager() {
setupRandrMonitors();
if (monitors.size() == 0) {
if (1 || monitors.size() == 0) {
// RandR failed!
Debug::log(WARN, "RandR failed!");
#define TESTING_MON_AMOUNT 1
#define TESTING_MON_AMOUNT 3
for (int i = 0; i < TESTING_MON_AMOUNT /* Testing on 3 monitors, RandR shouldnt fail on a real desktop */; ++i) {
monitors.push_back(SMonitor());
monitors[i].vecPosition = Vector2D(i * Screen->width_in_pixels / TESTING_MON_AMOUNT, 0);