-
Notifications
You must be signed in to change notification settings - Fork 813
支持通过拖动标题栏退出最大化 #5172
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
base: main
Are you sure you want to change the base?
支持通过拖动标题栏退出最大化 #5172
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements support for exiting the maximized window state by dragging the title bar, addressing feature request #5138. When a maximized window's title bar is dragged, the window should un-maximize and follow the cursor.
Changes:
- Enabled mouse event handling when window is maximized
- Added logic to detect dragging on maximized windows and exit maximized state
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| if (primaryStage.isMaximized()) { | ||
| primaryStage.setMaximized(false); | ||
| mouseInitX = primaryStage.getWidth() / 2; |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When exiting maximized state during a drag operation, only mouseInitX is being updated but mouseInitY is not. This will cause incorrect vertical positioning when the user drags the window. Both coordinates should be updated to ensure the window follows the cursor properly. Additionally, stageInitX and stageInitY should be set to the new window position after un-maximizing to ensure proper drag calculations.
| mouseInitX = primaryStage.getWidth() / 2; | |
| // Reinitialize drag reference points after restoring from maximized state | |
| mouseInitX = mouseEvent.getScreenX(); | |
| mouseInitY = mouseEvent.getScreenY(); | |
| stageInitX = primaryStage.getX(); | |
| stageInitY = primaryStage.getY(); | |
| stageInitWidth = primaryStage.getWidth(); | |
| stageInitHeight = primaryStage.getHeight(); |
close #5138