From ca7dc13fd9d14d833cef0ee44f1fd7900eff071d Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Tue, 11 Apr 2006 10:47:38 +0000 Subject: [PATCH] Make ui_color a little more bulletproof. This will mitigate bug #256 until I can track down the reason (probably in the app_server) that the color request fails git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17069 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/InterfaceDefs.cpp | 119 ++++++++++++++------------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/src/kits/interface/InterfaceDefs.cpp b/src/kits/interface/InterfaceDefs.cpp index d580edfbb1..822d370bad 100644 --- a/src/kits/interface/InterfaceDefs.cpp +++ b/src/kits/interface/InterfaceDefs.cpp @@ -686,67 +686,68 @@ mouse_mode() _IMPEXP_BE rgb_color ui_color(color_which which) -{ - if (!be_app) { - switch (which) { - case B_PANEL_BACKGROUND_COLOR: - return make_color(216,216,216); - case B_PANEL_TEXT_COLOR: - return make_color(0,0,0); - case B_DOCUMENT_BACKGROUND_COLOR: - return make_color(255,255,255); - case B_DOCUMENT_TEXT_COLOR: - return make_color(0,0,0); - case B_CONTROL_BACKGROUND_COLOR: - return make_color(245,245,245); - case B_CONTROL_TEXT_COLOR: - return make_color(0,0,0); - case B_CONTROL_BORDER_COLOR: - return make_color(0,0,0); - case B_CONTROL_HIGHLIGHT_COLOR: - return make_color(102, 152, 203); - case B_NAVIGATION_BASE_COLOR: - return make_color(0,0,229); - case B_NAVIGATION_PULSE_COLOR: - return make_color(0,0,0); - case B_SHINE_COLOR: - return make_color(255,255,255); - case B_SHADOW_COLOR: - return make_color(0,0,0); - case B_MENU_BACKGROUND_COLOR: - return make_color(216,216,216); - case B_MENU_SELECTED_BACKGROUND_COLOR: - return make_color(115,120,184); - case B_MENU_ITEM_TEXT_COLOR: - return make_color(0,0,0); - case B_MENU_SELECTED_BORDER_COLOR: - return make_color(0,0,0); - case B_TOOLTIP_BACKGROUND_COLOR: - return make_color(255,255,0); - case B_TOOLTIP_TEXT_COLOR: - return make_color(0,0,0); - case B_SUCCESS_COLOR: - return make_color(0,255,0); - case B_FAILURE_COLOR: - return make_color(255,0,0); - case B_WINDOW_TAB_COLOR: - return make_color(255,0,203); - default: - fprintf(stderr, "ui_color(): unknown color_which %d\n", which); - return make_color(0,0,0); - } +{ + if(be_app) { + + rgb_color color; + BPrivate::AppServerLink link; + link.StartMessage(AS_GET_UI_COLOR); + link.Attach(which); + + int32 code; + if (link.FlushWithReply(code) == B_OK && code == B_OK) { + link.Read(&color); + return color; + } } - rgb_color color; - BPrivate::AppServerLink link; - link.StartMessage(AS_GET_UI_COLOR); - link.Attach(which); - - int32 code; - if (link.FlushWithReply(code) == B_OK && code == B_OK) - link.Read(&color); - - return color; + switch (which) { + case B_PANEL_BACKGROUND_COLOR: + return make_color(216,216,216); + case B_PANEL_TEXT_COLOR: + return make_color(0,0,0); + case B_DOCUMENT_BACKGROUND_COLOR: + return make_color(255,255,255); + case B_DOCUMENT_TEXT_COLOR: + return make_color(0,0,0); + case B_CONTROL_BACKGROUND_COLOR: + return make_color(245,245,245); + case B_CONTROL_TEXT_COLOR: + return make_color(0,0,0); + case B_CONTROL_BORDER_COLOR: + return make_color(0,0,0); + case B_CONTROL_HIGHLIGHT_COLOR: + return make_color(102, 152, 203); + case B_NAVIGATION_BASE_COLOR: + return make_color(0,0,229); + case B_NAVIGATION_PULSE_COLOR: + return make_color(0,0,0); + case B_SHINE_COLOR: + return make_color(255,255,255); + case B_SHADOW_COLOR: + return make_color(0,0,0); + case B_MENU_BACKGROUND_COLOR: + return make_color(216,216,216); + case B_MENU_SELECTED_BACKGROUND_COLOR: + return make_color(115,120,184); + case B_MENU_ITEM_TEXT_COLOR: + return make_color(0,0,0); + case B_MENU_SELECTED_BORDER_COLOR: + return make_color(0,0,0); + case B_TOOLTIP_BACKGROUND_COLOR: + return make_color(255,255,0); + case B_TOOLTIP_TEXT_COLOR: + return make_color(0,0,0); + case B_SUCCESS_COLOR: + return make_color(0,255,0); + case B_FAILURE_COLOR: + return make_color(255,0,0); + case B_WINDOW_TAB_COLOR: + return make_color(255,0,203); + default: + fprintf(stderr, "ui_color(): unknown color_which %d\n", which); + return make_color(0,0,0); + } }