Skip to content

Implement IPlatformLifetimeEvents for X11/Linux #6883

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

Merged
merged 13 commits into from
Nov 23, 2021

Conversation

jmacato
Copy link
Member

@jmacato jmacato commented Nov 8, 2021

What does the pull request do?

Allows users to interrupt the shutdown event in Linux via X Session Management Protocol.

Screen.Recording.2021-11-09.at.12.23.22.AM.mp4

What is the current behavior?

There was no way to inhibit shutdowns on Linux, unlike on win/macOS.

@jmacato jmacato force-pushed the linux-shutdown-prevention-xsmp branch from 4cd8a54 to 1ae2e36 Compare November 8, 2021 16:54
Copy link
Member

@danwalmsley danwalmsley left a comment

Choose a reason for hiding this comment

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

tested, and crashes because of invalid thread.

Copy link
Member

@danwalmsley danwalmsley left a comment

Choose a reason for hiding this comment

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

tested, works LGTM

private static readonly SMLib.IceWatchProc s_iceWatchProcDelegate = IceWatchHandler;

private bool AllowShutdownCancellation =>
Environment.GetEnvironmentVariable("AVALONIA_X11_USE_SESSION_MANAGER") != "0";
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be better to add a configuration in AppBuilder instead of an environment variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this is only intended to be like other X11 switches we already have. @kekekeks and @danwalmsley made this suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

@jmacato that switch should live in X11PlatformOptions with default value determined by environment variable.

Copy link
Member Author

Choose a reason for hiding this comment

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

gotcha

Copy link
Member

@danwalmsley danwalmsley left a comment

Choose a reason for hiding this comment

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

LGMT

@danwalmsley danwalmsley merged commit bd71f60 into master Nov 23, 2021
@danwalmsley danwalmsley deleted the linux-shutdown-prevention-xsmp branch November 23, 2021 13:49
danwalmsley added a commit that referenced this pull request Nov 23, 2021
Implement IPlatformLifetimeEvents for X11/Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants