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

X11: Add support for window closing and quitting. #900

Merged
merged 4 commits into from
May 6, 2020

Conversation

xStrom
Copy link
Member

@xStrom xStrom commented May 3, 2020

This PR adds support for closing individual windows. Previously closing any window would close all of them. This can be tested with the multiwin example.

Additionally I refactored some code and added more inline documentation.

@xStrom xStrom added S-needs-review waits for review shell/x11 concerns the X11 backend labels May 3, 2020
@xStrom xStrom changed the title Fix window closing in X11. X11: Add support for window closing and quitting. May 3, 2020
@xStrom
Copy link
Member Author

xStrom commented May 3, 2020

I also implemented Application::quit. Needed to create an events-only hidden window for this, because there doesn't seem to be a way to receive events when all windows have been destroyed. With macOS and Windows the implementation allows for the druid-shell user (e.g. druid) to choose the policy of whether to quit when all windows have closed or keep running.

I also added a Quit app button to multiwin to allow testing of this functionality on X11, because there is no menu support yet.

Copy link
Collaborator

@luleyleo luleyleo left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this! Makes the X11 shell pretty much even with GTK, except for menus of course.

druid-shell/src/platform/x11/window.rs Outdated Show resolved Hide resolved
druid-shell/src/platform/x11/window.rs Outdated Show resolved Hide resolved
druid-shell/src/platform/x11/window.rs Show resolved Hide resolved
druid-shell/src/platform/x11/window.rs Outdated Show resolved Hide resolved
druid-shell/src/platform/x11/window.rs Outdated Show resolved Hide resolved
druid-shell/src/platform/x11/window.rs Show resolved Hide resolved
@xStrom
Copy link
Member Author

xStrom commented May 5, 2020

I added more code comments to hopefully make things clearer. I also removed connection flushing from request_redraw and handled the cairo context creation error.

Copy link
Collaborator

@luleyleo luleyleo left a comment

Choose a reason for hiding this comment

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

Looks good! The doc-links are definitely useful.

@luleyleo luleyleo removed the S-needs-review waits for review label May 6, 2020
@xStrom xStrom merged commit da55d2e into linebender:master May 6, 2020
@xStrom xStrom deleted the x11-close branch May 6, 2020 10:32
@luleyleo luleyleo linked an issue May 15, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
shell/x11 concerns the X11 backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

X11: Program does not terminate when the window closes
2 participants