CtkPlug: CTK+ 3 Reference Manual

## CtkPlug CtkPlug — Toplevel for embedding into other processes |

## Functions

void | ctk_plug_construct ()
void | ctk_plug_construct_for_display ()
CtkWidget * | ctk_plug_new ()
CtkWidget * | ctk_plug_new_for_display ()
Window | ctk_plug_get_id ()
gboolean | ctk_plug_get_embedded ()
CdkWindow * | ctk_plug_get_socket_window ()

## Properties

gboolean | embedded | Read
CdkWindow * | socket-window | Read

## Signals

void | embedded | Run Last

## Types and Values

struct | CtkPlug

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── CtkWidget
                ╰── CtkContainer
                    ╰── CtkBin
                        ╰── CtkWindow
                            ╰── CtkPlug

## Implemented Interfaces

CtkPlug implements AtkImplementorIface and CtkBuildable.

## Includes

    #include <ctk/ctkx.h>

## Description

Together with CtkSocket, CtkPlug provides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates a CtkSocket widget and passes the ID of that widget’s window to the other process, which then creates a CtkPlug with that window ID. Any widgets contained in the CtkPlug then will appear inside the first application’s window.

The communication between a CtkSocket and a CtkPlug follows the XEmbed Protocol. This protocol has also been implemented in other toolkits, e.g. Qt, allowing the same level of integration when embedding a Qt widget in CTK+ or vice versa.

The CtkPlug and CtkSocket widgets are only available when CTK+ is compiled for the X11 platform and `CDK_WINDOWING_X11` is defined. They can only be used on a CdkX11Display. To use CtkPlug and CtkSocket, you need to include the `ctk/ctkx.h` header.

## Functions

### ctk_plug_construct ()

    void
    ctk_plug_construct (CtkPlug *plug,
                        Window socket_id);

Finish the initialization of `plug` for a given CtkSocket identified by `socket_id` . This function will generally only be used by classes deriving from CtkPlug.

#### Parameters

plug | a CtkPlug. |
socket_id | the XID of the socket’s window. |

### ctk_plug_construct_for_display ()

    void
    ctk_plug_construct_for_display (CtkPlug *plug,
                                    CdkDisplay *display,
                                    Window socket_id);

Finish the initialization of `plug` for a given CtkSocket identified by `socket_id` which is currently displayed on `display` . This function will generally only be used by classes deriving from CtkPlug.

#### Parameters

plug | a CtkPlug. |
display | the CdkDisplay associated with `socket_id` ’s CtkSocket. |
socket_id | the XID of the socket’s window. |

Since: 2.2

### ctk_plug_new ()

    CtkWidget *
    ctk_plug_new (Window socket_id);

Creates a new plug widget inside the CtkSocket identified by `socket_id` . If `socket_id` is 0, the plug is left “unplugged” and can later be plugged into a CtkSocket by `ctk_socket_add_id()`.

#### Parameters

socket_id | the window ID of the socket, or 0. |

#### Returns

the new CtkPlug widget.

### ctk_plug_new_for_display ()

    CtkWidget *
    ctk_plug_new_for_display (CdkDisplay *display,
                              Window socket_id);

Create a new plug widget inside the CtkSocket identified by socket_id.

#### Parameters

display | the CdkDisplay on which `socket_id` is displayed |
socket_id | the XID of the socket’s window. |

#### Returns

the new CtkPlug widget.

Since: 2.2

### ctk_plug_get_id ()

    Window
    ctk_plug_get_id (CtkPlug *plug);

Gets the window ID of a CtkPlug widget, which can then be used to embed this window inside another window, for instance with `ctk_socket_add_id()`.

#### Parameters

plug | a CtkPlug. |

#### Returns

the window ID for the plug

### ctk_plug_get_embedded ()

    gboolean
    ctk_plug_get_embedded (CtkPlug *plug);

Determines whether the plug is embedded in a socket.

#### Parameters

plug | a CtkPlug |

#### Returns

`TRUE` if the plug is embedded in a socket

Since: 2.14

### ctk_plug_get_socket_window ()

    CdkWindow *
    ctk_plug_get_socket_window (CtkPlug *plug);

Retrieves the socket the plug is embedded in.

#### Parameters

plug | a CtkPlug |

#### Returns

the window of the socket, or `NULL`.

[nullable][transfer none]

Since: 2.14

## Types and Values

### struct CtkPlug

    struct CtkPlug;

## Property Details

### The `“embedded”` property

      “embedded”                 gboolean

`TRUE` if the plug is embedded in a socket.

Owner: CtkPlug

Flags: Read

Default value: FALSE

Since: 2.12

### The `“socket-window”` property

      “socket-window”            CdkWindow *

The window of the socket the plug is embedded in.

Owner: CtkPlug

Flags: Read

Since: 2.14

## Signal Details

### The `“embedded”` signal

    void
    user_function (CtkPlug *plug,
                   gpointer user_data)

Gets emitted when the plug becomes embedded in a socket.

#### Parameters

plug | the object on which the signal was emitted |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

## See Also

CtkSocket