|
Hi Chris, I have added a new option plwindow to aplplot, see first patch. It sets the window caption of the plot window. It is handled before the option parser in order to allow UTF8 texts (like APL primitive names) in the window caption. For normal ASCII captions that should be it. For UTF8 captions you may (depending on your platform) need to recompile libplplot with the second patch that makes X display the window caption properly. /// Jürgen |
--- aplplot.cc.orig 2014-09-24 19:49:49.506390550 +0200
+++ aplplot.cc 2014-09-26 16:34:40.130609125 +0200
@@ -84,6 +84,7 @@
static string xlabel;
static string ylabel;
static string tlabel;
+static string plwindow = "APLplot";
static bool xlog = false;
static bool ylog = false;
static int mode = APL_MODE_XY;
@@ -117,6 +118,7 @@
xlabel.clear ();
ylabel.clear ();
tlabel.clear ();
+ plwindow = "APLplot";
xlog = false;
ylog = false;
mode = APL_MODE_XY;
@@ -557,6 +559,9 @@
{
plspage (0.0, 0.0, plot_width, plot_height, 0.0, 0.0);
plscolbg (bgred, bggreen, bgblue);
+
+ plsetopt("plwindow", plwindow.c_str());
+
plinit ();
int axis_val = (mode == APL_MODE_XY)
@@ -946,7 +951,30 @@
if (A->is_char_string()) {
//const ShapeItem count = A->element_count();
const UCS_string ustr = A->get_UCS_ravel(); // unicode
- const UTF8_string utf (ustr);
+ UTF8_string utf (ustr);
+
+ // the option parser below seems not to like UTF8 encoded option values.
+ // we want UTF8 in the window caption and extract it here...
+ //
+ {
+ const char * plwin = strstr(utf.c_str(), "plwindow");
+ if (plwin)
+ {
+ const int chars_before_plwin = plwin - utf.c_str();
+ plwin += 8; // skip "plwindow "
+ if (*plwin) ++plwin;
+ plwindow.clear();
+ while (*plwin)
+ {
+ if (*plwin == ';') { ++plwin; break; }
+ else plwindow += *plwin++;
+ }
+
+ utf.shrink(chars_before_plwin);
+ while (*plwin) utf.append(*plwin++);
+ }
+ }
+
const string sstr ((const char *)(utf.get_items()), utf.size());
//const Rank rank = A->get_rank();
--- cairo.c.orig 2014-09-26 16:17:33.500513303 +0200
+++ cairo.c 2014-09-25 17:50:42.374195587 +0200
@@ -1971,7 +1971,14 @@
aStream->XWindow = XCreateSimpleWindow( aStream->XDisplay, rootWindow, 0, 0, (unsigned int) pls->xlength, (unsigned int) pls->ylength,
1, BlackPixel( aStream->XDisplay, XScreen ), BlackPixel( aStream->XDisplay, XScreen ) );
- XStoreName( aStream->XDisplay, aStream->XWindow, pls->plwindow );
+// XStoreName( aStream->XDisplay, aStream->XWindow, pls->plwindow );
+
+
+XChangeProperty( aStream->XDisplay, aStream->XWindow,
+ XInternAtom(aStream->XDisplay, "_NET_WM_NAME", False),
+ XInternAtom(aStream->XDisplay, "UTF8_STRING", False),
+ 8, PropModeReplace, (unsigned char *) pls->plwindow,
+ strlen(pls->plwindow));
XSelectInput( aStream->XDisplay, aStream->XWindow, NoEventMask );
XMapWindow( aStream->XDisplay, aStream->XWindow );
