Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-12

Embedding an X11 server as a component

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

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?

The scenario I'm thinking about is putting multiple instances of something non-trivial like Wireshark into an overall "wrapper".

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Kostas Michalopoulos
to Mark Morgan Lloyd

On Tue, Dec 26, 2017 at 10:28 PM, Mark Morgan Lloyd via Lazarus <

wrote: 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?

The scenario I'm thinking about is putting multiple instances of

something non-trivial like Wireshark into an overall "wrapper".

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).

https://i.imgur.com/YvGyUVd.png

https://i.imgur.com/Rwp86U4.png

This is something X support natively, however you need to keep some things in mind:

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.

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).

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.

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).

Kostas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171227/23503de9/attachment.html>

Reply by email

Mark Morgan Lloyd
to Mark Morgan Lloyd: Is it possible to embed the main window of another program into a pane in something…
Mark Morgan Lloyd wrote 5 lines
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? The scenario I'm thinking about is putting multiple instances of something non-trivial like Wireshark into an overall "wrapper".

Going some way towards answering my own question: Xnest or Xephyr can be embedded into an existing window using the -parent option, where the parameter is the window identifier shown by e.g. xwininfo. There are various authorisation issues which I've not yet got to grips with.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email