Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not give menus keyboard focus (again) #2330

Merged
merged 7 commits into from Feb 21, 2022
Merged

Conversation

wmww
Copy link
Contributor

@wmww wmww commented Feb 17, 2022

Fixes #2324, and refactors AbstractShell::notify_focus_locked() in an attempt to make future changes easier to understand.

@wmww wmww mentioned this pull request Feb 17, 2022
Copy link
Contributor

@RAOF RAOF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming nit, but also it's not clear that we're notifying nested menus in the correct (child-first) order.

I think my suggestions might make the code a bit clearer, too?

std::vector<std::shared_ptr<ms::Surface>> result;
for (auto item = surface; item; item = item->parent())
{
result.insert(begin(result), item);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we're not going to have a lot of surfaces, but let's try not to be accidentally quadratic 😉

The order of the surfaces in this array isn't important to any of the other code that I can see?

return surface;
}

auto get_active_surfaces(std::shared_ptr<ms::Surface> surface) -> std::vector<std::shared_ptr<ms::Surface>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't getting the active surfaces; it's getting the chain of parent surfaces. We need that chain because we want a surface to be active if any of its children are active, but I think that's for the callsite, not the function name.

src/server/shell/abstract_shell.cpp Show resolved Hide resolved
src/server/shell/abstract_shell.cpp Show resolved Hide resolved
@AlanGriffiths
Copy link
Contributor

Empirically this does seem to fix the problem with kate menus.

I agree with @RAOF that some of the code isn't clearly doing the right thing. Will try reworking that and then do some further testing with other client stacks.

@AlanGriffiths
Copy link
Contributor

@wmww I've taken the liberty of pushing some updates. I think they cover @RAOF's concerns without breaking stuff. But please try to prove me wrong.

Copy link
Contributor

@AlanGriffiths AlanGriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WFM (now)

@wmww
Copy link
Contributor Author

wmww commented Feb 18, 2022

Looks good! I tweaked comments/names and added some tests. I also proposed a relevant test to WLCS here: canonical/wlcs#223.

I'm beginning to think this is not the right place for the popup-dismissing logic. Since the order is required by the Wayland protocol and the frontend has all the info it needs, perhaps the shell should just mark popups non-active and the frontend should dismiss them as needed. That way we don't have to worry about if the frontend processes close requests sequentially, and could hypothetically support protocols with different defined behavior. Out of scope for this PR, but might propose that in the future.

Copy link
Contributor

@AlanGriffiths AlanGriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Copy link
Collaborator

@Saviq Saviq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

bors merge

bors bot added a commit that referenced this pull request Feb 21, 2022
2330: Do not give menus keyboard focus (again) r=Saviq a=wmww

Fixes #2324, and refactors `AbstractShell::notify_focus_locked()` in an attempt to make future changes easier to understand.

Co-authored-by: William Wold <wm@wmww.sh>
Co-authored-by: Alan Griffiths <alan@octopull.co.uk>
@bors
Copy link
Contributor

bors bot commented Feb 21, 2022

@AlanGriffiths
Copy link
Contributor

bors retry

bors bot added a commit that referenced this pull request Feb 21, 2022
2330: Do not give menus keyboard focus (again) r=Saviq a=wmww

Fixes #2324, and refactors `AbstractShell::notify_focus_locked()` in an attempt to make future changes easier to understand.

Co-authored-by: William Wold <wm@wmww.sh>
Co-authored-by: Alan Griffiths <alan@octopull.co.uk>
@bors
Copy link
Contributor

bors bot commented Feb 21, 2022

@AlanGriffiths
Copy link
Contributor

AlanGriffiths commented Feb 21, 2022

Failed twice with "Cannot find cached LXD image for lxd:alpine-3.15" time for brute force...

@AlanGriffiths AlanGriffiths merged commit 7c287ea into main Feb 21, 2022
@bors bors bot deleted the popup-kb-focus-again branch February 21, 2022 11:10
AlanGriffiths pushed a commit that referenced this pull request Feb 21, 2022
Fixes #2324, and refactors AbstractShell::notify_focus_locked() in an attempt to make future changes easier to understand.

(cherry picked from commit 7c287ea)
RAOF added a commit that referenced this pull request Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opening Kate submenus causes menus to disappear
4 participants