[g-a-devel]Question about Accessible_getStateSet?



Hi.

I am developing a small Guile binding for AT-SPI for experimentation
purposes.  While some things are quite nicely working already
(getting the role, name and description of objects),
I can not get the AccessibleStateSet stuff to work.  From looking
at the code, it should, but I always seem to detect a
empty set, even if AccessibleStateSet_isEmpty!=TRUE.

Is there anything special about the StateSets I might have missed?

Below is the code I use to extract an accessible state set
into a Scheme (Guile) list of symbols.  The printf's are in
there in case I messed up the symbol creation, but I never saw
any printf output, even if I recursively look at *every*
object on the whole desktop, like this:

gspi> (define (descend node proc)
... (if (> (length (children node)) 0)
... (map (lambda (node) (descend node proc)) (children node))
... (proc node)))
gspi> (map get-name (children (desktop 0)))
("gnome-session" "nautilus" "gnome-panel" "mixer_applet2" "gnopernicus" "srcore")
gspi> (define gnopi (car (cddddr (children (desktop 0)))))
gspi> gnopi
#<Accessible 0x81118f8, name="gnopernicus", role=application>
gspi> (descend gnopi get-role)
((((push-button push-button push-button push-button push-button push-button push-button push-button))))
gspi> (descend gnopi states)
((((() () () () () () () ()))))

No matter what, I always get a empty list of states.

gspi> (descend (desktop 0) states)
(() ((((((() ((() () () () () () () (() () () () ()) () (() () ()) () () () () () () () () () ()) (() () () () () () () () () () () () () () () () () () () ())(() () () () () () () () () () (() () () () () () () () () ()) () () () () () () () () () () () () () ()) (() () () () () () () () () () () () ()) (() () () ()) () () (() () () ()) (() ())))) ((() ((()) ((() (()))) (()) ((() (()))) (()) (()) (()) () (()) (()) (()) () (())))) ((() (((((((((((()) ())))) () (((() () () () () ()) ()))))) (()))) (())))) (((((() () () ())))))) (())))) ((((() () () () () ((((((())))) (((((() () () ()))))) ((((((() () () ()))))))))))) ((((()) (((() () () () () ()) (() () () () () () () () () () () () () ()) (()) (() ()) (() ()) (() () () () () () () () () () () () () ()) (()) (() () ()) (() () () () ()) () () () () (((() () () () ()) (() () () () () () () () () () () () () () () () () () () () () ()) (()) (() () () () () () ()) (() () () () () () () () () () () () () () () () () () ()) (() () () () () () () () () () () () () () ()) (() () () () () ()) (() () () () () () () ()) (() () () () () () () () () () () () () () () () () () ()) (() () () ()) (() () () () () () () () () () () () () () () () () () ()) ()) (() () () ()) (() () () ()) (() () ()) (() () () ())) (() () ())) (() () () (()) () () () () ())) (() () ((((())))) (((((())))))) (()) (()))))) () ((((() () () () () () () ())))) ())

Does anyone have an idea what I might be doing wrong?

SCM_DEFINE (aobj_stateset, "states", 1, 0, 0, (SCM smob), "")
{
  Accessible *acc;
  AccessibleStateSet *states;
  SCM ret = SCM_EOL;

  SCM_ASSERT (SCM_SMOB_PREDICATE (aobj_tag, smob), smob, SCM_ARG1, "states");

  acc = (Accessible *) SCM_SMOB_DATA (smob);
  states = Accessible_getStateSet (acc);
  if (!states) {
    return SCM_BOOL_F;
  } else if (AccessibleStateSet_isEmpty(states) == FALSE) {
    if (AccessibleStateSet_contains(states, SPI_STATE_INVALID)) {
      printf("invalid\n");
      ret = scm_cons (scm_str2symbol("invalid"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_ACTIVE)) {
      printf("active\n");
      ret = scm_cons (scm_str2symbol("active"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_ARMED)) {
      printf("armed\n");
      ret = scm_cons (scm_str2symbol("armed"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_BUSY)) {
      printf("busy\n");
      ret = scm_cons (scm_str2symbol("busy"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_CHECKED)) {
      printf("checked\n");
      ret = scm_cons (scm_str2symbol("checked"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_COLLAPSED)) {
      printf("collapsed\n");
      ret = scm_cons (scm_str2symbol("collapsed"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_DEFUNCT)) {
      printf("defunct\n");
      ret = scm_cons (scm_str2symbol("defunct"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_EDITABLE)) {
      printf("editable\n");
      ret = scm_cons (scm_str2symbol("editable"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_ENABLED)) {
      printf("enabled\n");
      ret = scm_cons (scm_str2symbol("enabled"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_EXPANDABLE)) {
      printf("expandable\n");
      ret = scm_cons (scm_str2symbol("expandable"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_EXPANDED)) {
      printf("expanded\n");
      ret = scm_cons (scm_str2symbol("expanded"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_FOCUSABLE)) {
      printf("focusable\n");
      ret = scm_cons (scm_str2symbol("focusable"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_FOCUSED)) {
      printf("focused\n");
      ret = scm_cons (scm_str2symbol("focused"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_HORIZONTAL)) {
      printf("horizontal\n");
      ret = scm_cons (scm_str2symbol("horizontal"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_ICONIFIED)) {
      printf("iconified\n");
      ret = scm_cons (scm_str2symbol("iconified"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_MODAL)) {
      printf("modal\n");
      ret = scm_cons (scm_str2symbol("modal"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_MULTI_LINE)) {
      printf("multi_line\n");
      ret = scm_cons (scm_str2symbol("multi_line"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_MULTISELECTABLE)) {
      printf("multiselectable\n");
      ret = scm_cons (scm_str2symbol("multiselectable"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_OPAQUE)) {
      printf("opaque\n");
      ret = scm_cons (scm_str2symbol("opaque"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_PRESSED)) {
      printf("pressed\n");
      ret = scm_cons (scm_str2symbol("pressed"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_RESIZABLE)) {
      printf("resizable\n");
      ret = scm_cons (scm_str2symbol("resizable"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_SELECTABLE)) {
      printf("selectable\n");
      ret = scm_cons (scm_str2symbol("selectable"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_SELECTED)) {
      printf("selected\n");
      ret = scm_cons (scm_str2symbol("selected"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_SENSITIVE)) {
      printf("sensitive\n");
      ret = scm_cons (scm_str2symbol("sensitive"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_SHOWING)) {
      printf("showing\n");
      ret = scm_cons (scm_str2symbol("showing"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_SINGLE_LINE)) {
      printf("single_line\n");
      ret = scm_cons (scm_str2symbol("single_line"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_STALE)) {
      printf("stale\n");
      ret = scm_cons (scm_str2symbol("stale"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_TRANSIENT)) {
      printf("transient\n");
      ret = scm_cons (scm_str2symbol("transient"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_VERTICAL)) {
      printf("vertical\n");
      ret = scm_cons (scm_str2symbol("vertical"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_VISIBLE)) {
      printf("visible\n");
      ret = scm_cons (scm_str2symbol("visible"), ret);
    }
    if (AccessibleStateSet_contains(states, SPI_STATE_MANAGES_DESCENDANTS)) {
      printf("manages_descendants\n");
      ret = scm_cons (scm_str2symbol("manages_descendants"), ret);
    }
  }
  if (states) {
    AccessibleStateSet_unref (states);
  }
  return ret;
}

-- 
CYa,
  Mario | Debian Developer <URL:http://debian.org/>
        | Get my public key via finger mlang db debian org
        | 1024D/7FC1A0854909BCCDBE6C102DDFFC022A6B113E44



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]