Changeset 1d74663
- Timestamp:
- Sep 18, 2010, 5:07:39 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- cb81570
- Parents:
- 818f19c
- git-author:
- David Benjamin <davidben@mit.edu> (08/07/10 16:15:02)
- git-committer:
- David Benjamin <davidben@mit.edu> (09/18/10 17:07:39)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
context.c
r07b59ea r1d74663 53 53 return(ctx->mode & OWL_CTX_INTERACTIVE)?1:0; 54 54 } 55 56 void owl_context_deactivate(owl_context *ctx) 57 { 58 if (ctx->deactivate_cb) 59 ctx->deactivate_cb(ctx); 60 } 61 62 void owl_context_delete(owl_context *ctx) 63 { 64 if (ctx->cursor) 65 g_object_unref(ctx->cursor); 66 owl_free(ctx->keymap); 67 if (ctx->delete_cb) 68 ctx->delete_cb(ctx); 69 owl_free(ctx); 70 } -
global.c
r818f19c r1d74663 174 174 mode |= OWL_CTX_INTERACTIVE; 175 175 c = owl_malloc(sizeof *c); 176 memset(c, 0, sizeof(*c)); 176 177 c->mode = mode; 177 178 c->data = data; 178 179 c->cursor = cursor ? g_object_ref(cursor) : NULL; 179 180 c->keymap = owl_strdup(keymap); 181 owl_global_push_context_obj(g, c); 182 } 183 184 void owl_global_push_context_obj(owl_global *g, owl_context *c) 185 { 180 186 g->context_stack = g_list_prepend(g->context_stack, c); 181 187 owl_global_activate_context(g, owl_global_get_context(g)); 182 188 } 183 189 190 /* Pops the current context from the context stack and returns it. Caller is 191 * responsible for freeing. */ 192 owl_context *owl_global_pop_context_no_delete(owl_global *g) { 193 owl_context *c; 194 if (!g->context_stack) 195 return NULL; 196 c = owl_global_get_context(g); 197 owl_context_deactivate(c); 198 g->context_stack = g_list_delete_link(g->context_stack, 199 g->context_stack); 200 owl_global_activate_context(g, owl_global_get_context(g)); 201 return c; 202 } 203 204 /* Pops the current context from the context stack and deletes it. */ 184 205 void owl_global_pop_context(owl_global *g) { 185 206 owl_context *c; 186 if (!g->context_stack) 187 return; 188 c = owl_global_get_context(g); 189 g->context_stack = g_list_delete_link(g->context_stack, 190 g->context_stack); 191 if (c->cursor) 192 g_object_unref(c->cursor); 193 owl_free(c->keymap); 194 owl_free(c); 195 owl_global_activate_context(g, owl_global_get_context(g)); 207 c = owl_global_pop_context_no_delete(g); 208 if (c) 209 owl_context_delete(c); 196 210 } 197 211 -
owl.h
r60c1386 r1d74663 304 304 char *keymap; 305 305 owl_window *cursor; 306 void (*deactivate_cb)(struct _owl_context*); 307 void (*delete_cb)(struct _owl_context*); 306 308 } owl_context; 307 309
Note: See TracChangeset
for help on using the changeset viewer.