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" },
{ "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;

View File

@ -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,

View File

@ -25,6 +25,7 @@
#include "gtkfilechoosernativeprivate.h"
#include "gtkdialogerror.h"
#include <glib/gi18n-lib.h>
#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);