Changeset 07b59ea
- Timestamp:
- Jun 3, 2010, 2:58:30 AM (13 years ago)
- Branches:
- master, release-1.7, release-1.8, release-1.9
- Children:
- e8128c5
- Parents:
- 4dd115f
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
context.c
r2a17b63 r07b59ea 9 9 ctx->mode = OWL_CTX_STARTUP; 10 10 ctx->data = NULL; 11 ctx->cursor = NULL; 11 12 return 0; 12 13 } -
functions.c
r40597e7 r07b59ea 292 292 owl_editwin_set_cbdata(e, data, cleanup); 293 293 owl_editwin_set_callback(e, callback); 294 owl_global_push_context(&g, OWL_CTX_EDITMULTI, e, "editmulti" );294 owl_global_push_context(&g, OWL_CTX_EDITMULTI, e, "editmulti", owl_global_get_curs_typwin(&g)); 295 295 } 296 296 … … 1260 1260 1261 1261 owl_popwin_up(pw); 1262 owl_global_push_context(&g, OWL_CTX_POPLESS, v, "popless" );1262 owl_global_push_context(&g, OWL_CTX_POPLESS, v, "popless", NULL); 1263 1263 owl_viewwin_init_text(v, owl_popwin_get_content(pw), text); 1264 1264 } … … 1273 1273 1274 1274 owl_popwin_up(pw); 1275 owl_global_push_context(&g, OWL_CTX_POPLESS, v, "popless" );1275 owl_global_push_context(&g, OWL_CTX_POPLESS, v, "popless", NULL); 1276 1276 owl_viewwin_init_fmtext(v, owl_popwin_get_content(pw), fm); 1277 1277 } … … 1895 1895 owl_editwin_insert_string(tw, line); 1896 1896 1897 owl_global_push_context(&g, OWL_CTX_EDITLINE, tw, "editline" );1897 owl_global_push_context(&g, OWL_CTX_EDITLINE, tw, "editline", owl_global_get_curs_typwin(&g)); 1898 1898 owl_editwin_set_callback(tw, owl_callback_command); 1899 1899 } … … 1907 1907 owl_editwin_set_locktext(tw, line); 1908 1908 1909 owl_global_push_context(&g, OWL_CTX_EDITRESPONSE, tw, "editresponse" );1909 owl_global_push_context(&g, OWL_CTX_EDITRESPONSE, tw, "editresponse", owl_global_get_curs_typwin(&g)); 1910 1910 return tw; 1911 1911 } … … 1921 1921 owl_editwin_set_locktext(tw, line); 1922 1922 1923 owl_global_push_context(&g, OWL_CTX_EDITRESPONSE, tw, "editresponse" );1923 owl_global_push_context(&g, OWL_CTX_EDITRESPONSE, tw, "editresponse", owl_global_get_curs_typwin(&g)); 1924 1924 return tw; 1925 1925 } -
global.c
r4dd115f r07b59ea 34 34 35 35 g->context_stack = NULL; 36 owl_global_push_context(g, OWL_CTX_STARTUP, NULL, NULL );36 owl_global_push_context(g, OWL_CTX_STARTUP, NULL, NULL, NULL); 37 37 38 38 g->curmsg=0; … … 177 177 } 178 178 179 static void owl_global_lookup_keymap(owl_global *g) { 180 owl_context *c = owl_global_get_context(g); 181 if (!c || !c->keymap) 179 static void owl_global_activate_context(owl_global *g, owl_context *c) { 180 if (!c) 182 181 return; 183 182 184 if (!owl_keyhandler_activate(owl_global_get_keyhandler(g), c->keymap)) { 185 owl_function_error("Unable to activate keymap '%s'", c->keymap); 186 } 187 } 188 189 void owl_global_push_context(owl_global *g, int mode, void *data, const char *keymap) { 183 if (c->keymap) { 184 if (!owl_keyhandler_activate(owl_global_get_keyhandler(g), c->keymap)) { 185 owl_function_error("Unable to activate keymap '%s'", c->keymap); 186 } 187 } 188 owl_window_set_cursor(c->cursor); 189 } 190 191 void owl_global_push_context(owl_global *g, int mode, void *data, const char *keymap, owl_window *cursor) { 190 192 owl_context *c; 191 193 if (!(mode & OWL_CTX_MODE_BITS)) … … 194 196 c->mode = mode; 195 197 c->data = data; 198 c->cursor = cursor ? g_object_ref(cursor) : NULL; 196 199 c->keymap = owl_strdup(keymap); 197 200 g->context_stack = g_list_prepend(g->context_stack, c); 198 owl_global_ lookup_keymap(g);201 owl_global_activate_context(g, owl_global_get_context(g)); 199 202 } 200 203 … … 206 209 g->context_stack = g_list_delete_link(g->context_stack, 207 210 g->context_stack); 211 if (c->cursor) 212 g_object_unref(c->cursor); 208 213 owl_free(c->keymap); 209 214 owl_free(c); 210 owl_global_ lookup_keymap(g);215 owl_global_activate_context(g, owl_global_get_context(g)); 211 216 } 212 217 -
owl.c
r4dd115f r07b59ea 464 464 if (owl_global_is_needrefresh(&g)) { 465 465 /* Redraw the screen */ 466 467 /* HACK: move the cursor to unmanaged window if necessary; these should be468 * associated with the context or something. */469 if (!owl_popwin_is_active(owl_global_get_popwin(&g))470 && owl_global_get_typwin(&g)) {471 owl_window_set_cursor(owl_global_get_curs_typwin(&g));472 } else {473 owl_window_set_cursor(NULL);474 }475 476 466 owl_window_redraw_scheduled(); 477 467 doupdate(); … … 549 539 550 540 owl_global_pop_context(&g); 551 owl_global_push_context(&g, OWL_CTX_READCONFIG, NULL, NULL );541 owl_global_push_context(&g, OWL_CTX_READCONFIG, NULL, NULL, NULL); 552 542 553 543 perlerr=owl_perlconfig_initperl(opts.configfile, &argc, &argv, &env); … … 616 606 617 607 owl_global_pop_context(&g); 618 owl_global_push_context(&g, OWL_CTX_READCONFIG|OWL_CTX_RECV, NULL, "recv" );608 owl_global_push_context(&g, OWL_CTX_READCONFIG|OWL_CTX_RECV, NULL, "recv", NULL); 619 609 620 610 owl_select_add_pre_select_action(owl_refresh_pre_select_action, NULL, NULL); -
owl.h
rfa65671 r07b59ea 310 310 void *data; /* determined by mode */ 311 311 char *keymap; 312 owl_window *cursor; 312 313 } owl_context; 313 314 -
popexec.c
r68f63a2 r07b59ea 27 27 28 28 owl_popwin_up(pw); 29 owl_global_push_context(&g, OWL_CTX_POPLESS, v, "popless" );29 owl_global_push_context(&g, OWL_CTX_POPLESS, v, "popless", NULL); 30 30 owl_viewwin_init_text(v, owl_popwin_get_content(pw), ""); 31 31 owl_viewwin_set_onclose_hook(v, owl_popexec_viewwin_onclose, pe);
Note: See TracChangeset
for help on using the changeset viewer.