Exemplo n.º 1
0
VALUE
subextSubletSend(VALUE self,
  VALUE value)
{
  VALUE id = Qnil;

  /* Check ruby object */
  rb_check_frozen(self);
  GET_ATTR(self, "@id", id);

  /* Check object type */
  if(T_STRING == rb_type(value))
    {
      char *list = NULL;
      SubMessageData data = { { 0, 0, 0, 0, 0 } };

      /* Store data */
      list = strdup(RSTRING_PTR(value));
      subSharedPropertySetStrings(display, DefaultRootWindow(display),
        XInternAtom(display, "SUBTLE_DATA", False), &list, 1);
      free(list);

      data.l[0] = FIX2INT(id);

      subSharedMessage(display, DefaultRootWindow(display),
        "SUBTLE_SUBLET_DATA", data, 32, True);
    }
  else rb_raise(rb_eArgError, "Unexpected value-type `%s'",
    rb_obj_classname(value));

  return self;
} /* }}} */
Exemplo n.º 2
0
Arquivo: panel.c Projeto: guns/subtle
void
subPanelPublish(void)
{
    int i = 0, j = 0, idx = 0;
    char **names = NULL;

    /* Alloc space */
    names = (char **)subSharedMemoryAlloc(subtle->sublets->ndata,
                                          sizeof(char *));

    /* Find sublet in panels */
    for(i = 0; i < subtle->screens->ndata; i++)
    {
        SubScreen *s = SCREEN(subtle->screens->data[i]);

        if(s->panels)
        {
            for(j = 0; j < s->panels->ndata; j++)
            {
                SubPanel *p = PANEL(s->panels->data[j]);

                /* Include sublets, exclude shallow copies */
                if(p->flags & SUB_PANEL_SUBLET && !(p->flags & SUB_PANEL_COPY))
                    names[idx++] = p->sublet->name;
            }
        }
    }

    /* EWMH: Sublet list and windows */
    subSharedPropertySetStrings(subtle->dpy, ROOT,
                                subEwmhGet(SUB_EWMH_SUBTLE_SUBLET_LIST), names, subtle->sublets->ndata);

    subSharedLogDebugSubtle("publish=panel, n=%d\n", subtle->sublets->ndata);

    XSync(subtle->dpy, False); ///< Sync all changes

    free(names);
} /* }}} */