widget/gtk/mozcontainer.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* vim:expandtab:shiftwidth=4:tabstop=4:
michael@0 3 */
michael@0 4 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 7
michael@0 8 #ifndef __MOZ_CONTAINER_H__
michael@0 9 #define __MOZ_CONTAINER_H__
michael@0 10
michael@0 11 #include <gtk/gtk.h>
michael@0 12
michael@0 13 #ifdef __cplusplus
michael@0 14 extern "C" {
michael@0 15 #endif /* __cplusplus */
michael@0 16
michael@0 17 /*
michael@0 18 * MozContainer
michael@0 19 *
michael@0 20 * This class serves two purposes in the nsIWidget implementation.
michael@0 21 *
michael@0 22 * - It provides objects to receive signals from GTK for events on native
michael@0 23 * windows.
michael@0 24 *
michael@0 25 * - It provides a container parent for GtkWidgets. The only GtkWidgets
michael@0 26 * that need this in Mozilla are the GtkSockets for windowed plugins (Xt
michael@0 27 * and XEmbed).
michael@0 28 *
michael@0 29 * Note that the window hierarchy in Mozilla differs from conventional
michael@0 30 * GtkWidget hierarchies.
michael@0 31 *
michael@0 32 * Mozilla's hierarchy exists through the GdkWindow hierarchy, and all child
michael@0 33 * GdkWindows (within a child nsIWidget hierarchy) belong to one MozContainer
michael@0 34 * GtkWidget. If the MozContainer is unrealized or its GdkWindows are
michael@0 35 * destroyed for some other reason, then the hierarchy no longer exists. (In
michael@0 36 * conventional GTK clients, the hierarchy is recorded by the GtkWidgets, and
michael@0 37 * so can be re-established after destruction of the GdkWindows.)
michael@0 38 *
michael@0 39 * One consequence of this is that the MozContainer does not know which of its
michael@0 40 * GdkWindows should parent child GtkWidgets. (Conventional GtkContainers
michael@0 41 * determine which GdkWindow to assign child GtkWidgets.)
michael@0 42 *
michael@0 43 * Therefore, when adding a child GtkWidget to a MozContainer,
michael@0 44 * gtk_widget_set_parent_window should be called on the child GtkWidget before
michael@0 45 * it is realized.
michael@0 46 */
michael@0 47
michael@0 48 #define MOZ_CONTAINER_TYPE (moz_container_get_type())
michael@0 49 #define MOZ_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOZ_CONTAINER_TYPE, MozContainer))
michael@0 50 #define MOZ_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOZ_CONTAINER_TYPE, MozContainerClass))
michael@0 51 #define IS_MOZ_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOZ_CONTAINER_TYPE))
michael@0 52 #define IS_MOZ_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOZ_CONTAINER_TYPE))
michael@0 53 #define MOZ_CONAINTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZ_CONTAINER_TYPE, MozContainerClass))
michael@0 54
michael@0 55 typedef struct _MozContainer MozContainer;
michael@0 56 typedef struct _MozContainerClass MozContainerClass;
michael@0 57
michael@0 58 struct _MozContainer
michael@0 59 {
michael@0 60 GtkContainer container;
michael@0 61 GList *children;
michael@0 62 };
michael@0 63
michael@0 64 struct _MozContainerClass
michael@0 65 {
michael@0 66 GtkContainerClass parent_class;
michael@0 67 };
michael@0 68
michael@0 69 GType moz_container_get_type (void);
michael@0 70 GtkWidget *moz_container_new (void);
michael@0 71 void moz_container_put (MozContainer *container,
michael@0 72 GtkWidget *child_widget,
michael@0 73 gint x,
michael@0 74 gint y);
michael@0 75 void moz_container_move (MozContainer *container,
michael@0 76 GtkWidget *child_widget,
michael@0 77 gint x,
michael@0 78 gint y,
michael@0 79 gint width,
michael@0 80 gint height);
michael@0 81
michael@0 82 #ifdef __cplusplus
michael@0 83 }
michael@0 84 #endif /* __cplusplus */
michael@0 85
michael@0 86 #endif /* __MOZ_CONTAINER_H__ */

mercurial