* Added get_uint32_color() again, the previous "hack" doesn't compile
on GCC 4. * Fixed buggy scripting error responses: "error" is only included on error, and B_ERROR (-1) can hardly be a candidate for the BMessage::what field (uint32). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18490 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+29
-16
@@ -90,6 +90,16 @@ static property_info sViewPropInfo[] = {
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
static inline uint32
|
||||||
|
get_uint32_color(rgb_color color)
|
||||||
|
{
|
||||||
|
return *(uint32 *)&color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
ViewState::ViewState()
|
ViewState::ViewState()
|
||||||
@@ -451,13 +461,13 @@ BView::Archive(BMessage *data, bool deep) const
|
|||||||
|
|
||||||
// colors
|
// colors
|
||||||
if (ret == B_OK)
|
if (ret == B_OK)
|
||||||
ret = data->AddInt32("_color", (const uint32 &)HighColor());
|
ret = data->AddInt32("_color", get_uint32_color(HighColor()));
|
||||||
|
|
||||||
if (ret == B_OK)
|
if (ret == B_OK)
|
||||||
ret = data->AddInt32("_color", (const uint32 &)LowColor());
|
ret = data->AddInt32("_color", get_uint32_color(LowColor()));
|
||||||
|
|
||||||
if (ret == B_OK)
|
if (ret == B_OK)
|
||||||
ret = data->AddInt32("_color", (const uint32 &)ViewColor());
|
ret = data->AddInt32("_color", get_uint32_color(ViewColor()));
|
||||||
|
|
||||||
// NOTE: we do not use this flag any more
|
// NOTE: we do not use this flag any more
|
||||||
// if ( 1 ){
|
// if ( 1 ){
|
||||||
@@ -3562,18 +3572,18 @@ BView::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
|
|||||||
return BHandler::ResolveSpecifier(msg, index, specifier, what, property);
|
return BHandler::ResolveSpecifier(msg, index, specifier, what, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == B_BAD_SCRIPT_SYNTAX) {
|
if (err < B_OK) {
|
||||||
replyMsg.what = B_MESSAGE_NOT_UNDERSTOOD;
|
replyMsg.what = B_MESSAGE_NOT_UNDERSTOOD;
|
||||||
replyMsg.AddString("message", "Didn't understand the specifier(s)");
|
replyMsg.AddInt32("error", err);
|
||||||
} else if (err < B_OK) {
|
|
||||||
replyMsg.what = B_ERROR;
|
if (err == B_BAD_SCRIPT_SYNTAX)
|
||||||
replyMsg.AddString("message", strerror(err));
|
replyMsg.AddString("message", "Didn't understand the specifier(s)");
|
||||||
|
else
|
||||||
|
replyMsg.AddString("message", strerror(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
replyMsg.AddInt32("error", err);
|
|
||||||
msg->SendReply(&replyMsg);
|
msg->SendReply(&replyMsg);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3642,6 +3652,8 @@ BView::MessageReceived(BMessage *msg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scripting message
|
||||||
|
|
||||||
BMessage replyMsg(B_REPLY);
|
BMessage replyMsg(B_REPLY);
|
||||||
status_t err = B_BAD_SCRIPT_SYNTAX;
|
status_t err = B_BAD_SCRIPT_SYNTAX;
|
||||||
int32 index;
|
int32 index;
|
||||||
@@ -3686,15 +3698,16 @@ BView::MessageReceived(BMessage *msg)
|
|||||||
return BHandler::MessageReceived(msg);
|
return BHandler::MessageReceived(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == B_BAD_SCRIPT_SYNTAX) {
|
if (err < B_OK) {
|
||||||
replyMsg.what = B_MESSAGE_NOT_UNDERSTOOD;
|
replyMsg.what = B_MESSAGE_NOT_UNDERSTOOD;
|
||||||
replyMsg.AddString("message", "Didn't understand the specifier(s)");
|
replyMsg.AddInt32("error", err);
|
||||||
} else if (err < B_OK) {
|
|
||||||
replyMsg.what = B_ERROR;
|
if (err == B_BAD_SCRIPT_SYNTAX)
|
||||||
replyMsg.AddString("message", strerror(err));
|
replyMsg.AddString("message", "Didn't understand the specifier(s)");
|
||||||
|
else
|
||||||
|
replyMsg.AddString("message", strerror(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
replyMsg.AddInt32("error", err);
|
|
||||||
msg->SendReply(&replyMsg);
|
msg->SendReply(&replyMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user