source: editcontext.c @ 0de04fa

release-1.10release-1.8release-1.9
Last change on this file since 0de04fa was 6829afc, checked in by David Benjamin <davidben@mit.edu>, 13 years ago
Define CALLER_OWN macro Replace our exising uses of G_GNUC_WARN_UNUSED_RESULT with it. The old macro is just way too long. This also more clearly specifies the intent.
  • Property mode set to 100644
File size: 891 bytes
RevLine 
[c394de8]1#include "owl.h"
2
3#include <assert.h>
4
5bool owl_is_editcontext(const owl_context *ctx)
6{
7  return owl_context_matches(ctx, OWL_CTX_TYPWIN);
8}
9
[6829afc]10CALLER_OWN owl_context *owl_editcontext_new(int mode, owl_editwin *e, const char *keymap, void (*deactivate_cb)(owl_context*), void *cbdata)
[c394de8]11{
12  owl_context *ctx = owl_context_new(mode, owl_editwin_ref(e), keymap,
13                                     owl_editwin_get_window(e));
[4a41f16]14  ctx->deactivate_cb = deactivate_cb;
[c394de8]15  ctx->delete_cb = owl_editcontext_delete_cb;
[4a41f16]16  ctx->cbdata = cbdata;
[c394de8]17  /* TODO: the flags are really screwy. */
18  assert(owl_is_editcontext(ctx));
19  return ctx;
20}
21
22owl_editwin *owl_editcontext_get_editwin(const owl_context *ctx)
23{
24  if (!owl_is_editcontext(ctx)) return NULL;
25  return ctx->data;
26}
27
28void owl_editcontext_delete_cb(owl_context *ctx)
29{
30  if (owl_is_editcontext(ctx) && ctx->data) {
31    owl_editwin_unref(ctx->data);
32    ctx->data = NULL;
33  }
34}
Note: See TracBrowser for help on using the repository browser.