1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=4:tabstop=4:
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef __MOZ_CONTAINER_H__
9 #define __MOZ_CONTAINER_H__
12 # include "MozContainerWayland.h"
21 * This class serves three purposes in the nsIWidget implementation.
23 * - It provides objects to receive signals from GTK for events on native
26 * - It provides GdkWindow to draw content on Wayland or when Gtk+ renders
27 * client side decorations to mShell.
29 * - It provides a container parent for GtkWidgets. The only GtkWidgets
30 * that need this in Mozilla are the GtkSockets for windowed plugins (Xt
33 * Note that the window hierarchy in Mozilla differs from conventional
34 * GtkWidget hierarchies.
36 * Mozilla's hierarchy exists through the GdkWindow hierarchy, and all child
37 * GdkWindows (within a child nsIWidget hierarchy) belong to one MozContainer
38 * GtkWidget. If the MozContainer is unrealized or its GdkWindows are
39 * destroyed for some other reason, then the hierarchy no longer exists. (In
40 * conventional GTK clients, the hierarchy is recorded by the GtkWidgets, and
41 * so can be re-established after destruction of the GdkWindows.)
43 * One consequence of this is that the MozContainer does not know which of its
44 * GdkWindows should parent child GtkWidgets. (Conventional GtkContainers
45 * determine which GdkWindow to assign child GtkWidgets.)
47 * Therefore, when adding a child GtkWidget to a MozContainer,
48 * gtk_widget_set_parent_window should be called on the child GtkWidget before
52 #define MOZ_CONTAINER_TYPE (moz_container_get_type())
53 #define MOZ_CONTAINER(obj) \
54 (G_TYPE_CHECK_INSTANCE_CAST((obj), MOZ_CONTAINER_TYPE, MozContainer))
55 #define MOZ_CONTAINER_CLASS(klass) \
56 (G_TYPE_CHECK_CLASS_CAST((klass), MOZ_CONTAINER_TYPE, MozContainerClass))
57 #define IS_MOZ_CONTAINER(obj) \
58 (G_TYPE_CHECK_INSTANCE_TYPE((obj), MOZ_CONTAINER_TYPE))
59 #define IS_MOZ_CONTAINER_CLASS(klass) \
60 (G_TYPE_CHECK_CLASS_TYPE((klass), MOZ_CONTAINER_TYPE))
61 #define MOZ_CONTAINER_GET_CLASS(obj) \
62 (G_TYPE_INSTANCE_GET_CLASS((obj), MOZ_CONTAINER_TYPE, MozContainerClass))
64 // We need to shape only a few pixels of the titlebar as we care about
66 #define TITLEBAR_SHAPE_MASK_HEIGHT 10
68 typedef struct _MozContainer MozContainer
;
69 typedef struct _MozContainerClass MozContainerClass
;
71 struct _MozContainer
{
72 GtkContainer container
;
74 gboolean force_default_visual
;
76 MozContainerWayland wl_container
;
80 struct _MozContainerClass
{
81 GtkContainerClass parent_class
;
84 GType
moz_container_get_type(void);
85 GtkWidget
* moz_container_new(void);
86 void moz_container_put(MozContainer
* container
, GtkWidget
* child_widget
, gint x
,
88 void moz_container_force_default_visual(MozContainer
* container
);
91 nsWindow
* moz_container_get_nsWindow(MozContainer
* container
);
93 #endif /* __MOZ_CONTAINER_H__ */