Comment 3 for bug 774624

Revision history for this message
Brian May (brian-microcomaustralia) wrote :

Hmmm.... Looks like DISPLAY, by default, is set to :0 not :0.0 now.

ratpoison doesn't add the screen number if there isn't already one there.

I am guessing the exact code is screen.c, from line 277:

=== cut ===
  /* Build the display string for each screen */
  s->display_string = xmalloc (strlen(DisplayString (dpy)) + 21);
  sprintf (s->display_string, "DISPLAY=%s", DisplayString (dpy));
  if (strrchr (DisplayString (dpy), ':'))
    {
      char *dot;

      dot = strrchr(s->display_string, '.');
      if (dot)
        sprintf(dot, ".%i", screen_num);
    }

  PRINT_DEBUG (("%s\n", s->display_string));
=== cut ===

If the "if (dot)" condition fails, it needs to append the string at the end I think. So something like (not tested):

char * dot;
dot = strrchr(s->display_string, '.');
if (!dot) dot = s->display_string + strlen(s->display_string);
sprintf(dot, ".%i", screen_num);

I think the buffer should already be big enough for this - strlen(DisplayString (dpy)) + 21 bytes.