Skip to content

Conversation

@neveler
Copy link
Contributor

@neveler neveler commented Jan 9, 2026

close #5138

Copy link
Contributor

Copilot AI left a 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;
Copy link

Copilot AI Jan 10, 2026

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.

Suggested change
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();

Copilot uses AI. Check for mistakes.
@neveler neveler marked this pull request as draft January 10, 2026 13:21
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.

[Feature] 窗口最大化时应支持通过拖动标题栏来退出最大化状态

1 participant