Ejemplo n.º 1
0
static void
handle_top_level(Display * display, Window window,
		 Atom protocols_atom, Atom delete_window_atom)
{
	Atom       *prots;
	int         nprots, j;

	if (has_property(display, window, protocols_atom)) {
		XGetWMProtocols(display, window, &prots, &nprots);

		if (err_occurred)
			return;

		for (j = 0; j < nprots; j++)
			if (prots[j] == delete_window_atom) {
				send_delete_message(display, window,
					 protocols_atom, delete_window_atom);
				break;
			}
		if (j == nprots)	/* delete window not found */
			XKillClient(display, window);

		XFree((caddr_t) prots);
	} else
		XKillClient(display, window);
}
Ejemplo n.º 2
0
bool pim_groupconf_node::set_property(const char *key, const char *value) {
	if (!strcmp(key, "rp")) {
		if (!strcmp(value, "none"))
			return set_property_inst("rp", property_def::VAL_ADDRESS, "::/128");
		else
			return set_property_inst("rp", property_def::VAL_ADDRESS, value);
	} else if (!strcmp(key, "accept_rp")) {
		if (!strcmp(value, "none")) {
			return set_property_inst("rp", property_def::VAL_ADDRESS, "::/128");
		} else if (strcmp(value, "embedded") == 0) {
			inet6_addr tmp;
			if (!pim_group_node::calculate_embedded_rp_addr(((groupconf *)parent())->id(), tmp)) {
				if (pim->should_log(WARNING)) {
					pim->log().writeline("Group doesn't follow Embedded-RP specification, "
							     "changing accept_rp to any.");
				}

				return false;
			}
			/* sigh */
			return set_property_inst("accept_rp", property_def::VAL_ADDRESS,
						 tmp.as_string().c_str());
		}
	} else if (!strcmp(key, "rp_adv")) {
#ifndef PIM_NO_BSR
		bool prev = get_property_bool("rp_adv");

		if (!set_property_inst("rp_adv", property_def::VAL_BOOL, value))
			return false;

		if (prev != get_property_bool("rp_adv"))
			pim->bsr().enable_rp_adv(((groupconf *)parent())->id(), !prev);

		return true;
#else
		return false;
#endif
	} else if (!strcmp(key, "rp-rejected-source-policy")) {
		if (!has_property("rp-rejected-source-policy")) {
			if (!instantiate_property("rp-rejected-source-policy",
						  new propval_enum(rp_rej_entries)))
				return false;
		}
	} else if (!strcmp(key, "rp-embedded-auto-source-acl")) {
		return set_property_inst("rp-embedded-auto-source-acl",
					 property_def::VAL_BOOL, value);
	}

	return groupconf_node::set_property(key, value);
}
Ejemplo n.º 3
0
/* Get the url from a url object, special wrapper.
 * Owner object is passed, look for obj.href, obj.src, or obj.action.
 * Return that if it's a string, or its member href if it is a url.
 * The result, coming from get_property_string, is allocated. */
char *get_property_url(jsobjtype owner, bool action)
{
	enum ej_proptype mtype;	/* member type */
	jsobjtype uo = 0;	/* url object */

	if (action) {
		mtype = has_property(owner, "action");
		if (mtype == EJ_PROP_STRING)
			return get_property_string(owner, "action");
		if (mtype != EJ_PROP_OBJECT)
			return 0;
		uo = get_property_object(owner, "action");
		if (has_property(uo, "actioncrash"))
			return 0;
	} else {
		mtype = has_property(owner, "href");
		if (mtype == EJ_PROP_STRING)
			return get_property_string(owner, "href");
		if (mtype == EJ_PROP_OBJECT)
			uo = get_property_object(owner, "href");
		else if (mtype)
			return 0;
		if (!uo) {
			mtype = has_property(owner, "src");
			if (mtype == EJ_PROP_STRING)
				return get_property_string(owner, "src");
			if (mtype == EJ_PROP_OBJECT)
				uo = get_property_object(owner, "src");
		}
	}

	if (uo == NULL)
		return 0;
/* should this be href$val? */
	return get_property_string(uo, "href");
}				/* get_property_url */
Ejemplo n.º 4
0
void
permute_next(int index)
{
    if (index == D && has_property())
    {
        for (int i = 0; i < D; ++i)
            sum += d[i] * pow(10, D - i - 1);
        return;
    }

    for (int i = 0; i < D; ++i)
    {
        if (legal_digit(i) && !(i == 0 && index == 0))
        {
            d[index] = i;
            permute_next(index + 1);
            d[index] = -1;
        }
    }
}
Ejemplo n.º 5
0
static void
recurse_tree(Display * display, Window window,
	     Atom state_atom, Atom protocols_atom, Atom delete_window_atom)
{
	Window      root, parent, *kids;
	unsigned int nkids;
	int         j;
	int         swm_state;

	for (;;) {
		XQueryTree(display, window, &root, &parent, &kids, &nkids);
		if (err_occurred) {
			err_occurred = False;
			return;
		}
		for (j = 0; j < nkids; j++) {
			swm_state = has_property(display, kids[j], state_atom);

			if (err_occurred)
				break;

			if (swm_state) {
				handle_top_level(display, kids[j], protocols_atom, delete_window_atom);
				if (err_occurred)
					break;
			} else
				recurse_tree(display, kids[j],
					     state_atom, protocols_atom, delete_window_atom);
		}

		XFree((caddr_t) kids);

		/* when I get all the way through a level without an error, I'm done  */

		if (err_occurred)
			err_occurred = False;
		else
			return;

	}
}
Ejemplo n.º 6
0
/* checks if object has property, returning 1 if it or any of it's contents has
   the property stated                                                      */
int
has_property(int descr, dbref player, dbref what, const char *type,
             const char *pclass, int value)
{
    dbref things;

    if (has_property_strict(descr, player, what, type, pclass, value))
        return 1;
    for (things = DBFETCH(what)->contents; things != NOTHING;
         things = DBFETCH(things)->next) {
        if (has_property(descr, player, things, type, pclass, value))
            return 1;
    }
    if (tp_lock_envcheck) {
        things = getparent(what);
        while (things != NOTHING) {
            if (has_property_strict(descr, player, things, type, pclass, value))
                return 1;
            things = getparent(things);
        }
    }
    return 0;
}
Ejemplo n.º 7
0
bool
PortModel::port_property(const std::string& uri) const
{
    return has_property(_uris.lv2_portProperty, Raul::URI(uri));
}
Ejemplo n.º 8
0
bool
PortModel::supports(const Raul::URI& value_type) const
{
    return has_property(_uris.atom_supports, value_type);
}
Ejemplo n.º 9
0
std::string sync_object::property(const std::string &name) const {
  if (!has_property(name))
    return std::string();

  return p_object->m_property_dict.at(name);
}
Ejemplo n.º 10
0
/**
 * \brief Returns a custom properties of this dialog.
 * \param key Key of the property to get. It must exist.
 * \return The value of this property.
 */
const std::string& DialogData::get_property(const std::string& key) const {

  Debug::check_assertion(has_property(key),
    std::string("No such property: '") + key + "'");
  return properties.at(key);
}
Ejemplo n.º 11
0
bool
PortImpl::supports(const Raul::URI& value_type) const
{
	return has_property(_bufs.uris().atom_supports, value_type);
}