<div dir="ltr"><div><div><div>On Tue, Dec 26, 2017 at 10:28 PM, Mark Morgan Lloyd via Lazarus <<a href="mailto:lazarus@lists.lazarus-ide.org">lazarus@lists.lazarus-ide.org</a>> wrote:<br>><br>>
Is it possible to embed the main window of another program into a pane
in something written using Lazarus, letting the Lazarus program provide
the "furniture" functionality that's usually handled by the window
manager?<br>><br>> The scenario I'm thinking about is putting
multiple instances of something non-trivial like Wireshark into an
overall "wrapper".<br><br>Yes, and funny enough i was doing just that in a reddit argument i had today (yes i spend my Christmas arguing with strangers on internet forums :-P).<br><br><a href="https://i.imgur.com/YvGyUVd.png">https://i.imgur.com/YvGyUVd.png</a><br><br><a href="https://i.imgur.com/Rwp86U4.png">https://i.imgur.com/Rwp86U4.png</a><br><br>This is something X support natively, however you need to keep some things in mind:<br><br></div>1. Your "container" need to have a proper X window. Some toolkits (like recent versions of Gtk2) will "merge" child windows unless they are necessary (very recent versions of Gtk2 will even use client side windows and ignore X subwindows). Other toolkits ignore X subwindows altogether. You need to somehow (ie. read the toolkit docs) ensure you have a native window.<br><br></div>2. You need to ensure the embedded window gets the input focus when necessary. Many toolkits implement and expect the XEmbed protocol (and you need to implement the embedder/host side of this) to handle focus, tab traversal, etc. Some older stuff might not need that though (XEmbed was needed because many toolkits ignore how X handles input focus and reimplement it themselves).<br><br></div>3. It should go without saying, but i'm gonna say it anyway: not everything expects or is happy being embedded. Specifically applications using client-side decorations expect to be in control and they can have surprising behavior when you embed them. For example i could move gedit around in the second shot using its "title bar" since that is implemented by gedit itself instead of relying on the window manager to do it.<br><div><div><br><div><div>4. On the other hand some applications have an explicit mode for being embedded into others, so look into that for the application you want to embed (and perhaps ask the developers for help).</div><div><br></div><div>Kostas<br></div></div></div></div></div>