fix for a randr event spam bug

This commit is contained in:
vaxerski 2021-12-25 22:56:02 +01:00
parent b3f4bf209d
commit de8a4ca48c
4 changed files with 30 additions and 6 deletions

View File

@ -45,11 +45,9 @@ You have to use a config, place it in ~/.config/hypr/hypr.conf
See the [Wiki](https://github.com/vaxerski/Hypr/wiki/Building) to see build instructions.
# Known issues
- RandR sometimes bugs at launch and starts spamming events, which will make the WM sluggish. Has never happened to me on a real machine though, only in a nested X11 session. (fix: restart X)
- Picom's shadow and effects do not update for cheap animations while animating
- Non-cheap animations are choppy (duh!)
- The config is still pretty simple, although riceable!
- Popups sometimes are created pretty small
- Non-cheap animations are choppy (duh!)rgith
- Popups sometimes are created a bit off
# Contributions
Refer to [CONTRIBUTING.md](https://github.com/vaxerski/Hypr/blob/main/CONTRIBUTING.md) and the [Wiki](https://github.com/vaxerski/Hypr/wiki/Contributing-&-Debugging) for contributing instructions and guidelines.

View File

@ -821,6 +821,28 @@ void Events::eventClientMessage(xcb_generic_event_t* event) {
void Events::eventRandRScreenChange(xcb_generic_event_t* event) {
// fix sus randr events, that sometimes happen
// it will spam these for no reason
// so we check if we have > 9 consecutive randr events less than 1s between each
// and if so, we stop listening for them
const auto DELTA = std::chrono::duration_cast<std::chrono::milliseconds>(lastRandREvent - std::chrono::high_resolution_clock::now());
if (susRandREventNo < 10) {
if (DELTA.count() <= 1000) {
susRandREventNo += 1;
Debug::log(WARN, "Suspicious RandR event no. " + std::to_string(susRandREventNo) + "!");
if (susRandREventNo > 9)
Debug::log(WARN, "Disabling RandR event listening because of excess suspicious RandR events (bug!)");
}
else
susRandREventNo = 0;
}
if (susRandREventNo > 9)
return;
// randr sus fixed
//
// redetect screens
g_pWindowManager->monitors.clear();
g_pWindowManager->setupRandrMonitors();

View File

@ -34,4 +34,8 @@ namespace Events {
// Fix focus on open
inline std::deque<uint32_t> ignoredEvents;
// Fix spammed RandR events
inline std::chrono::high_resolution_clock::time_point lastRandREvent = std::chrono::high_resolution_clock::now();
inline int susRandREventNo = 0;
};

View File

@ -313,12 +313,12 @@ void CWindowManager::recieveEvent() {
default:
if ((EVENTCODE != 14) && (EVENTCODE != 13) && (EVENTCODE != 0) && (EVENTCODE != 22))
if ((EVENTCODE != 14) && (EVENTCODE != 13) && (EVENTCODE != 0) && (EVENTCODE != 22) && (TYPE - RandREventBase != XCB_RANDR_SCREEN_CHANGE_NOTIFY))
Debug::log(WARN, "Unknown event: " + std::to_string(ev->response_type & ~0x80));
break;
}
if (TYPE - RandREventBase == XCB_RANDR_SCREEN_CHANGE_NOTIFY) {
if ((int)TYPE - RandREventBase == XCB_RANDR_SCREEN_CHANGE_NOTIFY && RandREventBase > 0) {
Events::eventRandRScreenChange(ev);
Debug::log(LOG, "Event dispatched RANDR_SCREEN_CHANGE");
}