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

julien.barnier at ens-lsh.fr julien.barnier at ens-lsh.fr
Mon Apr 28 16:40:11 CEST 2008

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


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.

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
| locale:
| attached base packages:
| [1] grDevices utils     datasets  graphics  stats     methods   base=20=
| other attached packages:
| [1] car_1.2-7

Thanks for all your work !



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);


More information about the R-devel mailing list