Add GDK_DEBUG=no-portals

Fixes: #5441
This commit is contained in:
Matthias Clasen 2022-12-14 13:49:30 -05:00
parent a471a8b57c
commit e5560c1535
3 changed files with 19 additions and 3 deletions

View File

@ -118,7 +118,8 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "selection", GDK_DEBUG_SELECTION, "Information about selections" }, { "selection", GDK_DEBUG_SELECTION, "Information about selections" },
{ "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" }, { "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" },
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE }, { "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-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE },
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL", 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 }, { "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) if (gdk_display_get_debug_flags (NULL) & GDK_DEBUG_PORTALS)
return TRUE; return TRUE;
if (gdk_display_get_debug_flags (NULL) & GDK_DEBUG_NO_PORTALS)
return FALSE;
if (gdk_running_in_sandbox ()) if (gdk_running_in_sandbox ())
return TRUE; return TRUE;

View File

@ -40,7 +40,8 @@ typedef enum {
/* flags below are influencing behavior */ /* flags below are influencing behavior */
GDK_DEBUG_NOGRABS = 1 << 11, GDK_DEBUG_NOGRABS = 1 << 11,
GDK_DEBUG_PORTALS = 1 << 12, 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_LEGACY = 1 << 16,
GDK_DEBUG_GL_GLES = 1 << 17, GDK_DEBUG_GL_GLES = 1 << 17,
GDK_DEBUG_GL_DEBUG = 1 << 18, GDK_DEBUG_GL_DEBUG = 1 << 18,

View File

@ -25,6 +25,7 @@
#include "gtkfilechoosernativeprivate.h" #include "gtkfilechoosernativeprivate.h"
#include "gtkdialogerror.h" #include "gtkdialogerror.h"
#include <glib/gi18n-lib.h> #include <glib/gi18n-lib.h>
#include "gdk/gdkdebugprivate.h"
/** /**
* GtkFileDialog: * GtkFileDialog:
@ -657,6 +658,7 @@ create_file_chooser (GtkFileDialog *self,
GtkFileChooserNative *chooser; GtkFileChooserNative *chooser;
const char *accept; const char *accept;
const char *default_title, *title; const char *default_title, *title;
GdkDisplay *display;
switch (action) switch (action)
{ {
@ -685,7 +687,16 @@ create_file_chooser (GtkFileDialog *self,
title = default_title; title = default_title;
chooser = gtk_file_chooser_native_new (title, parent, action, accept, _("_Cancel")); 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_native_dialog_set_modal (GTK_NATIVE_DIALOG (chooser), self->modal);
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), select_multiple); gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), select_multiple);