diff --git a/gdk/gdk.c b/gdk/gdk.c index 25e2d9af63..3d1457e075 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -118,7 +118,8 @@ static const GdkDebugKey gdk_debug_keys[] = { { "selection", GDK_DEBUG_SELECTION, "Information about selections" }, { "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" }, { "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE }, - { "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE }, + { "portals", GDK_DEBUG_PORTALS, "Force use of portals", TRUE }, + { "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals", TRUE }, { "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE }, { "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL", TRUE }, { "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context", TRUE }, @@ -359,6 +360,9 @@ gdk_should_use_portal (void) if (gdk_display_get_debug_flags (NULL) & GDK_DEBUG_PORTALS) return TRUE; + if (gdk_display_get_debug_flags (NULL) & GDK_DEBUG_NO_PORTALS) + return FALSE; + if (gdk_running_in_sandbox ()) return TRUE; diff --git a/gdk/gdkdebugprivate.h b/gdk/gdkdebugprivate.h index d778414d58..c9baba28a7 100644 --- a/gdk/gdkdebugprivate.h +++ b/gdk/gdkdebugprivate.h @@ -40,7 +40,8 @@ typedef enum { /* flags below are influencing behavior */ GDK_DEBUG_NOGRABS = 1 << 11, GDK_DEBUG_PORTALS = 1 << 12, - GDK_DEBUG_GL_DISABLE = 1 << 13, + GDK_DEBUG_NO_PORTALS = 1 << 13, + GDK_DEBUG_GL_DISABLE = 1 << 14, GDK_DEBUG_GL_LEGACY = 1 << 16, GDK_DEBUG_GL_GLES = 1 << 17, GDK_DEBUG_GL_DEBUG = 1 << 18, diff --git a/gtk/gtkfiledialog.c b/gtk/gtkfiledialog.c index d5cf620db5..0c7a218aa7 100644 --- a/gtk/gtkfiledialog.c +++ b/gtk/gtkfiledialog.c @@ -25,6 +25,7 @@ #include "gtkfilechoosernativeprivate.h" #include "gtkdialogerror.h" #include +#include "gdk/gdkdebugprivate.h" /** * GtkFileDialog: @@ -657,6 +658,7 @@ create_file_chooser (GtkFileDialog *self, GtkFileChooserNative *chooser; const char *accept; const char *default_title, *title; + GdkDisplay *display; switch (action) { @@ -685,7 +687,16 @@ create_file_chooser (GtkFileDialog *self, title = default_title; chooser = gtk_file_chooser_native_new (title, parent, action, accept, _("_Cancel")); - gtk_file_chooser_native_set_use_portal (chooser, TRUE); + + if (parent) + display = gtk_widget_get_display (GTK_WIDGET (parent)); + else + display = gdk_display_get_default (); + + if (GDK_DISPLAY_DEBUG_CHECK (display, NO_PORTALS)) + gtk_file_chooser_native_set_use_portal (chooser, FALSE); + else + gtk_file_chooser_native_set_use_portal (chooser, TRUE); gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (chooser), self->modal); gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), select_multiple);