## GtkRoot GtkRoot — Interface for root widgets |

## Functions

GdkDisplay * | gtk_root_get_display ()
GtkWidget * | gtk_root_get_focus ()
void | gtk_root_set_focus ()

## Types and Values

| GtkRoot

## Object Hierarchy

        GInterface
        ╰── GtkRoot

## Prerequisites

GtkRoot requires GtkNative and GtkWidget.

## Known Implementations

GtkRoot is implemented by GtkAboutDialog, GtkAppChooserDialog, GtkApplicationWindow, GtkAssistant, GtkColorChooserDialog, GtkDialog, GtkDragIcon, GtkFileChooserDialog, GtkFontChooserDialog, GtkMessageDialog, GtkPageSetupUnixDialog, GtkPrintUnixDialog, GtkShortcutsWindow and GtkWindow.

## Includes

    #include <gtk/gtk.h>

## Description

GtkRoot is the interface implemented by all widgets that can act as a toplevel widget to a hierarchy of widgets. The root widget takes care of providing the connection to the windowing system and manages layout, drawing and event delivery for its widget hierarchy.

The obvious example of a GtkRoot is GtkWindow.

## Functions

### gtk_root_get_display ()

    GdkDisplay *
    gtk_root_get_display (GtkRoot *self);

Returns the display that this GtkRoot is on.

#### Parameters

self | a GtkRoot |

#### Returns

the display of `root` .

[transfer none]

### gtk_root_get_focus ()

    GtkWidget *
    gtk_root_get_focus (GtkRoot *self);

Retrieves the current focused widget within the root.

Note that this is the widget that would have the focus if the root is active; if the root is not focused then `gtk_widget_has_focus (widget)` will be `FALSE` for the widget.

#### Parameters

self | a GtkRoot |

#### Returns

the currently focused widget, or `NULL` if there is none.

[nullable][transfer none]

### gtk_root_set_focus ()

    void
    gtk_root_set_focus (GtkRoot *self,
                        GtkWidget *focus);

If `focus` is not the current focus widget, and is focusable, sets it as the focus widget for the root. If `focus` is `NULL`, unsets the focus widget for the root.

To set the focus to a particular widget in the root, it is usually more convenient to use `gtk_widget_grab_focus()` instead of this function.

#### Parameters

self | a GtkRoot |
focus | widget to be the new focus widget, or `NULL` to unset the focus widget. | [allow-none]

## Types and Values

### GtkRoot

    typedef struct _GtkRoot GtkRoot;

## See Also

GtkWindow