Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* ATK - Accessibility Toolkit |
michael@0 | 2 | * Copyright 2001 Sun Microsystems Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * This library is free software; you can redistribute it and/or |
michael@0 | 5 | * modify it under the terms of the GNU Library General Public |
michael@0 | 6 | * License as published by the Free Software Foundation; either |
michael@0 | 7 | * version 2 of the License, or (at your option) any later version. |
michael@0 | 8 | * |
michael@0 | 9 | * This library is distributed in the hope that it will be useful, |
michael@0 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
michael@0 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
michael@0 | 12 | * Library General Public License for more details. |
michael@0 | 13 | * |
michael@0 | 14 | * You should have received a copy of the GNU Library General Public |
michael@0 | 15 | * License along with this library; if not, write to the |
michael@0 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
michael@0 | 17 | * Boston, MA 02111-1307, USA. |
michael@0 | 18 | */ |
michael@0 | 19 | |
michael@0 | 20 | #ifndef __ATK_UTIL_H__ |
michael@0 | 21 | #define __ATK_UTIL_H__ |
michael@0 | 22 | |
michael@0 | 23 | #include <atk/atkobject.h> |
michael@0 | 24 | |
michael@0 | 25 | #ifdef __cplusplus |
michael@0 | 26 | extern "C" { |
michael@0 | 27 | #endif /* __cplusplus */ |
michael@0 | 28 | |
michael@0 | 29 | #define ATK_TYPE_UTIL (atk_util_get_type ()) |
michael@0 | 30 | #define ATK_IS_UTIL(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_UTIL) |
michael@0 | 31 | #define ATK_UTIL(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_UTIL, AtkUtil) |
michael@0 | 32 | #define ATK_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_UTIL, AtkUtilClass)) |
michael@0 | 33 | #define ATK_IS_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATK_TYPE_UTIL)) |
michael@0 | 34 | #define ATK_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATK_TYPE_UTIL, AtkUtilClass)) |
michael@0 | 35 | |
michael@0 | 36 | |
michael@0 | 37 | #ifndef _TYPEDEF_ATK_UTIL_ |
michael@0 | 38 | #define _TYPEDEF_ATK_UTIL_ |
michael@0 | 39 | typedef struct _AtkUtil AtkUtil; |
michael@0 | 40 | typedef struct _AtkUtilClass AtkUtilClass; |
michael@0 | 41 | typedef struct _AtkKeyEventStruct AtkKeyEventStruct; |
michael@0 | 42 | #endif |
michael@0 | 43 | |
michael@0 | 44 | /** |
michael@0 | 45 | * AtkEventListener: |
michael@0 | 46 | * @obj: An #AtkObject instance for whom the callback will be called when |
michael@0 | 47 | * the specified event (e.g. 'focus:') takes place. |
michael@0 | 48 | * |
michael@0 | 49 | * A function which is called when an object emits a matching event, |
michael@0 | 50 | * as used in #atk_add_focus_tracker. |
michael@0 | 51 | * Currently the only events for which object-specific handlers are |
michael@0 | 52 | * supported are events of type "focus:". Most clients of ATK will prefer to |
michael@0 | 53 | * attach signal handlers for the various ATK signals instead. |
michael@0 | 54 | * |
michael@0 | 55 | * @see: atk_add_focus_tracker. |
michael@0 | 56 | **/ |
michael@0 | 57 | typedef void (*AtkEventListener) (AtkObject* obj); |
michael@0 | 58 | /** |
michael@0 | 59 | * AtkEventListenerInit: |
michael@0 | 60 | * |
michael@0 | 61 | * An #AtkEventListenerInit function is a special function that is |
michael@0 | 62 | * called in order to initialize the per-object event registration system |
michael@0 | 63 | * used by #AtkEventListener, if any preparation is required. |
michael@0 | 64 | * |
michael@0 | 65 | * @see: atk_focus_tracker_init. |
michael@0 | 66 | **/ |
michael@0 | 67 | typedef void (*AtkEventListenerInit) (void); |
michael@0 | 68 | /** |
michael@0 | 69 | * AtkKeySnoopFunc: |
michael@0 | 70 | * @event: an AtkKeyEventStruct containing information about the key event for which |
michael@0 | 71 | * notification is being given. |
michael@0 | 72 | * @func_data: a block of data which will be passed to the event listener, on notification. |
michael@0 | 73 | * |
michael@0 | 74 | * An #AtkKeySnoopFunc is a type of callback which is called whenever a key event occurs, |
michael@0 | 75 | * if registered via atk_add_key_event_listener. It allows for pre-emptive |
michael@0 | 76 | * interception of key events via the return code as described below. |
michael@0 | 77 | * |
michael@0 | 78 | * Returns: TRUE (nonzero) if the event emission should be stopped and the event |
michael@0 | 79 | * discarded without being passed to the normal GUI recipient; FALSE (zero) if the |
michael@0 | 80 | * event dispatch to the client application should proceed as normal. |
michael@0 | 81 | * |
michael@0 | 82 | * @see: atk_add_key_event_listener. |
michael@0 | 83 | **/ |
michael@0 | 84 | typedef gint (*AtkKeySnoopFunc) (AtkKeyEventStruct *event, |
michael@0 | 85 | gpointer func_data); |
michael@0 | 86 | |
michael@0 | 87 | /** |
michael@0 | 88 | * AtkKeyEventStruct: |
michael@0 | 89 | * @type: An AtkKeyEventType, generally one of ATK_KEY_EVENT_PRESS or ATK_KEY_EVENT_RELEASE |
michael@0 | 90 | * @state: A bitmask representing the state of the modifier keys immediately after the event takes place. |
michael@0 | 91 | * The meaning of the bits is currently defined to match the bitmask used by GDK in |
michael@0 | 92 | * GdkEventType.state, see |
michael@0 | 93 | * http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html#GdkEventKey |
michael@0 | 94 | * @keyval: A guint representing a keysym value corresponding to those used by GDK and X11: see |
michael@0 | 95 | * /usr/X11/include/keysymdef.h. |
michael@0 | 96 | * @length: The length of member #string. |
michael@0 | 97 | * @string: A string containing one of the following: either a string approximating the text that would |
michael@0 | 98 | * result from this keypress, if the key is a control or graphic character, or a symbolic name for this keypress. |
michael@0 | 99 | * Alphanumeric and printable keys will have the symbolic key name in this string member, for instance "A". "0", |
michael@0 | 100 | * "semicolon", "aacute". Keypad keys have the prefix "KP". |
michael@0 | 101 | * @keycode: The raw hardware code that generated the key event. This field is raraly useful. |
michael@0 | 102 | * @timestamp: A timestamp in milliseconds indicating when the event occurred. |
michael@0 | 103 | * These timestamps are relative to a starting point which should be considered arbitrary, |
michael@0 | 104 | * and only used to compare the dispatch times of events to one another. |
michael@0 | 105 | * |
michael@0 | 106 | * Encapsulates information about a key event. |
michael@0 | 107 | **/ |
michael@0 | 108 | struct _AtkKeyEventStruct { |
michael@0 | 109 | gint type; |
michael@0 | 110 | guint state; |
michael@0 | 111 | guint keyval; |
michael@0 | 112 | gint length; |
michael@0 | 113 | gchar *string; |
michael@0 | 114 | guint16 keycode; |
michael@0 | 115 | guint32 timestamp; |
michael@0 | 116 | }; |
michael@0 | 117 | |
michael@0 | 118 | /** |
michael@0 | 119 | *AtkKeyEventType: |
michael@0 | 120 | *@ATK_KEY_EVENT_PRESS: specifies a key press event |
michael@0 | 121 | *@ATK_KEY_EVENT_RELEASE: specifies a key release event |
michael@0 | 122 | *@ATK_KEY_EVENT_LAST_DEFINED: Not a valid value; specifies end of enumeration |
michael@0 | 123 | * |
michael@0 | 124 | *Specifies the type of a keyboard evemt. |
michael@0 | 125 | **/ |
michael@0 | 126 | typedef enum |
michael@0 | 127 | { |
michael@0 | 128 | ATK_KEY_EVENT_PRESS, |
michael@0 | 129 | ATK_KEY_EVENT_RELEASE, |
michael@0 | 130 | ATK_KEY_EVENT_LAST_DEFINED |
michael@0 | 131 | } AtkKeyEventType; |
michael@0 | 132 | |
michael@0 | 133 | struct _AtkUtil |
michael@0 | 134 | { |
michael@0 | 135 | GObject parent; |
michael@0 | 136 | }; |
michael@0 | 137 | |
michael@0 | 138 | struct _AtkUtilClass |
michael@0 | 139 | { |
michael@0 | 140 | GObjectClass parent; |
michael@0 | 141 | guint (* add_global_event_listener) (GSignalEmissionHook listener, |
michael@0 | 142 | const gchar *event_type); |
michael@0 | 143 | void (* remove_global_event_listener) (guint listener_id); |
michael@0 | 144 | guint (* add_key_event_listener) (AtkKeySnoopFunc listener, |
michael@0 | 145 | gpointer data); |
michael@0 | 146 | void (* remove_key_event_listener) (guint listener_id); |
michael@0 | 147 | AtkObject* (* get_root) (void); |
michael@0 | 148 | G_CONST_RETURN gchar* (* get_toolkit_name) (void); |
michael@0 | 149 | G_CONST_RETURN gchar* (* get_toolkit_version) (void); |
michael@0 | 150 | }; |
michael@0 | 151 | GType atk_util_get_type (void); |
michael@0 | 152 | |
michael@0 | 153 | /** |
michael@0 | 154 | *AtkCoordType: |
michael@0 | 155 | *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen |
michael@0 | 156 | *@ATK_XY_WINDOW: specifies xy coordinates relative to the widget's |
michael@0 | 157 | * top-level window |
michael@0 | 158 | * |
michael@0 | 159 | *Specifies how xy coordinates are to be interpreted. Used by functions such |
michael@0 | 160 | *as atk_component_get_position() and atk_text_get_character_extents() |
michael@0 | 161 | **/ |
michael@0 | 162 | typedef enum { |
michael@0 | 163 | ATK_XY_SCREEN, |
michael@0 | 164 | ATK_XY_WINDOW |
michael@0 | 165 | }AtkCoordType; |
michael@0 | 166 | |
michael@0 | 167 | /* |
michael@0 | 168 | * Adds the specified function to the list of functions to be called |
michael@0 | 169 | * when an object receives focus. |
michael@0 | 170 | */ |
michael@0 | 171 | guint atk_add_focus_tracker (AtkEventListener focus_tracker); |
michael@0 | 172 | |
michael@0 | 173 | /* |
michael@0 | 174 | * Removes the specified focus tracker from the list of function |
michael@0 | 175 | * to be called when any object receives focus |
michael@0 | 176 | */ |
michael@0 | 177 | void atk_remove_focus_tracker (guint tracker_id); |
michael@0 | 178 | |
michael@0 | 179 | /* |
michael@0 | 180 | * atk_focus_tracker_init: |
michael@0 | 181 | * @init: An #AtkEventListenerInit function to be called |
michael@0 | 182 | * prior to any focus-tracking requests. |
michael@0 | 183 | * |
michael@0 | 184 | * Specifies the function to be called for focus tracker initialization. |
michael@0 | 185 | * removal. This function should be called by an implementation of the |
michael@0 | 186 | * ATK interface if any specific work needs to be done to enable |
michael@0 | 187 | * focus tracking. |
michael@0 | 188 | */ |
michael@0 | 189 | void atk_focus_tracker_init (AtkEventListenerInit init); |
michael@0 | 190 | |
michael@0 | 191 | /* |
michael@0 | 192 | * Cause the focus tracker functions which have been specified to be |
michael@0 | 193 | * executed for the object. |
michael@0 | 194 | */ |
michael@0 | 195 | void atk_focus_tracker_notify (AtkObject *object); |
michael@0 | 196 | |
michael@0 | 197 | /* |
michael@0 | 198 | * Adds the specified function to the list of functions to be called |
michael@0 | 199 | * when an event of type event_type occurs. |
michael@0 | 200 | */ |
michael@0 | 201 | guint atk_add_global_event_listener (GSignalEmissionHook listener, |
michael@0 | 202 | const gchar *event_type); |
michael@0 | 203 | |
michael@0 | 204 | /* |
michael@0 | 205 | * Removes the specified event listener |
michael@0 | 206 | */ |
michael@0 | 207 | void atk_remove_global_event_listener (guint listener_id); |
michael@0 | 208 | |
michael@0 | 209 | /* |
michael@0 | 210 | * Adds the specified function to the list of functions to be called |
michael@0 | 211 | * when an keyboard event occurs. |
michael@0 | 212 | */ |
michael@0 | 213 | guint atk_add_key_event_listener (AtkKeySnoopFunc listener, gpointer data); |
michael@0 | 214 | |
michael@0 | 215 | /* |
michael@0 | 216 | * Removes the specified event listener |
michael@0 | 217 | */ |
michael@0 | 218 | void atk_remove_key_event_listener (guint listener_id); |
michael@0 | 219 | |
michael@0 | 220 | /* |
michael@0 | 221 | * Returns the root accessible container for the current application. |
michael@0 | 222 | */ |
michael@0 | 223 | AtkObject* atk_get_root(void); |
michael@0 | 224 | |
michael@0 | 225 | AtkObject* atk_get_focus_object (void); |
michael@0 | 226 | |
michael@0 | 227 | /* |
michael@0 | 228 | * Returns name string for the GUI toolkit. |
michael@0 | 229 | */ |
michael@0 | 230 | G_CONST_RETURN gchar *atk_get_toolkit_name (void); |
michael@0 | 231 | |
michael@0 | 232 | /* |
michael@0 | 233 | * Returns version string for the GUI toolkit. |
michael@0 | 234 | */ |
michael@0 | 235 | G_CONST_RETURN gchar *atk_get_toolkit_version (void); |
michael@0 | 236 | |
michael@0 | 237 | #ifdef __cplusplus |
michael@0 | 238 | } |
michael@0 | 239 | #endif /* __cplusplus */ |
michael@0 | 240 | |
michael@0 | 241 | |
michael@0 | 242 | #endif /* __ATK_UTIL_H__ */ |