[Xfce4-commits] [xfce/xfwm4] 11/32: Remove deprecated gdk_screen_make_display_name
noreply at xfce.org
noreply at xfce.org
Tue Dec 5 09:21:57 CET 2017
This is an automated email from the git hooks/post-receive script.
o l i v i e r p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfwm4.
commit db7e36617bca979517a6cc6bc3d45f9e85982e56
Author: Viktor Odintsev <zakhams at gmail.com>
Date: Sun Jul 2 18:32:42 2017 +0300
Remove deprecated gdk_screen_make_display_name
---
common/xfwm-common.c | 37 +++++++++++++++++++++++++++++++++++++
common/xfwm-common.h | 2 ++
src/screen.c | 2 +-
src/terminate.c | 18 +++++++++++++++---
4 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/common/xfwm-common.c b/common/xfwm-common.c
index a89fc93..fd69846 100644
--- a/common/xfwm-common.c
+++ b/common/xfwm-common.c
@@ -123,3 +123,40 @@ xfwm_get_n_monitors (GdkScreen *screen)
return gdk_screen_get_n_monitors (screen);
#endif
}
+
+
+
+static gchar *
+substitute_screen_number (const gchar *display_name,
+ gint screen_number)
+{
+ GString *str;
+ gchar *p;
+
+ str = g_string_new (display_name);
+
+ p = strrchr (str->str, '.');
+ if (p != NULL && p > strchr (str->str, ':'))
+ {
+ /* remove screen number from string */
+ g_string_truncate (str, p - str->str);
+ }
+
+ g_string_append_printf (str, ".%d", screen_number);
+
+ return g_string_free (str, FALSE);
+}
+
+
+
+gchar *
+xfwm_make_display_name (GdkScreen *screen)
+{
+ const gchar *name;
+ gint number;
+
+ name = gdk_display_get_name (gdk_screen_get_display (screen));
+ number = gdk_x11_screen_get_screen_number (screen);
+
+ return substitute_screen_number (name, number);
+}
diff --git a/common/xfwm-common.h b/common/xfwm-common.h
index 742767f..e2e8c97 100644
--- a/common/xfwm-common.h
+++ b/common/xfwm-common.h
@@ -38,4 +38,6 @@ void xfwm_get_primary_monitor_geometry (GdkScreen *screen,
gint xfwm_get_n_monitors (GdkScreen *screen);
+gchar *xfwm_make_display_name (GdkScreen *screen);
+
#endif /* !__COMMON_H__ */
diff --git a/src/screen.c b/src/screen.c
index 0d80916..609ca94 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -92,7 +92,7 @@ myScreenSetWMAtom (ScreenInfo *screen_info, gboolean replace_wm)
display_info = screen_info->display_info;
g_snprintf (selection, sizeof (selection), "WM_S%d", screen_info->screen);
wm_sn_atom = XInternAtom (display_info->dpy, selection, FALSE);
- display_name = gdk_screen_make_display_name (screen_info->gscr);
+ display_name = xfwm_make_display_name (screen_info->gscr);
wm_name = gdk_x11_screen_get_window_manager_name (screen_info->gscr);
XSync (display_info->dpy, FALSE);
diff --git a/src/terminate.c b/src/terminate.c
index 6e83d4b..c1d8ff4 100644
--- a/src/terminate.c
+++ b/src/terminate.c
@@ -29,6 +29,8 @@
#include <unistd.h>
#include <errno.h>
+#include <common/xfwm-common.h>
+
#include "client.h"
#include "terminate.h"
@@ -91,6 +93,14 @@ terminateProcessIO (GIOChannel *channel,
return FALSE;
}
+static void
+terminateShowDialogSetEnvironment (gpointer user_data)
+{
+ GdkScreen *screen = user_data;
+
+ g_setenv ("DISPLAY", xfwm_make_display_name (screen), TRUE);
+}
+
gboolean
terminateShowDialog (Client *c)
{
@@ -116,9 +126,11 @@ terminateShowDialog (Client *c)
argv[3] = NULL;
err = NULL;
- if (!gdk_spawn_on_screen_with_pipes (screen_info->gscr, NULL, argv, NULL,
- 0, NULL, NULL, &child_pid, NULL, &outpipe,
- NULL, &err))
+ if (!g_spawn_async_with_pipes (NULL, argv, NULL, 0,
+ terminateShowDialogSetEnvironment,
+ screen_info->gscr,
+ &child_pid, NULL, &outpipe,
+ NULL, &err))
{
g_warning (_("Cannot spawn helper-dialog: %s\n"), err->message);
g_error_free (err);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list