forked from quickshell/quickshell
hyprland/focus_grab: wait for surface creation if null
Fixes an occasional crash with QWaylandWindow::surface() returning null.
This commit is contained in:
parent
fe1d15e8f6
commit
f95e7dbaf6
3 changed files with 37 additions and 7 deletions
|
|
@ -74,13 +74,13 @@ void HyprlandFocusGrab::tryActivate() {
|
|||
QObject::connect(this->grab, &FocusGrab::activated, this, &HyprlandFocusGrab::onGrabActivated);
|
||||
QObject::connect(this->grab, &FocusGrab::cleared, this, &HyprlandFocusGrab::onGrabCleared);
|
||||
|
||||
this->grab->startTransaction();
|
||||
for (auto* proxy: this->trackedProxies) {
|
||||
if (proxy->backingWindow() != nullptr) {
|
||||
this->grab->addWindow(proxy->backingWindow());
|
||||
}
|
||||
}
|
||||
|
||||
this->grab->sync();
|
||||
this->grab->completeTransaction();
|
||||
}
|
||||
|
||||
void HyprlandFocusGrab::syncWindows() {
|
||||
|
|
@ -99,6 +99,8 @@ void HyprlandFocusGrab::syncWindows() {
|
|||
}
|
||||
}
|
||||
|
||||
if (this->grab) this->grab->startTransaction();
|
||||
|
||||
for (auto* oldWindow: this->trackedProxies) {
|
||||
if (!newProxy.contains(oldWindow)) {
|
||||
QObject::disconnect(oldWindow, nullptr, this, nullptr);
|
||||
|
|
@ -125,7 +127,7 @@ void HyprlandFocusGrab::syncWindows() {
|
|||
}
|
||||
|
||||
this->trackedProxies = newProxy;
|
||||
if (this->grab != nullptr) this->grab->sync();
|
||||
if (this->grab) this->grab->completeTransaction();
|
||||
}
|
||||
|
||||
} // namespace qs::hyprland
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue