Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Pinta.Core/Extensions/Gtk/GtkExtensions.Dialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ namespace Pinta.Core;

partial class GtkExtensions
{
private static void DisableFullscreenDialogOnMac (Gtk.Window window)
{
if (SystemManager.GetOperatingSystem () != OS.Mac)
return;

if (window.TransientFor?.IsFullscreen () == true)
window.Unfullscreen ();
}

public static async Task<Gio.File?> OpenFileAsync (
this Gtk.FileDialog fileDialog,
Gtk.Window parent)
Expand Down Expand Up @@ -84,6 +93,9 @@ public static string RunBlocking (this Adw.MessageDialog dialog)
string response = "";
var loop = GLib.MainLoop.New (null, false);

if (dialog is Gtk.Window window)
DisableFullscreenDialogOnMac (window);

if (!dialog.Modal)
dialog.Modal = true;

Expand Down Expand Up @@ -134,6 +146,8 @@ public static Gtk.ResponseType RunBlocking (this Gtk.Dialog dialog)
Gtk.ResponseType response = Gtk.ResponseType.None;
GLib.MainLoop loop = GLib.MainLoop.New (null, false);

DisableFullscreenDialogOnMac (dialog);

if (!dialog.Modal)
dialog.Modal = true;

Expand Down Expand Up @@ -174,6 +188,9 @@ public static Task<string> RunAsync (this Adw.MessageDialog dialog)
{
TaskCompletionSource<string> completionSource = new ();

if (dialog is Gtk.Window window)
DisableFullscreenDialogOnMac (window);

void ResponseCallback (
Adw.MessageDialog sender,
Adw.MessageDialog.ResponseSignalArgs args)
Expand All @@ -192,6 +209,8 @@ void ResponseCallback (
{
TaskCompletionSource<Gtk.ResponseType> completionSource = new ();

DisableFullscreenDialogOnMac (dialog);

void ResponseCallback (
Gtk.Dialog sender,
Gtk.Dialog.ResponseSignalArgs args)
Expand All @@ -209,6 +228,7 @@ void ResponseCallback (
public static Task PresentAsync (this Gtk.Window window)
{
TaskCompletionSource completionSource = new ();
DisableFullscreenDialogOnMac (window);

bool CloseRequestCallback (
Gtk.Window sender,
Expand Down