This commit is contained in:
vaxerski 2021-12-24 20:20:50 +01:00
parent fa35537903
commit 0ee0f3ff78
3 changed files with 33 additions and 4 deletions

View file

@ -56,6 +56,11 @@ void Events::eventEnter(xcb_generic_event_t* event) {
RETURNIFBAR; RETURNIFBAR;
if (E->mode != XCB_NOTIFY_MODE_NORMAL)
return;
if (E->detail == XCB_NOTIFY_DETAIL_INFERIOR)
return;
const auto PENTERWINDOW = g_pWindowManager->getWindowFromDrawable(E->event); const auto PENTERWINDOW = g_pWindowManager->getWindowFromDrawable(E->event);
@ -551,6 +556,9 @@ CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) {
void Events::eventMapWindow(xcb_generic_event_t* event) { void Events::eventMapWindow(xcb_generic_event_t* event) {
const auto E = reinterpret_cast<xcb_map_request_event_t*>(event); const auto E = reinterpret_cast<xcb_map_request_event_t*>(event);
// Ignore sequence
ignoredEvents.push_back(E->sequence);
// let bar check if it wasnt a tray item // let bar check if it wasnt a tray item
if (g_pWindowManager->statusBar) if (g_pWindowManager->statusBar)
g_pWindowManager->statusBar->ensureTrayClientHidden(E->window, false); g_pWindowManager->statusBar->ensureTrayClientHidden(E->window, false);

View file

@ -31,4 +31,7 @@ namespace Events {
// For docks etc // For docks etc
inline bool nextWindowCentered = false; inline bool nextWindowCentered = false;
// Fix focus on open
inline std::deque<uint32_t> ignoredEvents;
}; };

View file

@ -243,6 +243,17 @@ void CWindowManager::recieveEvent() {
; // wait for it to finish ; // wait for it to finish
} }
for (auto& e : Events::ignoredEvents) {
if (e == ev->sequence) {
Debug::log(LOG, "Ignoring event type " + std::to_string(ev->response_type & ~0x80) + ".");
free(ev);
return;
}
}
if (Events::ignoredEvents.size() > 20)
Events::ignoredEvents.pop_front();
// Set thread state, halt animations until done. // Set thread state, halt animations until done.
mainThreadBusy = true; mainThreadBusy = true;
@ -434,8 +445,10 @@ void CWindowManager::refreshDirtyWindows() {
Values[0] = (int)window.getRealPosition().x - ConfigManager::getInt("border_size"); Values[0] = (int)window.getRealPosition().x - ConfigManager::getInt("border_size");
Values[1] = (int)window.getRealPosition().y - ConfigManager::getInt("border_size"); Values[1] = (int)window.getRealPosition().y - ConfigManager::getInt("border_size");
if (VECTORDELTANONZERO(window.getLastUpdatePosition(), Vector2D(Values[0], Values[1]))) { if (VECTORDELTANONZERO(window.getLastUpdatePosition(), Vector2D(Values[0], Values[1]))) {
xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, Values); const auto COOKIE = xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, Values);
window.setLastUpdatePosition(Vector2D(Values[0], Values[1])); window.setLastUpdatePosition(Vector2D(Values[0], Values[1]));
Events::ignoredEvents.push_back(COOKIE.sequence);
} }
Values[0] = (int)ConfigManager::getInt("border_size"); Values[0] = (int)ConfigManager::getInt("border_size");
@ -450,8 +463,10 @@ void CWindowManager::refreshDirtyWindows() {
Values[0] = (int)window.getRealSize().x; Values[0] = (int)window.getRealSize().x;
Values[1] = (int)window.getRealSize().y; Values[1] = (int)window.getRealSize().y;
if (VECTORDELTANONZERO(window.getLastUpdateSize(), Vector2D(Values[0], Values[1]))) { if (VECTORDELTANONZERO(window.getLastUpdateSize(), Vector2D(Values[0], Values[1]))) {
xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, Values); const auto COOKIE = xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, Values);
window.setLastUpdateSize(Vector2D(Values[0], Values[1])); window.setLastUpdateSize(Vector2D(Values[0], Values[1]));
Events::ignoredEvents.push_back(COOKIE.sequence);
} }
window.setFirstAnimFrame(true); window.setFirstAnimFrame(true);
} }
@ -463,8 +478,10 @@ void CWindowManager::refreshDirtyWindows() {
Values[0] = (int)window.getEffectiveSize().x; Values[0] = (int)window.getEffectiveSize().x;
Values[1] = (int)window.getEffectiveSize().y; Values[1] = (int)window.getEffectiveSize().y;
if (VECTORDELTANONZERO(window.getLastUpdateSize(), Vector2D(Values[0], Values[1]))) { if (VECTORDELTANONZERO(window.getLastUpdateSize(), Vector2D(Values[0], Values[1]))) {
xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, Values); const auto COOKIE = xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, Values);
window.setLastUpdateSize(Vector2D(Values[0], Values[1])); window.setLastUpdateSize(Vector2D(Values[0], Values[1]));
Events::ignoredEvents.push_back(COOKIE.sequence);
} }
} }
} }
@ -1661,7 +1678,8 @@ void CWindowManager::setAllFloatingWindowsTop() {
void CWindowManager::setAWindowTop(xcb_window_t window) { void CWindowManager::setAWindowTop(xcb_window_t window) {
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); const auto COOKIE = xcb_configure_window(g_pWindowManager->DisplayConnection, window, XCB_CONFIG_WINDOW_STACK_MODE, Values);
Events::ignoredEvents.push_back(COOKIE.sequence);
} }
bool CWindowManager::shouldBeFloatedOnInit(int64_t window) { bool CWindowManager::shouldBeFloatedOnInit(int64_t window) {