application: Initialize service channel display

This is going to allow the upcoming FileChooser portal implementation
to attach its window as a modal dialog to client applications, even
if they use different display servers (X11 and Wayland).
This commit is contained in:
António Fernandes 2024-04-20 11:51:51 +01:00
parent b2ff00856e
commit 83d595afa3
2 changed files with 15 additions and 1 deletions

View file

@ -28,6 +28,7 @@
"--talk-name=org.gnome.DiskUtility",
"--talk-name=org.gnome.Settings",
"--talk-name=org.gnome.Console",
"--talk-name=org.gnome.Mutter.ServiceChannel",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
"--add-policy=Tracker3.dbus:org.freedesktop.Tracker3.Miner.Files=tracker:Audio",
"--add-policy=Tracker3.dbus:org.freedesktop.Tracker3.Miner.Files=tracker:Documents",

View file

@ -38,6 +38,7 @@
#include <nautilus-extension.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <xdp-gnome/externalwindow.h>
#include "nautilus-bookmark-list.h"
#include "nautilus-clipboard.h"
@ -1125,11 +1126,23 @@ nautilus_application_startup (GApplication *app)
g_application_set_resource_base_path (G_APPLICATION (self), "/org/gnome/nautilus");
/* chain up to the GTK+ implementation early, so gtk_init()
/* Initialize GDK display (for wayland-x11-interop protocol) before GTK does
* it during the chain-up. */
g_autoptr (GError) error = NULL;
GdkDisplay *display = init_external_window_display (&error);
if (error != NULL)
{
g_message ("Failed to initialize display server connection: %s",
error->message);
}
/* Chain up to the GtkApplication implementation early, so that gtk_init()
* is called for us.
*/
G_APPLICATION_CLASS (nautilus_application_parent_class)->startup (G_APPLICATION (self));
g_assert (gdk_display_get_default () == display);
gtk_window_set_default_icon_name (APPLICATION_ID);
/* initialize preferences and create the global GSettings objects */