I was doing some experiments with dark mode graphs and realized that the zoom selection box is not visible (black on black) in wxt if the background is set to #000000. So here's a patch:
diff --git a/src/wxterminal/wxt_gui.cpp b/src/wxterminal/wxt_gui.cpp
index 20efa9ae3..caac6e2c1 100644
--- a/src/wxterminal/wxt_gui.cpp
+++ b/src/wxterminal/wxt_gui.cpp
@@ -1088,14 +1088,18 @@ void wxtPanel::DrawToDC(wxDC &dc, wxRegion ®ion)
#ifdef USE_MOUSE
if (wxt_zoombox) {
- tmp_pen = wxPen(wxT("black"), 1, wxPENSTYLE_SOLID);
- tmp_pen.SetCap( wxCAP_ROUND );
- dc.SetPen( tmp_pen );
#ifndef __WXOSX_COCOA__
/* wx 2.9 Cocoa bug workaround, which has no logical functions support */
#if (GTK_MAJOR_VERSION < 3)
+ tmp_pen = wxPen(wxT("white"), 1, wxPENSTYLE_SOLID);
+ tmp_pen.SetCap( wxCAP_ROUND );
+ dc.SetPen( tmp_pen );
dc.SetLogicalFunction( wxINVERT );
#endif
+#else
+ tmp_pen = wxPen(wxT("black"), 1, wxPENSTYLE_SOLID);
+ tmp_pen.SetCap( wxCAP_ROUND );
+ dc.SetPen( tmp_pen );
#endif
dc.DrawLine( zoom_x1, zoom_y1, mouse_x, zoom_y1 );
dc.DrawLine( mouse_x, zoom_y1, mouse_x, mouse_y );
Details:
system: gnuplot 5.4 patchlevel 3 (Arch Linux)
patched branch: gnuplot branch-5-4-stable
Testing process:
$ gnuplot -e "set term wxt background '#000000'" -c demo/airfoil.dem
Verified that the zoom selection box is not visible (black on black)
$ gnuplot -e "set term wxt" -c demo/airfoil.dem
Verified that the zoom selection box is visible (black on white).
Patched the file src/wxterminal/wxt_gui.cpp and compiled src/gnuplot is the patched version
$ ./src/gnuplot -e "set term wxt background '#000000'" -c demo/airfoil.dem
Verified that the zoom selection box is now visible (white on black).
$ ./src/gnuplot -e "set term wxt" -c demo/airfoil.dem
Verified that the zoom selection box is still visible (different blending mode though).
I'm not able to test in a macOS environment.
I can provide screenshots and other details if required
I may be mis-reading this patch, but it seems to me that it has no effect on systems using gtk3/wxgtk3, which I thought would include all current linux distros. Certainly it has no effect on my test machines here. Is your Arch linux version still using gtk2?
Please show the output of
ldd ./gnuplot.I think a more robust approach would be to choose the zoombox/ruler/rubberband color based specifically on the known background. Something like:
The same is presumably needed for the ruler and the rubber band.
You are correct. it's missing the "else" part because I misread the "< 3" part, I wasn't so sure about it, hence the bug report.
I created a gist here to avoid the clutter with the requested ldd ouput
Indeed, it seems I managed to compile to gtk2 (thus < 3) which explains everything.
I'm having trouble to apply your patch (copying) directly but I will simply modify the lines and see if the problem persists.
Your patch seems to work here
I did a
git reset --hardand then modified the nearby lines.Then I did a
./prepare & ./configure & make -j4Typing
$ ./src/gnuplot -e "set term wxt background '#000000'" -c demo/airfoil.demI checked the zoom box and it was visible (white on black)Typing
$ gnuplot -e "set term wxt" -c demo/airfoil.demI checked the zoom box and it was visible (same shade as before, black with that blueish thing)Heres the patch:
OK. So your system gnuplot is linked against
libwx_gtk3u_core-3.0.so.0 => /usr/lib/libwx_gtk3u_core-3.0.so.0 (0x00007fb09746d000)but your patched local gnuplot is linked against
libwx_gtk2u_core-3.0.so.0 => /usr/lib/libwx_gtk2u_core-3.0.so.0 (0x00007f0ca295a000)Is this intentional?
Given the number of changes between gtk2 and gtk3 I suspect there are other visible differences in behavior of the two gnuplot executables. It was a right pain trying to find all the places that broke during the gtk 2.8->2.9->3.0 transition (not to mention the 2.9 variant that Mac OS spawned off). I am far from convinced we caught them all at the time. <gripe mode="" on=""> And now gtk4 is appearing over the horizon </gripe>.
Anyhow, I'll apply this change to both 5.4 and 5.5. Thanks for testing, particularly since it was on top of a library version I'm not testing any more.
It wasn't intentional I just took the easiest path in order to compile it and fix the bug. Since I didn't know anything about gnuplot src code I didn't tinkered with any kind of option just the bare minimum to find the code responsible for the
zoombox. After a few threads in wx foruns to understand what happened to macOS and that it was related to cairo not supporting some logical function... well I gave up and just tried to patch it and file a bug report.gtk4, qt6... how amusing
I'm glad to help anyway.