Revert 64-bit fixes for input_server.
This patch reverts http://cgit.haiku-os.org/haiku/diff/?id=57ab0395ad31761e27ef6d5aa3af68cc3e4d71b2 It may fix #661. Thanks to kcg369 for pointing it out. Signed-off-by: Adrien Destugues <[email protected]> The initial issue was the storage of a pointer in an int32 for input method cookies. This was fixed in two ways: - The int32 was initally replaced with a void*, which allowed to store a complete pointer, but changed the format of the BMessages used for communication, breaking Canna. - Then, the code was changed to not use a pointer and instead use an int32 for the cookie (see #8831). However, the int32 was still cast into a void* when putting it into a BMessage, so the problem was still there for Canna. This commit reverts the remaining parts of the initial solution and restores the ABI to use int32 everywhere. Fixes #661.
This commit is contained in:
committed by
Adrien Destugues
parent
f8c5cdace0
commit
c90d3c9d9f
@@ -17,7 +17,7 @@
|
||||
#include <string.h>
|
||||
#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)
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ MethodReplicant::MouseDown(BPoint point)
|
||||
|
||||
if (dynamic_cast<MethodMenuItem*>(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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user