Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

rootston: dmenu doesn't receive focus #636

Closed
Ongy opened this issue Feb 15, 2018 · 6 comments · Fixed by #670
Closed

rootston: dmenu doesn't receive focus #636

Ongy opened this issue Feb 15, 2018 · 6 comments · Fixed by #670

Comments

@Ongy
Copy link

Ongy commented Feb 15, 2018

When dmenu is started, it does not receive focus.

it does work when an Xwayland surface has focus, but can't steal focus from a wayland surface.
Just assigning focus to override-redirect windows doesn't work either, since dunst would steal focus with this as well, which interferes with users.

On current sway, starting dmenu from weston-terminal gives focus to dmenu, while dunst doesn't.

@emersion
Copy link
Member

Does switching focus with the rootston binding work?

@Ongy
Copy link
Author

Ongy commented Feb 15, 2018

Keyboard binds? I'm not sure.
Clicking it with the mouse doesn't help. And I think https://github.com/swaywm/wlroots/blob/master/rootston/seat.c#L722 is the reason.

Let me test, if that already gets us into problems with dunst

@Ongy
Copy link
Author

Ongy commented Feb 15, 2018

Removing that return allows me to give it focus on mouse click.
But it does not steal the focus when it comes up, so the usability is still rather low.

Other windows don't steal the focus either, so no issues with them.
https://git.suckless.org/dmenu/tree/dmenu.c#n177
This is how it grabs the focus on X. The best solution would get this event from Xwayland, and bubble it up in some "request_focus" event imo.

@Ongy
Copy link
Author

Ongy commented Feb 15, 2018

https://github.com/Cloudef/wlc/blob/master/src/xwayland/xwm.c#L308
wlc doesn't exacly use a view for them either... I can't read =.= This is unrelated in the end

@ddevault
Copy link
Contributor

This is how it grabs the focus on X. The best solution would get this event from Xwayland, and bubble it up in some "request_focus" event imo.

yes

@Ongy
Copy link
Author

Ongy commented Feb 24, 2018

I've been looking through the sway/wlc code a bit more.
This event never makes it up. The reason things work as they do is a little different.

The sway view create handler has an interesting bit of logic here: https://github.com/swaywm/sway/blob/master/sway/handlers.c#L425

Windows that are just WLC_BIT_OVERRIDE_REDIRCT will receive input focus.
dmenu falls into this category and gets the focus set on startup.

dunst windows on the other hand (which should not receive focus) come with a mix of:
WLC_BIT_MODAL | WLC_BIT_UNMANAGED | WLC_BIT_OVERRIDE_REDIRECT.
This leads to none of the cases to be executed in the current code, therefore it doesn't receive focus. (tbh. I'm not exactly sure why it's on top in the end).

The relevant bits are set by wlc in:
https://github.com/Cloudef/wlc/blob/314d09a1fd837228fa0f68fedaf03b91db06f21c/src/xwayland/xwm.c#L194

wlroots currently isn't concerned about the X atoms as much, so we have to do some work here.

The other reason, we can't focus the dunst windows at all is https://github.com/Cloudef/wlc/blob/704c56bf66f87f8788ab352a60d4ad0108b1920c/src/compositor/view.c#L533 btw.

The link I found earlier only gates the active state, not actual focus.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

3 participants