applied a patch from barber for bug #661. Thanks! This fixes a weird behavior when using the menu
minor cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18093 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2205ee0914
commit
e2d5e00981
@ -182,11 +182,12 @@ MethodReplicant::MouseDown(BPoint point)
|
|||||||
where = ConvertToScreen(point);
|
where = ConvertToScreen(point);
|
||||||
|
|
||||||
fMenu.SetTargetForItems(this);
|
fMenu.SetTargetForItems(this);
|
||||||
MethodMenuItem *item = (MethodMenuItem*)fMenu.Go(where, true, true, BRect(where - BPoint(4, 4),
|
BMenuItem *item = fMenu.Go(where, true, true,
|
||||||
where + BPoint(4, 4)));
|
BRect(where - BPoint(4, 4), where + BPoint(4, 4)));
|
||||||
if (item) {
|
|
||||||
|
if (item && dynamic_cast<MethodMenuItem *>(item)) {
|
||||||
BMessage msg(IS_SET_METHOD);
|
BMessage msg(IS_SET_METHOD);
|
||||||
msg.AddInt32("cookie", item->Cookie());
|
msg.AddInt32("cookie", ((MethodMenuItem*)item)->Cookie());
|
||||||
BMessenger messenger(fSignature);
|
BMessenger messenger(fSignature);
|
||||||
messenger.SendMessage(&msg);
|
messenger.SendMessage(&msg);
|
||||||
}
|
}
|
||||||
@ -205,16 +206,16 @@ MethodReplicant::UpdateMethod(BMessage *message)
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
int32 cookie;
|
int32 cookie;
|
||||||
if (message->FindInt32("cookie", &cookie)!=B_OK) {
|
if (message->FindInt32("cookie", &cookie)!=B_OK) {
|
||||||
fprintf(stderr, "can't find cookie in message\n");
|
fprintf(stderr, "can't find cookie in message\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MethodMenuItem *item = FindItemByCookie(cookie);
|
MethodMenuItem *item = FindItemByCookie(cookie);
|
||||||
if (item == NULL) {
|
if (item == NULL) {
|
||||||
fprintf(stderr, "can't find item with cookie %lx\n", cookie);
|
fprintf(stderr, "can't find item with cookie %lx\n", cookie);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
|
|
||||||
fSegments->SetBits(item->Icon(), kRemoteWidth*kRemoteHeight, 0, kRemoteColorSpace);
|
fSegments->SetBits(item->Icon(), kRemoteWidth*kRemoteHeight, 0, kRemoteColorSpace);
|
||||||
@ -262,15 +263,15 @@ MethodReplicant::UpdateMethodMenu(BMessage *message)
|
|||||||
BMessage msg;
|
BMessage msg;
|
||||||
if (message->FindMessage("menu", &msg)!=B_OK) {
|
if (message->FindMessage("menu", &msg)!=B_OK) {
|
||||||
fprintf(stderr, "can't find menu in message\n");
|
fprintf(stderr, "can't find menu in message\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PRINT_OBJECT(msg);
|
PRINT_OBJECT(msg);
|
||||||
|
|
||||||
BMessenger messenger;
|
BMessenger messenger;
|
||||||
if (message->FindMessenger("target", &messenger)!=B_OK) {
|
if (message->FindMessenger("target", &messenger)!=B_OK) {
|
||||||
fprintf(stderr, "can't find target in message\n");
|
fprintf(stderr, "can't find target in message\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BMenu *menu = (BMenu *)BMenu::Instantiate(&msg);
|
BMenu *menu = (BMenu *)BMenu::Instantiate(&msg);
|
||||||
if (menu == NULL) {
|
if (menu == NULL) {
|
||||||
@ -344,8 +345,8 @@ MethodReplicant::AddMethod(BMessage *message)
|
|||||||
CALLED();
|
CALLED();
|
||||||
int32 cookie;
|
int32 cookie;
|
||||||
if (message->FindInt32("cookie", &cookie)!=B_OK) {
|
if (message->FindInt32("cookie", &cookie)!=B_OK) {
|
||||||
fprintf(stderr, "can't find cookie in message\n");
|
fprintf(stderr, "can't find cookie in message\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *name;
|
const char *name;
|
||||||
|
Loading…
Reference in New Issue
Block a user