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

Disable close, move, resize, maximize and minimize functions for parent of modal window on Linux. #13398

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

EgorRudakov2
Copy link
Contributor

What does the pull request do?

On Linux, disables close, move, resize, maximize and minimize functions for parent window while it has a child modal window.

What is the current behavior?

Parent window (passed as an 'owner' parameter to the Window.ShowDialog method):

  • On Windows, user cannot close, move or resize window while modal child window is open.
  • On Linux, window can be closed, moved, or resized while the modal child window is open.

What is the updated/expected behavior with this PR?

Same as Windows: parent window cannot be closed, moved or resized while modal child window is open.

How was the solution implemented (if it's not obvious)?

If X11Window object is marked as disabled, it ignores WM_DELETE_WINDOW event (to prevent window manager closing the window), and also changes _MOTIF_WM_HINTS to mark the window as not resizable (and not maximizable/minimizable).
Unfortunately, changing _MOTIF_WM_HINTS also removes maximize/minimize buttons from window menu bar.

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Partially fixes #2958

@EgorRudakov2
Copy link
Contributor Author

@dotnet-policy-service agree

@EgorRudakov2 EgorRudakov2 force-pushed the fix_linux_modal_dialogs branch from 982315a to 7a12c44 Compare October 31, 2023 10:03
@grokys grokys added the customer-priority Issue reported by a customer with a support agreement. label Jan 10, 2024
@@ -565,7 +569,7 @@ ev.ButtonEvent.button switch
{
if (ev.ClientMessageEvent.ptr1 == _x11.Atoms.WM_DELETE_WINDOW)
{
if (Closing?.Invoke(WindowCloseReason.WindowClosing) != true)
if (IsEnabled && Closing?.Invoke(WindowCloseReason.WindowClosing) != true)
Copy link
Member

Choose a reason for hiding this comment

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

I can't really review linux specific PRs with confidence, but is it safe to disable window closing for Windows with IsEnabled=false? It will affect more than just dialog owners. Should be child window closed with the owner together?
cc @kekekeks @jmacato

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code only affects events from the OS window manager and prevents users from closing disabled windows (e.g. owner of the modal window). You can still close a disabled window via API (Window.Close).

@maxkatz6 maxkatz6 added this pull request to the merge queue Feb 22, 2024
Merged via the queue into AvaloniaUI:master with commit b0e76b2 Feb 22, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-priority Issue reported by a customer with a support agreement. os-linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Window.ShowDialog does not block parent window(Linux)
3 participants