[Rd] X11 window title setting in X11() Device (PR#11325)

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Tue Apr 29 10:00:15 CEST 2008


Can you please give precise reproduction instructions -- you don't even 
tell us what the window manager is.

I'd be willing to consider a workaround, but only if I can reproduce the 
problem (which appears to be a false assumption elsewhere in your setup).

On Mon, 28 Apr 2008, julien.barnier at ens-lsh.fr wrote:

> --=-=-=
> Content-Type: text/plain; charset=utf-8
> Content-Transfer-Encoding: quoted-printable
>
> Hi,
>
> I think I have found a very little bug in the new version of the X11()
> device in R 2.7.0, more precisely in the devX11.c file.
>
> The problem is that when you open a new window with X11(), the title
> of the window (the WM_NAME property) is not immediately set. It seems
> that the window is created, then it is displayed (mapped) with no
> title, and then the title is set.

Which is perfectly valid in X11, so I don't see where the 'bug' is.

R changes the title to reflect the window state, do the supplied 'title' 
is never actually used without decoration.  R 2.6.x put up one title and 
then immediately changed it, but that was undocumented and not safe to 
rely on (as you found).


> It is something absolutely invisible for the user, but it leads to
> problem for me because I use a window manager that relies on window
> titles to give them different attributes (I use it to make all my R
> Graphics windows floating). And due to the fact that the title is set
> after opening, my window manager rules don't apply anymore.
>
> I found a quick and dirty workaround which set the title immediately
> after the window opening if the =C2=ABtitle=C2=BB option in X11.options() is
> set. You will find the patch for devX11.c attached to this mail, it is
> just two lines moved before the call to X11_Open.
>
> Surely there could be something much better, but I am quite new to C
> and X11 programming...
>
> Here is my sessionInfo() :
>
> ,----
> | R version 2.7.0 (2008-04-22)=20
> | i486-pc-linux-gnu=20
> |=20
> | locale:
> | LC_CTYPE=3Dfr_FR.UTF-8;LC_NUMERIC=3DC;LC_TIME=3Dfr_FR.UTF-8;LC_COLLATE=3D=
> fr_FR.UTF-8;LC_MONETARY=3DC;LC_MESSAGES=3Dfr_FR.UTF-8;LC_PAPER=3Dfr_FR.UTF-=
> 8;LC_NAME=3DC;LC_ADDRESS=3DC;LC_TELEPHONE=3DC;LC_MEASUREMENT=3Dfr_FR.UTF-8;=
> LC_IDENTIFICATION=3DC
> |=20
> | attached base packages:
> | [1] grDevices utils     datasets  graphics  stats     methods   base=20=
> =20=20=20=20
> |=20
> | other attached packages:
> | [1] car_1.2-7
> `----
>
> Thanks for all your work !
>
> Regards,
>
> Julien=20
>
>
> --=-=-=
> Content-Type: text/x-diff
> Content-Disposition: attachment; filename=devX11_patch.diff
>
> --- devX11.c.orig	2008-04-28 16:22:46.000000000 +0200
> +++ devX11.c	2008-04-28 16:22:57.000000000 +0200
> @@ -2225,6 +2225,9 @@
> 	else strcpy(xd->symbolfamily,fn);
>     }
>
> +    strncpy(xd->title, title, 100);
> +    xd->title[100] = '\0';
> +
>     /*	Start the Device Driver and Hardcopy.  */
>
>     if (!X11_Open(dd, xd, disp_name, width, height,
> @@ -2238,8 +2241,6 @@
>     xd->fill = 0xffffffff; /* this is needed to ensure that the
> 			      first newpage does set whitecolor
> 			      if par("bg") is not transparent */
> -    strncpy(xd->title, title, 100);
> -    xd->title[100] = '\0';
>
> #if BUG
>     R_ProcessX11Events((void*) NULL);
>
> --=-=-=--
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list