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 click outside and scrim drawing for WINDOW layers #1189

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

MatkovIvan
Copy link
Member

Proposed Changes

  • Detect mouse input on previous layers to trigger "outside" events instead of generating it on focus lost
  • Draw scrim (with right blend mode) on all previous layers instead of just main content

Testing

Test: Set compose.layers.type = WINDOW and try to use Popup/Dialog

window_layers.mp4

Issues Fixed

Fixes #1187 (comment)

@MatkovIvan MatkovIvan requested a review from igordmn March 12, 2024 23:01
@MatkovIvan MatkovIvan force-pushed the ivan.matkov/fix-window-layer-2 branch from df67f3c to e8854e9 Compare March 13, 2024 01:46
private inner class DetectEventOutsideLayer : AwtEventFilter {
override fun shouldSendMouseEvent(event: MouseEvent): Boolean {
layersAbove.toList().fastForEachReversed {
it.onMouseEventOutside(event)
Copy link
Collaborator

@igordmn igordmn Mar 13, 2024

Choose a reason for hiding this comment

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

Better to call it somewhere else, not inside shouldSendMouseEvent, that by its name shouldn't generate side effects.

Or rename AwtEventFilter to AwtEventHandler, shouldSendMouseEvent to handleMouseEvent

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, thought about it, but it caused more unrelated changes

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's do it separately, this PR is already big enough

@MatkovIvan MatkovIvan merged commit 07d5aa9 into jb-main Mar 13, 2024
6 checks passed
@MatkovIvan MatkovIvan deleted the ivan.matkov/fix-window-layer-2 branch March 13, 2024 10:51
MatkovIvan added a commit that referenced this pull request Mar 13, 2024
## Proposed Changes

- Apply suggested refactoring: replace `AwtEventFilter` to
`AwtEventListener`

## Testing

Test: N/A

## Issues Fixed

Fixes
#1189 (comment)
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.

2 participants