alexandrehtrb/Pororoca

Popups are anchored to the display, not the window

hubertwyskwar opened this issue · 2 comments

Hi,
I noticed it after moving the app window to my other monitor and trying to delete a request. The popup is still in the center of the first display, not in the center of the app window.

Hello,

Would you be willing to make this modification and see if it works?
I don't have two monitors to debug the behavior.

The change in code would probably be:

src/Pororoca.Desktop/HotKeys/Dialogs.cs:

+using Pororoca.Desktop.Views;

internal static void ShowDialog(string title, string message, ButtonEnum buttons, Func<Task>? onButtonOkClicked = null)
{
    Bitmap bitmap = new(AssetLoader.Open(new("avares://Pororoca.Desktop/Assets/Images/pororoca.png")));

    var msgbox = MessageBoxManager.GetMessageBoxStandard(
        new MessageBoxStandardParams()
        {
            ContentTitle = title,
            ContentMessage = message,
-          WindowStartupLocation = WindowStartupLocation.CenterScreen,
+          WindowStartupLocation = WindowStartupLocation.CenterOwner,
            WindowIcon = new(bitmap),
            ButtonDefinitions = buttons
        });
    Dispatcher.UIThread.Post(async () =>
    {
-       var buttonResult = await msgbox.ShowAsync();
+       var buttonResult = await msgbox.ShowWindowDialogAsync(MainWindow.Instance!);
        if (buttonResult == ButtonResult.Ok)
        {
            var task = onButtonOkClicked?.Invoke();
            if (task is not null) await task;
        }
    });
}

Fixed on release 3.4.0, if it didn't work, let me know