🔨 Refactor main window position control logic#2929
Conversation
|
Claude finished @guiyanakuang's task —— View job PR Review: Refactor main window position control logicReview Checklist:
Understanding the Changes: This refactoring removes complex, platform-specific window positioning logic and consolidates window state management. The key changes are:
Code Quality & Best Practices ✅Positive aspects:
Consistency: The refactoring maintains consistency with Compose Desktop best practices. Potential Bugs & Issues
|
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the main window positioning by dropping per-OS manual placement and switching to Compose’s rememberWindowState with a centered default.
- Removed OS-specific
refreshWindowPositionimplementations in each tray view. - Updated
MainWindowto userememberWindowStatecentered instead of manager-driven state. - Deleted the
mainWindowStateflow and related APIs fromDesktopAppWindowManager.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app/src/desktopMain/kotlin/com/crosspaste/ui/WindowsTrayView.kt | Removed Windows-specific positioning logic and initial refresh call |
| app/src/desktopMain/kotlin/com/crosspaste/ui/MainWindow.kt | Introduced rememberWindowState with centered position |
| app/src/desktopMain/kotlin/com/crosspaste/ui/MacTrayView.kt | Dropped macOS-specific refreshWindowPosition code |
| app/src/desktopMain/kotlin/com/crosspaste/ui/LinuxTrayView.kt | Dropped Linux-specific refreshWindowPosition code |
| app/src/desktopMain/kotlin/com/crosspaste/app/DesktopAppWindowManager.kt | Deleted mainWindowState flow and setter/getter APIs |
Comments suppressed due to low confidence (2)
app/src/desktopMain/kotlin/com/crosspaste/ui/WindowsTrayView.kt:81
- Initial window positioning logic was removed; add tests to verify that the main window now appears centered on first launch under Windows.
}
app/src/desktopMain/kotlin/com/crosspaste/ui/MainWindow.kt:44
- [nitpick] MainWindow now uses
rememberWindowStatewith a centered default; consider adding a brief comment explaining why we moved away from per-OS placement logic.
val mainWindowState =
| appWindowManager: DesktopAppWindowManager, | ||
| event: MouseEvent?, | ||
| eventAction: (MouseEvent, GraphicsDevice, Insets) -> Unit, | ||
| ) { |
There was a problem hiding this comment.
[nitpick] Since this method now only forwards the event to mouseClickedAction, consider inlining or removing it to reduce indirection and simplify the click handler.
close #2928