mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-22 13:35:57 +01:00
fix for a randr event spam bug
This commit is contained in:
parent
b3f4bf209d
commit
de8a4ca48c
4 changed files with 30 additions and 6 deletions
|
@ -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.
|
See the [Wiki](https://github.com/vaxerski/Hypr/wiki/Building) to see build instructions.
|
||||||
|
|
||||||
# Known issues
|
# 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
|
- Picom's shadow and effects do not update for cheap animations while animating
|
||||||
- Non-cheap animations are choppy (duh!)
|
- Non-cheap animations are choppy (duh!)rgith
|
||||||
- The config is still pretty simple, although riceable!
|
- Popups sometimes are created a bit off
|
||||||
- Popups sometimes are created pretty small
|
|
||||||
|
|
||||||
# Contributions
|
# 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.
|
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.
|
||||||
|
|
|
@ -821,6 +821,28 @@ void Events::eventClientMessage(xcb_generic_event_t* event) {
|
||||||
|
|
||||||
void Events::eventRandRScreenChange(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
|
// redetect screens
|
||||||
g_pWindowManager->monitors.clear();
|
g_pWindowManager->monitors.clear();
|
||||||
g_pWindowManager->setupRandrMonitors();
|
g_pWindowManager->setupRandrMonitors();
|
||||||
|
|
|
@ -34,4 +34,8 @@ namespace Events {
|
||||||
|
|
||||||
// Fix focus on open
|
// Fix focus on open
|
||||||
inline std::deque<uint32_t> ignoredEvents;
|
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;
|
||||||
};
|
};
|
|
@ -313,12 +313,12 @@ void CWindowManager::recieveEvent() {
|
||||||
|
|
||||||
default:
|
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));
|
Debug::log(WARN, "Unknown event: " + std::to_string(ev->response_type & ~0x80));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TYPE - RandREventBase == XCB_RANDR_SCREEN_CHANGE_NOTIFY) {
|
if ((int)TYPE - RandREventBase == XCB_RANDR_SCREEN_CHANGE_NOTIFY && RandREventBase > 0) {
|
||||||
Events::eventRandRScreenChange(ev);
|
Events::eventRandRScreenChange(ev);
|
||||||
Debug::log(LOG, "Event dispatched RANDR_SCREEN_CHANGE");
|
Debug::log(LOG, "Event dispatched RANDR_SCREEN_CHANGE");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue