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

Add scrollbar style and behavior reactive update for Mac OS #535

Merged
merged 8 commits into from
Aug 12, 2024

Conversation

hamen
Copy link
Collaborator

@hamen hamen commented Aug 9, 2024

Description

This PR adds MacScrollbarHelper. This file is heavily inspired by IntelliJ NSScrollerHelper. It has been converted to Kotlin, purged of what we don't need and migrated to Kotlin Coroutines.

MacScrollbarHelper API provides:

  • scrollbarVisibilityStyleFlow: StateFlow<ScrollbarVisibility>
  • trackClickBehaviorFlow: StateFlow<TrackClickBehavior>
  • trackClickBehavior: TrackClickBehavior
  • scrollbarVisibility: ScrollbarVisibility

The two flows have been plugged into the SwingBridgeService.currentBridgeThemeData: StateFlow<BridgeThemeData>. Every time the theme, the scrollbar visibility, or the track behavior change, we get an emission and whoever is listening gets an update.

The two properties replaced the original implementations we had in ScrollbarBridge.

Furthermore, this PR iterate once again on scrollbars colors on macOS.

Related Issues

#510 #445

Checklist

  • I have executed the Pre-push Gradle task
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

How Has This Been Tested?

  • New and existing unit tests pass locally with my changes
  • I have manually tested my changes on MacOS
    • With dark theme
    • With light theme
  • I have manually tested my changes on Windows
  • I have manually tested my changes on Linux

Screenshots or GIFs:

ScreenRecording2024-08-09at16 55 24-ezgif com-video-to-gif-converter (1)

@hamen hamen self-assigned this Aug 9, 2024
@hamen hamen added consistency Our UI presentation is not consistent with IJ bridge Something that impacts the Swing LaF bridge labels Aug 9, 2024
@hamen hamen marked this pull request as ready for review August 9, 2024 15:31
@hamen hamen requested review from rock3r and devkanro August 9, 2024 15:31
Copy link
Collaborator

@rock3r rock3r left a comment

Choose a reason for hiding this comment

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

Can you confirm this does not cause issues on Win/Linux? You specifically didn't check those boxes, and I'd like to be sure :)

@rock3r
Copy link
Collaborator

rock3r commented Aug 12, 2024

@hamen re:

Can you confirm this does not cause issues on Win/Linux? You specifically didn't check those boxes, and I'd like to be sure :)

Can you confirm it doesn't cause issues for Windows and Linux?

@rock3r rock3r enabled auto-merge (squash) August 12, 2024 10:43
Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>
@rock3r rock3r merged commit 9ca7488 into main Aug 12, 2024
3 checks passed
@rock3r rock3r deleted the im-510-scrollbar-autoupdate branch August 12, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bridge Something that impacts the Swing LaF bridge consistency Our UI presentation is not consistent with IJ
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On macOS, scrollbars style must update automatically when changes happen in System Preferences
2 participants