summaryrefslogtreecommitdiff
path: root/archive/st/patch/st_embedder_x.c
diff options
context:
space:
mode:
authorauric <104602845+ihateamongus@users.noreply.github.com>2025-09-08 21:19:14 -0500
committerauric <104602845+ihateamongus@users.noreply.github.com>2025-09-08 21:19:14 -0500
commite61da07522a060da98fa3a56db3d0360469b26cf (patch)
treec72d276bffa4dafe22ae0e4f694acfadb40b8ca1 /archive/st/patch/st_embedder_x.c
parentd11aec86841f77edd6eba3e07aa1e7e591e9da2a (diff)
organize repository layout
Diffstat (limited to 'archive/st/patch/st_embedder_x.c')
-rw-r--r--archive/st/patch/st_embedder_x.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/archive/st/patch/st_embedder_x.c b/archive/st/patch/st_embedder_x.c
new file mode 100644
index 0000000..c73c389
--- /dev/null
+++ b/archive/st/patch/st_embedder_x.c
@@ -0,0 +1,50 @@
+static Window embed;
+
+void
+createnotify(XEvent *e)
+{
+ XWindowChanges wc;
+
+ if (embed || e->xcreatewindow.override_redirect)
+ return;
+
+ embed = e->xcreatewindow.window;
+
+ XReparentWindow(xw.dpy, embed, xw.win, 0, 0);
+ XSelectInput(xw.dpy, embed, PropertyChangeMask | StructureNotifyMask | EnterWindowMask);
+
+ XMapWindow(xw.dpy, embed);
+ sendxembed(XEMBED_EMBEDDED_NOTIFY, 0, xw.win, 0);
+
+ wc.width = win.w;
+ wc.height = win.h;
+ XConfigureWindow(xw.dpy, embed, CWWidth | CWHeight, &wc);
+
+ XSetInputFocus(xw.dpy, embed, RevertToParent, CurrentTime);
+}
+
+void
+destroynotify(XEvent *e)
+{
+ visibility(e);
+ if (embed == e->xdestroywindow.window) {
+ focus(e);
+ }
+}
+
+void
+sendxembed(long msg, long detail, long d1, long d2)
+{
+ XEvent e = { 0 };
+
+ e.xclient.window = embed;
+ e.xclient.type = ClientMessage;
+ e.xclient.message_type = xw.xembed;
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = CurrentTime;
+ e.xclient.data.l[1] = msg;
+ e.xclient.data.l[2] = detail;
+ e.xclient.data.l[3] = d1;
+ e.xclient.data.l[4] = d2;
+ XSendEvent(xw.dpy, embed, False, NoEventMask, &e);
+}