Embed an app into a window
Asked Answered
P

2

6

FvwmButtons (a module of fvwm window manager) has the Swallow function, that embeds the window of an application into a panel.

I have to do something like this with Motif and Xlib. I want to embed an Xclock into my application. I guess I have to change the Window ID of the embedded app.

How can I do that?

Preach answered 22/3, 2011 at 17:4 Comment(0)
I
6

the only supported and reliable mechanism is XEmbed, but it requires the embedded app to cooperate. Without a cooperating app, you're in a world of scary hacks.

The basic thing you need to do is XReparentWindow() but the problem is that you're fighting the window manager which will also want to reparent the window. You're also potentially confusing the app, which will be expecting ICCCM and EWMH behavior, and expecting the parent window to be a WM frame.

Really old GNOME 1.x versions of gnome panel had a swallow feature you could try to steal hacks from maybe.

Without pretty extensive X knowledge this will be painful, and even with it's not necessarily possible to make 100% reliable.

Issy answered 23/3, 2011 at 3:23 Comment(2)
Interesting! Thanks! XReparentWindow() is what I want. Now I need to get the right window. I'm trying with XQueryTree(), but I don't know how to get a specific window.Preach
to get a specific window you probably want to look at the class hint (XGetClassHint). You can locate toplevel windows (as opposed to window manager frames) because they have the WM_STATE property.Issy
N
2

It looks like you are looking for the XEmbed protocol, documented here.

Nephro answered 22/3, 2011 at 17:18 Comment(1)
Thanks, it looks what I need. I think I can understand the specification you linked, but I'd like if you can post some example code...Preach

© 2022 - 2024 — McMap. All rights reserved.