xyb3rt / sxiv

Simple X Image Viewer
GNU General Public License v2.0
1.8k stars 264 forks source link

XEmbed error when attaching to transparency-pathced tabbed #342

Open githaff opened 5 years ago

githaff commented 5 years ago

Getting an error while trying to attach sxiv instance via xembed to a suckless tabbed utility patched with the transparency patch (alpha.diff from 28 Feb 2017 available at https://tools.suckless.org/tabbed/patches/alpha/).

Error text:

$ /usr/bin/sxiv -e 0x2800002 ~/Screenshot.png X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 1 (X_CreateWindow) Serial number of failed request: 26 Current serial number in output stream: 37

It happens at the 216 line in window.c:

cursors[i].icon = XCreateFontCursor(e->dpy, cursors[i].name);

With non-patched tabbed instance everything is ok. At the same time urxvt, surf and zathura do not have any issues with the patched version.

Is there any additional info I can provide to help with this? Or is it an issue with this tabbed patch? If so, would really appreciate any pointers on how I can make a workaround for it.

githaff commented 5 years ago

Have implemented a workaround for now: https://github.com/githaff/sxiv/tree/embed-on-transp Two things that make this workaround a bad hack:

  1. it makes sxiv work in the transparent tabbed client, but breaks for the non-transparent version. Couldn't find a way to distinguish between these two from the sxiv side, so for now used an envinronment variable for it (DIEM_TABBED_TRANS should be declared to work with transparent version).
  2. even when the hack works and sxiv gets embedded, the image gets corrupted with alpha layer. Artifacts disappear when both alpha and antialias are disabled. So I force them off when running in a transparent scenario.

Would be grateful if you have any ideas what I can do to make this hack less of a hack. I don't have a lot of experience with X imlib.

githaff commented 5 years ago

And yes, I have no idea why I have so focused on the tabbed application :D The same issue is present with just a plain urxvt with true transparency enabled. That is urxvt with

urxvt.depth: 32

in the xresources.

xyb3rt commented 5 years ago

Sorry, I currently do not have the time to look into this. Please note, that I've never used the XEmbed functionality and now hate myself for merging it because I now do own the code and feel the need to fix it...

githaff commented 5 years ago

Sure, I understand. Would also look into it a bit deeper myself, but also don't have time at the moment (and the nearest foreseeable future). But if it makes you fill better, the xembed functionality is the main sxiv killer feature for me and the reason I am using it :) It's very convenient to run image viewer in the same place as the terminal. Especially in tiling WMs, not to open another window further dividing the screen is a good thing.

astier commented 5 years ago

@githaff I didn't bother to replicate your error but I if you use dwm then I would recommend the swallow patch. I use dwm with the swallow patch and the st terminal (both with alpha patches) and I never had issues (neither with sxiv or other applications). Didn't try it with tabbed tho.

jaredforrest commented 3 years ago

I don't know if you're still interested in this @githaff but I've made a workaround which doesn't seem to have any issues..