From 16196bce07d6ee1beb1bb83db0d36e841b7b59da Mon Sep 17 00:00:00 2001 From: anthony Date: Wed, 20 Apr 2011 13:18:02 +0400 Subject: Fix display_string construction to handle new XDisplayString() behaviour XDisplayString does not append ".screen number" to return value after http://gitorious.org/omcfadde/libx11/commit/f92e754297ec5fdb81068b56a4435026666224fa Fix by appending .screen_num to the end of s->display_string in such case --- src/screen.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/screen.c b/src/screen.c index f26f036..ab8bf95 100644 --- a/src/screen.c +++ b/src/screen.c @@ -283,8 +283,13 @@ init_screen (rp_screen *s, int screen_num) char *dot; dot = strrchr(s->display_string, '.'); - if (dot && strlen (dot) < strlen (colon)) - sprintf(dot, ".%i", screen_num); + if (!dot || (strlen(dot) > strlen (colon)) ) + { + /* no dot was found or it belongs to fqdn - append screen_num + to the end */ + dot = s->display_string + strlen (s->display_string); + } + sprintf(dot, ".%i", screen_num); } PRINT_DEBUG (("display string: %s\n", s->display_string)); -- cgit v1.2.3