some delagification

This commit is contained in:
vaxerski 2021-12-17 23:27:27 +01:00
parent 0f581f6731
commit 962819b049
3 changed files with 12 additions and 16 deletions

View File

@ -4,18 +4,18 @@ gpointer handle(gpointer data) {
int lazyUpdateCounter = 0;
while (1) {
// update animations. They should be thread-safe.
AnimationUtil::move();
//
// wait for the main thread to be idle
while (g_pWindowManager->mainThreadBusy) {
;
std::this_thread::sleep_for(std::chrono::microseconds(1));
}
// set state to let the main thread know to wait.
g_pWindowManager->animationUtilBusy = true;
// update animations.
AnimationUtil::move();
//
// Don't spam these
if (lazyUpdateCounter > 10){
// Update the active window name

View File

@ -432,15 +432,15 @@ void CWindowManager::setFocusedWindow(xcb_drawable_t window) {
}
float values[1];
if (g_pWindowManager->getWindowFromDrawable(window)) {
if (g_pWindowManager->getWindowFromDrawable(window)->getIsFloating()) {
if (const auto PWINDOW = g_pWindowManager->getWindowFromDrawable(window); PWINDOW) {
if (PWINDOW->getIsFloating()) {
values[0] = XCB_STACK_MODE_ABOVE;
xcb_configure_window(g_pWindowManager->DisplayConnection, window, XCB_CONFIG_WINDOW_STACK_MODE, values);
}
// Apply rounded corners, does all the checks inside.
// The border changed so let's not make it rectangular maybe
applyShapeToWindow(g_pWindowManager->getWindowFromDrawable(window));
applyShapeToWindow(PWINDOW);
}
LastWindow = window;
@ -1478,17 +1478,13 @@ void CWindowManager::updateBarInfo() {
for (auto& c : winname) {
// Remove illegal chars
if (c == '=')
c = ' ';
else if (c == '\t')
if (c == '=' || c == '\t')
c = ' ';
}
for (auto& c : winclassname) {
// Remove illegal chars
if (c == '=')
c = ' ';
else if (c == '\t')
if (c == '=' || c == '\t')
c = ' ';
}

View File

@ -56,8 +56,8 @@ public:
std::vector<CTrayClient> trayclients;
std::atomic<bool> mainThreadBusy = false;
std::atomic<bool> animationUtilBusy = false;
bool mainThreadBusy = false;
bool animationUtilBusy = false;
xcb_cursor_t pointerCursor;
xcb_cursor_context_t* pointerContext;