Skip to content

Fix click outside and scrim drawing for WINDOW layers#1189

Merged
MatkovIvan merged 1 commit intojb-mainfrom
ivan.matkov/fix-window-layer-2
Mar 13, 2024
Merged

Fix click outside and scrim drawing for WINDOW layers#1189
MatkovIvan merged 1 commit intojb-mainfrom
ivan.matkov/fix-window-layer-2

Conversation

@MatkovIvan
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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