Commit 3f73b819 authored by Yongha Hwang's avatar Yongha Hwang
Browse files

Fix $DISPLAY being set to wrong value

Issue #363, MR !72

Related: Issue exo#79

gdk_display_get_name () returns $WAYLAND_DISPLAY on Wayland environment.
This value was set to $DISPLAY, which breaks programs that don't support
Wayland. Now xfce4-mime-helper is patched to set $DISPLAY only with X11
environment.
parent 4195cc72
Pipeline #15511 passed with stages
in 2 minutes and 54 seconds
......@@ -47,6 +47,11 @@
#include <gio/gdesktopappinfo.h>
#endif
#include <gdk/gdk.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include "xfce-mime-helper.h"
#include "xfce-mime-helper-utils.h"
......@@ -340,7 +345,8 @@ xfce_mime_helper_get_command (const XfceMimeHelper *helper)
static void
set_environment (gchar *display)
{
g_setenv ("DISPLAY", display, TRUE);
if (display != NULL)
g_setenv ("DISPLAY", display, TRUE);
}
/**
......@@ -364,13 +370,13 @@ xfce_mime_helper_execute (XfceMimeHelper *helper,
{
gint64 previous;
gint64 current;
GdkDisplay *display;
GdkDisplay *display = NULL;
gboolean succeed = FALSE;
GError *err = NULL;
gchar **commands;
gchar **argv;
gchar *command;
gchar *display_name;
gchar *display_name = NULL;
guint n;
gint status;
gint result;
......@@ -423,8 +429,11 @@ xfce_mime_helper_execute (XfceMimeHelper *helper,
continue;
/* set the display variable */
#ifdef GDK_WINDOWING_X11
display = gdk_screen_get_display (screen);
display_name = g_strdup (gdk_display_get_name (display));
if (display != NULL && GDK_IS_X11_DISPLAY (display))
display_name = g_strdup (gdk_display_get_name (display));
#endif /* GDK_WINDOWING_X11 */
/* try to run the command */
succeed = g_spawn_async (NULL,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment