diff --git a/src/servers/input/MethodMenuItem.cpp b/src/servers/input/MethodMenuItem.cpp index 5df7b75f8a..67f0ab9189 100644 --- a/src/servers/input/MethodMenuItem.cpp +++ b/src/servers/input/MethodMenuItem.cpp @@ -17,7 +17,7 @@ #include #include "MethodMenuItem.h" -MethodMenuItem::MethodMenuItem(void* cookie, const char* name, const uchar* icon, BMenu* subMenu, BMessenger& messenger) +MethodMenuItem::MethodMenuItem(int32 cookie, const char* name, const uchar* icon, BMenu* subMenu, BMessenger& messenger) : BMenuItem(subMenu), fIcon(BRect(0, 0, MENUITEM_ICON_SIZE - 1, MENUITEM_ICON_SIZE - 1), B_CMAP8), fCookie(cookie) @@ -28,7 +28,7 @@ MethodMenuItem::MethodMenuItem(void* cookie, const char* name, const uchar* icon } -MethodMenuItem::MethodMenuItem(void* cookie, const char* name, const uchar* icon) +MethodMenuItem::MethodMenuItem(int32 cookie, const char* name, const uchar* icon) : BMenuItem(name, NULL), fIcon(BRect(0, 0, MENUITEM_ICON_SIZE - 1, MENUITEM_ICON_SIZE - 1), B_CMAP8), fCookie(cookie) diff --git a/src/servers/input/MethodMenuItem.h b/src/servers/input/MethodMenuItem.h index 25aa5c90dd..f2608dbdc3 100644 --- a/src/servers/input/MethodMenuItem.h +++ b/src/servers/input/MethodMenuItem.h @@ -24,8 +24,8 @@ class MethodMenuItem : public BMenuItem { public: - MethodMenuItem(void *cookie, const char *label, const uchar *icon, BMenu *subMenu, BMessenger &messenger); - MethodMenuItem(void *cookie, const char *label, const uchar *icon); + MethodMenuItem(int32 cookie, const char *label, const uchar *icon, BMenu *subMenu, BMessenger &messenger); + MethodMenuItem(int32 cookie, const char *label, const uchar *icon); virtual ~MethodMenuItem(); @@ -38,10 +38,10 @@ class MethodMenuItem : public BMenuItem { void SetIcon(const uchar *icon); const uchar *Icon() { return(uchar *)fIcon.Bits(); }; - void *Cookie() { return fCookie; }; + int32 Cookie() { return fCookie; }; private: BBitmap fIcon; - void *fCookie; + int32 fCookie; BMessenger fMessenger; }; diff --git a/src/servers/input/MethodReplicant.cpp b/src/servers/input/MethodReplicant.cpp index 601b57aa2c..d55b85495e 100644 --- a/src/servers/input/MethodReplicant.cpp +++ b/src/servers/input/MethodReplicant.cpp @@ -198,7 +198,7 @@ MethodReplicant::MouseDown(BPoint point) if (dynamic_cast(item) != NULL) { BMessage msg(IS_SET_METHOD); - msg.AddPointer("cookie", ((MethodMenuItem*)item)->Cookie()); + msg.AddInt32("cookie", ((MethodMenuItem*)item)->Cookie()); BMessenger messenger(fSignature); messenger.SendMessage(&msg); } @@ -216,15 +216,15 @@ void MethodReplicant::UpdateMethod(BMessage* message) { CALLED(); - void* cookie; - if (message->FindPointer("cookie", &cookie) != B_OK) { + int32 cookie; + if (message->FindInt32("cookie", &cookie) != B_OK) { fprintf(stderr, "can't find cookie in message\n"); return; } MethodMenuItem* item = FindItemByCookie(cookie); if (item == NULL) { - fprintf(stderr, "can't find item with cookie %p\n", cookie); + fprintf(stderr, "can't find item with cookie %" B_PRIx32 "\n", cookie); return; } item->SetMarked(true); @@ -239,8 +239,8 @@ void MethodReplicant::UpdateMethodIcon(BMessage* message) { CALLED(); - void* cookie; - if (message->FindPointer("cookie", &cookie) != B_OK) { + int32 cookie; + if (message->FindInt32("cookie", &cookie) != B_OK) { fprintf(stderr, "can't find cookie in message\n"); return; } @@ -255,7 +255,7 @@ MethodReplicant::UpdateMethodIcon(BMessage* message) MethodMenuItem* item = FindItemByCookie(cookie); if (item == NULL) { - fprintf(stderr, "can't find item with cookie %p\n", cookie); + fprintf(stderr, "can't find item with cookie %" B_PRIx32 "\n", cookie); return; } @@ -267,8 +267,8 @@ void MethodReplicant::UpdateMethodMenu(BMessage* message) { CALLED(); - void* cookie; - if (message->FindPointer("cookie", &cookie) != B_OK) { + int32 cookie; + if (message->FindInt32("cookie", &cookie) != B_OK) { fprintf(stderr, "can't find cookie in message\n"); return; } @@ -294,7 +294,7 @@ MethodReplicant::UpdateMethodMenu(BMessage* message) MethodMenuItem* item = FindItemByCookie(cookie); if (item == NULL) { - fprintf(stderr, "can't find item with cookie %p\n", cookie); + fprintf(stderr, "can't find item with cookie %" B_PRIx32 "\n", cookie); return; } int32 index = fMenu.IndexOf(item); @@ -317,8 +317,8 @@ void MethodReplicant::UpdateMethodName(BMessage* message) { CALLED(); - void* cookie; - if (message->FindPointer("cookie", &cookie) != B_OK) { + int32 cookie; + if (message->FindInt32("cookie", &cookie) != B_OK) { fprintf(stderr, "can't find cookie in message\n"); return; } @@ -331,7 +331,7 @@ MethodReplicant::UpdateMethodName(BMessage* message) MethodMenuItem* item = FindItemByCookie(cookie); if (item == NULL) { - fprintf(stderr, "can't find item with cookie %p\n", cookie); + fprintf(stderr, "can't find item with cookie %" B_PRIx32 "\n", cookie); return; } @@ -340,11 +340,11 @@ MethodReplicant::UpdateMethodName(BMessage* message) MethodMenuItem* -MethodReplicant::FindItemByCookie(void* cookie) +MethodReplicant::FindItemByCookie(int32 cookie) { for (int32 i = 0; i < fMenu.CountItems(); i++) { MethodMenuItem* item = (MethodMenuItem*)fMenu.ItemAt(i); - PRINT(("cookie : %p\n", item->Cookie())); + PRINT(("cookie : 0x%" B_PRIx32 "\n", item->Cookie())); if (item->Cookie() == cookie) return item; } @@ -357,8 +357,8 @@ void MethodReplicant::AddMethod(BMessage* message) { CALLED(); - void* cookie; - if (message->FindPointer("cookie", &cookie) != B_OK) { + int32 cookie; + if (message->FindInt32("cookie", &cookie) != B_OK) { fprintf(stderr, "can't find cookie in message\n"); return; } @@ -379,7 +379,7 @@ MethodReplicant::AddMethod(BMessage* message) MethodMenuItem* item = FindItemByCookie(cookie); if (item != NULL) { - fprintf(stderr, "item with cookie %p already exists\n", cookie); + fprintf(stderr, "item with cookie %" B_PRIx32 " already exists\n", cookie); return; } @@ -396,15 +396,15 @@ void MethodReplicant::RemoveMethod(BMessage* message) { CALLED(); - void* cookie; - if (message->FindPointer("cookie", &cookie) != B_OK) { + int32 cookie; + if (message->FindInt32("cookie", &cookie) != B_OK) { fprintf(stderr, "can't find cookie in message\n"); return; } MethodMenuItem* item = FindItemByCookie(cookie); if (item == NULL) { - fprintf(stderr, "can't find item with cookie %p\n", cookie); + fprintf(stderr, "can't find item with cookie %" B_PRIx32 "\n", cookie); return; } fMenu.RemoveItem(item); diff --git a/src/servers/input/MethodReplicant.h b/src/servers/input/MethodReplicant.h index d40c704b98..b826fba17c 100644 --- a/src/servers/input/MethodReplicant.h +++ b/src/servers/input/MethodReplicant.h @@ -57,7 +57,7 @@ class MethodReplicant : public BView { void UpdateMethodName(BMessage *); void AddMethod(BMessage *message); void RemoveMethod(BMessage *message); - MethodMenuItem *FindItemByCookie(void *cookie); + MethodMenuItem *FindItemByCookie(int32 cookie); }; #endif