void set_ui_color(const color_which &which, const rgb_color &color) { int32 index = color_which_to_index(which); if (index < 0 || index >= kColorWhichCount) { fprintf(stderr, "set_ui_color(): unknown color_which %d\n", which); return; } if (ui_color(which) == color) return; BPrivate::DesktopLink link; link.StartMessage(AS_SET_UI_COLOR); link.Attach<color_which>(which); link.Attach<rgb_color>(color); link.Flush(); }
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(); }
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(); }