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

Fix $DISPLAY being set to wrong value

Issue #79, MR !52

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 exo_execute_preferred_application_on_screen () gets $DISPLAY from the environment if necessary.
parent 4c8f67d2
Pipeline #15474 passed with stages
in 2 minutes and 40 seconds
......@@ -25,6 +25,11 @@
#include <gio/gdesktopappinfo.h>
#endif
#include <gdk/gdk.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include <exo/exo-execute.h>
#include <exo/exo-alias.h>
......@@ -90,7 +95,8 @@ exo_execute_preferred_application (const gchar *category,
static void
set_environment (gchar *display)
{
g_setenv ("DISPLAY", display, TRUE);
if (display != NULL)
g_setenv ("DISPLAY", display, TRUE);
}
static gchar *
......@@ -247,9 +253,9 @@ exo_execute_preferred_application_on_screen (const gchar *category,
GdkScreen *screen,
GError **error)
{
GdkDisplay *display;
GdkDisplay *display = NULL;
gchar *argv[5];
gchar *display_name;
gchar *display_name = NULL;
gchar *path = NULL;
gint argc = 0;
gboolean success;
......@@ -286,8 +292,11 @@ exo_execute_preferred_application_on_screen (const gchar *category,
argv[argc] = NULL;
/* set the display environment 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 */
/* launch the command */
success = g_spawn_async (working_directory,
......
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