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

Fix menu dropdown focus logic in xwayland #6461

Closed
wants to merge 1 commit into from

Conversation

salkin-mada
Copy link
Contributor

Not sure what unforeseen results this will have. But it seems to close #6324.
I tested with code (vscode) running under xwayland and the menu's seemed to work fine there without setting seat focus to NULL before setting to previous.

seat_set_focus(seat, NULL);

At least removing that line makes the drop down menu's in Reaper usable again.

@kennylevinsen
Copy link
Member

7479993

@salkin-mada
Copy link
Contributor Author

salkin-mada commented Aug 25, 2021

So maybe I should get that code back into
void unmanaged_handle_unmap.
Instead of just removing the NULL set.
Will test. At least as far as I can tell the nice line seat_set_focus(seat, previous->parent); from 7479993 is no longer present in the master . It has been changed to seat_set_focus(seat, NULL);

@salkin-mada
Copy link
Contributor Author

Okay. Kinda skip my last comment :)~. @yrhki was right. Adding back 7ca9ef1 works in regards to the inherent / immediate bug report in #6324.
Will need to test some more. Floating window [FX windows] seems still to have the frozen drop down bug.

@salkin-mada salkin-mada changed the title set to NULL makes Reaper's drop down menu's act buggy adding back 7ca9ef1 to pass focus onto drop downs and submenus correctly Aug 25, 2021
@salkin-mada
Copy link
Contributor Author

It works smoothly here on my subproject compiled version.
Thanks to @yrhki . Apparently I don't understand how to add co-authors via command line, plain old git.

@yrhki
Copy link
Contributor

yrhki commented Aug 26, 2021

@salkin-mada can you add my email contact@yrhki.com.

@salkin-mada
Copy link
Contributor Author

Nice @yrhki. I tried to grap that via the github api. But no luck.
Will amend.

@salkin-mada salkin-mada force-pushed the drop_down_menu_focus branch 2 times, most recently from 630d918 to 8ef2b43 Compare August 26, 2021 08:19
@kennylevinsen
Copy link
Member

Taking a glance at the git history alone, it needs some cleaning. You have one commit doing your first fix attempt, and another undoing that and doing your second fix attempt. The message on the second one is also a little weird, including ">" characters it seems?

See https://chris.beams.io/posts/git-commit/ for examples. For where to put "Co-authored-by", look for the examples containing a "See also" - that's the "block" you'd use for that.

It would be good if the commit summary and description explained what is being added, and then in the description mention that this comes from that other commit. Most people do not remember all the sha's in the tree, so "re-add commit xyz" doesn't mean a lot to most.

@salkin-mada
Copy link
Contributor Author

thanks @kennylevinsen . Will do.

@Xyene
Copy link
Member

Xyene commented Aug 29, 2021

I have mixed feelings about this patch. I suspect we're missing something fundamental, because other compositors do not have such complex X11 refocusing logic, and presumably (has anyone tried Weston?) Reaper works there. The last focus issues we had with JetBrains IDEs ended up being due to us not implementing ICCCM focus hints; I wonder if that is at play here.

This "try to find another unmanaged surface from the same process to pass focus to" logic is a hack I initially wrote without understanding why it was necessary, so I'd be a little sad to see it get reintroduced. It may also be informative to trace through the code and understand why removing seat_set_focus(seat, NULL); is necessary in Sway, and why removing it fixes things in Reaper.

/cc @BrassyPanache

@salkin-mada
Copy link
Contributor Author

salkin-mada commented Aug 29, 2021

@Xyene Nice to see you joining in. We have been loosely throwing around the "lets find a universal fix" talk.
And Indeed. Making a more condense and real fix (understanding the inner workings of these focus issues/symptoms) seems way more intriguing than just adding back the "try to find another unmanaged surface from the same process to pass focus to" attitude.
One thing to note about the seat_set_focus(seat, NULL); and Reaper is that it fixes the immediate loosing focus of drop down menu bug in Reaper. But adding back 7ca9ef1 fixes the issue way deeper. One example is using the ESC key while having several drop downs open/unfolded. It will close them correctly in order all the way "down" to the main menu.
So just removing seat_set_focus(seat, NULL); does not really really do the same.

@BrassyPanache
Copy link
Contributor

I can share how I approached the issue swaywm/wlroots#2604 (related pulls of swaywm/wlroots#2605 and #5948). The issue sounds very similar in nature - IntelliJ drop down menus were behaving incorrectly.

The initial fix I put in place was for #3007 where I took a seemingly similar approach to what's taken here. To make the fix I inserted logging statements until I could work out the specific change required to get IntelliJ to work and then made the change. I then verified that other applications worked as expected and called it a day.

Of course this change broke with the next IntelliJ release. I was not at the time privy to the ICCCM specifications regarding input focus. I found the following table most insightful.

image

I would just check that everything is consistent to the above table from both the sway (and wlroots) side and the Reaper side. If other window managers (e.g. GNOME) work it is a good indication that the change needs to occur in sway or wlroots.

I am by no means an expert on these matters - just sharing my prior experience 😄

@madskjeldgaard
Copy link

Any progress on this? It is still a critical issue and it would be nice to have it fixed soon. Thanks!

Re-use of 7ca9ef1.

Co-authored-by: Tuomas Yrjölä <contact@yrhki.com>
Resolves: swaywm#6324
See also: swaywm#2103, swaywm#5398
@salkin-mada salkin-mada changed the title adding back 7ca9ef1 to pass focus onto drop downs and submenus correctly Fix menu dropdown focus logic in xwayland Oct 16, 2021
@elmarsto

This comment has been minimized.

@madskjeldgaard

This comment has been minimized.

@emersion
Copy link
Member

"Me too", "just merge it", "I won't use Sway unless this is fixed" type of comments don't help. If you want to help, read the discussion above and find a proper fix. A workaround like the one done currently in this PR won't get merged.

@elmarsto
Copy link

elmarsto commented Jan 14, 2022

Cool, cool. I wish you all the best. Thank you for sway! It will be sorely missed. So long for now.

@salkin-mada
Copy link
Contributor Author

Fixed in #6764 🎉

@martin-greentrax
Copy link

Hey everyone,
really appreciate your great work with swaywm, I found this issue after spending a long time trying to get popups in a java/xwayland app TWS of interactive brokers to not vanish and found it very similar. Could you kindly check out my bug report here: #7823

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

mouse and dropdown issues in Reaper after sway 1.6 [wlroots 13] in XWayland.
9 participants