[Xfce4-commits] <xfce4-session:master> Replace xfce_gdk_screen_get_fullname with custom code.

Nick Schermer noreply at xfce.org
Thu Jan 28 19:52:04 CET 2010


Updating branch refs/heads/master
         to 771544d326e7335922bc3cb9b5e2900085e6e0db (commit)
       from 45fd97a2ab1751f5d933595a864ea6278380d7a7 (commit)

commit 771544d326e7335922bc3cb9b5e2900085e6e0db
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Fri Jan 22 18:22:19 2010 +0100

    Replace xfce_gdk_screen_get_fullname with custom code.
    
    This function has not been implemented in libxfce4ui because xfce4-session
    is the only application to use. Copy and adapt the code from libxfcegui4.

 libxfsm/xfsm-util.c |   39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/libxfsm/xfsm-util.c b/libxfsm/xfsm-util.c
index d664d9e..1a76a79 100644
--- a/libxfsm/xfsm-util.c
+++ b/libxfsm/xfsm-util.c
@@ -75,7 +75,44 @@ xfsm_start_application (gchar      **command,
   if (screen != NULL)
     {
       if (client_machine != NULL)
-        screen_name = xfce_gdk_screen_get_fullname (screen);
+        {
+          const gchar *name;
+          const gchar *np;
+          GdkDisplay  *display;
+          gchar       *hostname;
+          gchar        buffer[256];
+          gchar       *bp;
+
+          display = gdk_screen_get_display (screen);
+
+          name = gdk_display_get_name (display);
+          if (*name == ':')
+            {
+              hostname = xfce_gethostname ();
+              g_strlcpy (buffer, hostname, 256);
+              g_free (hostname);
+
+              bp = buffer + strlen (buffer);
+
+              for (np = name; *np != '\0' && *np != '.' && bp < buffer + 255; )
+                *bp++ = *np++;
+              *bp = '\0';
+            }
+          else
+            {
+              g_strlcpy (buffer, name, 256);
+
+              for (bp = buffer + strlen (buffer) - 1; *bp != ':'; --bp)
+                if (*bp == '.')
+                  {
+                    *bp = '\0';
+                    break;
+                  }
+            }
+
+          screen_name = g_strdup_printf ("%s.%d", buffer,
+                                         gdk_screen_get_number (screen));
+        }
       else
         screen_name = gdk_screen_make_display_name (screen);
       argv[argc++] = g_strdup ("env");



More information about the Xfce4-commits mailing list