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; int lazyUpdateCounter = 0;
while (1) { while (1) {
// update animations. They should be thread-safe.
AnimationUtil::move();
//
// wait for the main thread to be idle // wait for the main thread to be idle
while (g_pWindowManager->mainThreadBusy) { while (g_pWindowManager->mainThreadBusy) {
; std::this_thread::sleep_for(std::chrono::microseconds(1));
} }
// set state to let the main thread know to wait. // set state to let the main thread know to wait.
g_pWindowManager->animationUtilBusy = true; g_pWindowManager->animationUtilBusy = true;
// update animations.
AnimationUtil::move();
//
// Don't spam these // Don't spam these
if (lazyUpdateCounter > 10){ if (lazyUpdateCounter > 10){
// Update the active window name // Update the active window name

View file

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

View file

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