Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Why don't simple WebKitGTK browsers which support XEmbed work with XWinWrap? #8

Open
ghost opened this issue Dec 5, 2018 · 5 comments

Comments

@ghost
Copy link

ghost commented Dec 5, 2018

surf, vimb and uzbl all support xembed and work fine with tabbed, so I assumed they'd work with xwinwrap as well, but apparently they don't. All I get is a black background/window when I try running either browser with xwinwrap.
All other programs which support xembed that I've tried (gifview, mpv, sxiv, xterm, urxvt and st) work fine with xwinwrap, so why don't surf, vimb and uzbl?
Would it be possible to make them work?
Running a small web browser like surf in the root window would be cool because you could make your wallpaper much more than a simple gif or a video with javascript.
You could for example have it interface with mpd and make your wallpaper produce a neat music visualizer in some interesting way or pretty much anything you can imagine.
It'd be pretty rad, don't you think?

@ghost ghost changed the title Why don't simple WebKitGTK browsers which support XEmbed with XWinWrap? Why don't simple WebKitGTK browsers which support XEmbed work with XWinWrap? Dec 5, 2018
@takase1121
Copy link

image

Its possible.

I modified tabbed to accept a window ID so you can use xwinwrap to wrap it.
While I have a patch that is already working (but accidentally deleted it), the code itself isn't too complex, just the matter of replacing XCreateSimpleWindow in tabbed.c with the WID from xwinwrap.

@evtn
Copy link

evtn commented Apr 12, 2021

@takase1121 could you please tell more about your solution?
I've tried replacing win = XCreateSimpleWindow(...) with win = wid (where wid is an id passed from xwinwrap, as long) in tabbed.c, but with that replacement I get:

tabbed: fatal error: request code=62, error code=8
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  62 (X_CopyArea)
  Serial number of failed request:  46
  Current serial number in output stream:  47
tabbed died, exit status 1

Any thoughts on where I did it wrong?

@takase1121
Copy link

hold on, I'll try to replicate my solution and check if it works.

@takase1121
Copy link

takase1121 commented Apr 12, 2021

Here's a diff of my work; just tested working on my computer.

diff --git a/tabbed.c b/tabbed.c
index f974e1a..5304046 100644
--- a/tabbed.c
+++ b/tabbed.c
@@ -169,6 +169,8 @@ static char winid[64];
 static char **cmd;
 static char *wmname = "tabbed";
 static const char *geometry;
+static int use_wid;
+static int wid;
 
 char *argv0;
 
@@ -1051,8 +1053,12 @@ setup(void)
 	                            DefaultDepth(dpy, screen));
 	dc.gc = XCreateGC(dpy, root, 0, 0);
 
-	win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0,
-	                          dc.norm[ColFG].pixel, dc.norm[ColBG].pixel);
+	if (use_wid)
+		win = wid;
+	else
+		win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0,
+	    	                      dc.norm[ColFG].pixel, dc.norm[ColBG].pixel);
+
 	XMapRaised(dpy, win);
 	XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask |
 	             ButtonPressMask | ExposureMask | KeyPressMask |
@@ -1348,6 +1354,10 @@ main(int argc, char *argv[])
 		die("tabbed-"VERSION", © 2009-2016 tabbed engineers, "
 		    "see LICENSE for details.\n");
 		break;
+	case 'w':
+		use_wid = True;
+		wid = strtol(EARGF(usage()), NULL, 0);
+		break;
 	default:
 		usage();
 		break;

(There might be bugs, but at least it worked for my testing)

Command tested against (this is my own xwinwrap, please adjust %WID according to yours):

xwinwrap -g 1920x1080 -fdt -un -s -st -sp -b -- ./tabbed -w %WID xterm -into

@evtn
Copy link

evtn commented Apr 12, 2021

@takase1121
Seems like the problem was in my xwinwrap arguments
I've tried your example (with few adjustments according to my needs) and it worked nice

Thanks for help!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants