CVS development version
You're going to be shocked how simple the fix is for the footer flicker in the X11 terminal. :-)
I'll skip the explanation for why the footer is flickering unless you want to know. Suffice it to say it looks like there was a long history with the footer text leaving behind bit fragments, etc. and the eventual solution was to erase the whole window.
I think the root of the problem is that the footer text placement, i.e., DrawCoords, is simply using the wrong kind of string draw, i.e., XDrawString() instead of XDrawImageString(). In the former, the font description is used like a mask, only bitblt-ing the portion of the screen where the font pixels are 1 with the specified operation such as XOR, AND, etc. That's good for laying text on top of existing graphics. But for the footer that's not desirable. Instead, the footer region should be fully redrawn first with the background color and then the font--and that is exactly what XDrawImageString does. And it appears that this XDrawImageString() routine is so fast (or smart) about the operation that there isn't a video frame showing any transient draw--hence I didn't have to manually draw the font region off screen and then bitblt that to the window footer.
Patch attached. Try rotating something like:
set term x11
splot (x**2)*(y**3) with lines
before and after the patch.
It could be that XDrawImageString() had some kind of problem when the font is variable width. If so, maybe there is a simple way of addressing that by clearing the right portion of the footer after the XDrawImageString(). We could (I think) use XQueryTextExtents() to get the pixel width of the string. I.e., something like:
gpXDrawImageString(dpy, plot->window, gc, 1, plot->gheight + vchar - 1, str, strlen(str));
XQueryTextExtents(...get pixwidth from XCharStruct...);
XClearArea(dpy, plot->window, pixwidth, plot->gheight, plot->width-pixwidth, vchar, false)
If you'd like me to experiment with that, let me know.
There's already a gnuplot enhanced function for getting string width in pixels, so it's even easier to clear the right portion of the footer. The attached patch seems to work, and I think covers it all.
Ah, yes. To verify that the second patch is in fact cleaning up residual garbage at the end of the line, try the first and second patch when changing not the rotation factor, but the scale factor. The scale factor prints out in variable width. Notice for the jun08 patch that there are a couple characters at the end of the string that won't change from time to time. In the jun09 patch that is corrected.
Last edit: Dan Sebald 2015-06-09
I notice a related behavior of the footer text flickering when the plot window is resized by dragging the lower right corner of the window about. I'm not so concerned with that one, and I'm not sure what the issue is as there aren't many XClear variety of functions within gplt_x11.c. Maybe with the resize the text footer is being removed and then added back on?
I do not see any flicker like the one you describe, not in 4.6, not in 5.0, and not in current cvs. I have tried with both local and remote xservers. Do you have any hints or thoughts about why your display might flicker but not mine? Are you connected to the server by a very slow connection? Running in sofware emulation mode?
I too wonder exactly what is happening. Everything here is fast, no remote connection. The doesn't say anything about the innards of the operating system or firmware, of course. I have an Nvidia graphics card and that tends to not be supported so well on Linux in terms of optimal performance. Usually Linux falls back to some common or standard (software) operation for graphics. So it could be some slow operation with font rendering or something, as a guess.
What is strange is that the plot portion which is rotated shows no sign at all of flickering. I rotate, scale fast and slow and no lines flashing, no annotation flashing. It's just in the footer where problems arise. For the plot region there is a Xclear, and then render. For the footer there is the Xclear, erase, render. I'm inclined to think that the erase operation is the source of the flicker. That is, if font rendering is slow, done in software rather than firmware, maybe a couple video frames go by in the time it takes to render the text. But again, there are small amounts of text on the plot itself, so I'm sure how true that argument is.
From that description, I'd guess that it is a problem with the font rendering (or with the font itself). Have you tried using a different font?
In my experience the nvidia x11 driver is excellent. Are you sure you are using it?
I doubt my computer is using Nvidia's driver, which I'm sure is much better. What I meant is the Linux bundle, which doesn't include Nvidia software, at least not Fedora. No philosophical apprehension about using certified software, just that I figure "out-of-the-box" is the most likely setup a general user will have. If I needed really high performance graphics, which I don't here at the moment, I'd switch to the certified driver.