status_t
send_debug_message(team_id team, int32 code)
{
	BPrivate::DesktopLink link;

	status_t status = link.InitCheck();
	if (status != B_OK)
		return status;

	// prepare the message
	status = link.StartMessage(code);
	if (status != B_OK)
		return status;

	status = link.Attach(team);
	if (status != B_OK)
		return status;

	// send it
	return link.Flush();
}
示例#2
0
void
set_ui_colors(const BMessage* colors)
{
	if (colors == NULL)
		return;

	int32 count = 0;
	int32 index = 0;
	char* name = NULL;
	type_code type;
	rgb_color color;
	color_which which = B_NO_COLOR;

	BPrivate::DesktopLink desktop;
	if (desktop.InitCheck() != B_OK)
		return;

	desktop.StartMessage(AS_SET_UI_COLORS);
	desktop.Attach<bool>(false);

	// Only colors with names that map to system colors will get through.
	while (colors->GetInfo(B_RGB_32_BIT_TYPE, index, &name, &type) == B_OK) {

		which = which_ui_color(name);
		++index;

		if (which == B_NO_COLOR || colors->FindColor(name, &color) != B_OK)
			continue;

		desktop.Attach<color_which>(which);
		desktop.Attach<rgb_color>(color);
		++count;
	}

	if (count == 0)
		return;

	desktop.Attach<color_which>(B_NO_COLOR);
	desktop.Flush();
}