Open marek-safar opened 6 years ago
From @jeffechua on July 13, 2018 15:38
I'm not sure if here or the gtk-sharp repo is the best place to file this report. The gtk-sharp repo's issue page is pretty inactive, and the gtk-sharp website's "bug reporting" link directed to mono's bug reporting section which directed me here, and I'm not sure if this is an issue with the gtk-sharp wrapper or mono itself... so here it is.
This looks more like a gtk bug rather than a gtk# bug.
Can you see if this repros with a native gtk app? Doesn't seem to be anything platform specific in the transparency bindings.
After some investigation, it appears that the cause of this problem is that X11's alpha channels are of depth 1, while Mac's are of depth 8. I need to pass a Pixmap of depth 1 (i.e. a bitmap) into the image constructor for it to work on Linux, which in turn won't work and gives a (non-fatal) error on Mac. The easy workaround is to detect the platform and then use the corresponding depth for alpha.
Thus, I don't think that this strictly classifies as a bug, per se. It's just a quirk of the different platforms. I haven't gotten around to reproducing it in plain C gtk+, but it likely behaves similarly. Nevertheless, perhaps it might be a good idea to note this behavior in the documentation (both Gtk# and the original Gtk+) so people like me don't get tripped up unnecessarily (though the existence of this discussion mitigates that to an extent for proficient Googlers).
From @jeffechua on July 13, 2018 15:35
Steps to Reproduce
OR
Current Behavior
On MacOS, behavior is as expected for both test cases.
On Linux, the first test case crashes immediately whenever TRANSPARENCY == 0, and displays the supposedly translucent circles as fully opaque (i.e. indifferentiable from surrounding opacity) whenever TRANSPARENCY != 0. The second test case momentarily displays the fully opaque image (same as the first test case where TRANSPARENCY != 0) and then immediately crashes, whenever the the slider is moved, i.e. whenever Image.SetFromPixmap is invoked.
The error message in all crash cases is as below:
Expected Behavior
In the first test case, the two translucent circles should appear with transparency according to the value of the constant TRANSPARENCY. In the second test case, the circles should change transparency as the sliders are moved. In both test cases, the image itself (discounting alpha) is a red circle on a black background.
On which platforms did you notice this
[x] macOS (High Sierra 10.13.5) [x] Linux (Linux Mint 17.2 Cinnamon 64-bit, Cinnamon 2.6.13, Linux Kernel 3.13.0-141-generic) [ ] Windows (untested)
Version Used: 5.10.1.57 for MacOS, 5.12.0.226 for Linux Mint
Stacktrace
Using gdb and a breakpoint at "_XError" ("gdk_x_error" didn't work), the stacktrace obtained (hopefully correctly) was
Copied from original issue: mono/mono#9537