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

view: close popups on focus-change, SSD mouse-event and window switching #826

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johanmalm
Copy link
Collaborator

@johanmalm johanmalm commented Mar 11, 2023

Just submitting for early thoughts/discussion.

I'm sort of puzzled that nobody has reported this before. Try opening a menu and then dragging a window, alt-tab or similar.

  • close xwayland popups
  • close layer-shell popups
  • labwc’s root/client menus

...and the following:

- mouse-event on server-side-decoration
- window switching
src/xdg.c Show resolved Hide resolved
@jlindgren90
Copy link
Contributor

I've noticed popups not closing also (including labwc's own menus).

close xwayland popups

I've wondered how we would even do this. X11 popups usually close voluntarily when there is a mouse-event on another window, I believe (not 100% sure). So do we send some kind of a synthetic mouse event to the X server where we know there isn't a window?

@Consolatis
Copy link
Member

I guess we could also loop over the unmanged window tree.. but I guess there are other unmanged windows that are not popups as well. Maybe we could filter them for actual menu surfaces / tooltips?

@johanmalm
Copy link
Collaborator Author

I did try iterating over the unmanaged_surfaces wl_list to close them all using wlr_xwayland_surface_close()

They did close, but the top level window didn’t seem to register it (e.g. style for open menu still showing).

Could try unmap but it’s harder to achieve and I suspect the problem will remain.

I tried with sway, and they have the same problem. Not look at any others yet.

@01micko
Copy link
Contributor

01micko commented Aug 7, 2023

7a19184 should solve at least part of this.

@johanmalm
Copy link
Collaborator Author

7a19184 should solve at least part of this.

We've got a choice here. We either (a) close popup-menus on alt-tab/titlebar-drag/etc; or (b) don't allow operations whilst popup menus are open.

Mutter/openbox work like (b).

In openbox, the menu's close on titlebar click - so if you want to drag, you first have to click, then press+drag.

I think I prefer (b)

Suggest we fine a solution to xwayland unmanaged views outside of this PR because I'm pretty short on ideas for that.

@Consolatis
Copy link
Member

Consolatis commented Aug 9, 2023

In openbox, the menu's close on titlebar click - so if you want to drag, you first have to click, then press+drag.

That should be possible for wayland native popups by adding the appropriate view_enums to 7a19184. Or we could reverse that condition and check for ctx->type != LAB_SSD_CLIENT.

For X11 popups.. I don't know what to do either.

  • Simply destroying all unmanaged surfaces feels wrong (as there may be other ones than menus).
  • Destroying only popup ones seems to confuse X11 clients.
  • AFAIR we also discovered in the past that some X11 clients use actual undecorated toplevel surfaces for submenus, not sure right now. I think it was about (older versions?) of VLC and also tcl/tk based applications like gitk.
  • Fake injecting a mouse event somewhere as mentioned by @jlindgren90 could work I guess but feels pretty hacky.

johanmalm added a commit to johanmalm/labwc that referenced this pull request Aug 9, 2023
...for example on any part of the server side decoration

Supercedes labwc#826 for xdg-shell popups

Helped-by: @Consolatis
johanmalm added a commit that referenced this pull request Aug 10, 2023
...for example on any part of the server side decoration

Supercedes #826 for xdg-shell popups

Helped-by: @Consolatis
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.

None yet

4 participants