Ticket #661: 0001-Revert-64-bit-fixes-for-input_server.patch

File 0001-Revert-64-bit-fixes-for-input_server.patch, 7.6 KB (added by mt, 4 years ago)
  • src/servers/input/MethodMenuItem.cpp

    From 128e5f0eb0b5bc03d7173bd12e7adad1ad0b31ba Mon Sep 17 00:00:00 2001
    From: Murai Takashi <tmurai01@gmail.com>
    Date: Sat, 5 Sep 2015 17:21:49 +0900
    Subject: [PATCH] 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.
    ---
     src/servers/input/MethodMenuItem.cpp  |  4 ++--
     src/servers/input/MethodMenuItem.h    |  8 +++----
     src/servers/input/MethodReplicant.cpp | 42 +++++++++++++++++------------------
     src/servers/input/MethodReplicant.h   |  2 +-
     4 files changed, 28 insertions(+), 28 deletions(-)
    
    diff --git a/src/servers/input/MethodMenuItem.cpp b/src/servers/input/MethodMenuItem.cpp
    index 5df7b75..67f0ab9 100644
    a b  
    1717#include <string.h>
    1818#include "MethodMenuItem.h"
    1919
    20 MethodMenuItem::MethodMenuItem(void* cookie, const char* name, const uchar* icon, BMenu* subMenu, BMessenger& messenger)
     20MethodMenuItem::MethodMenuItem(int32 cookie, const char* name, const uchar* icon, BMenu* subMenu, BMessenger& messenger)
    2121    : BMenuItem(subMenu),
    2222    fIcon(BRect(0, 0, MENUITEM_ICON_SIZE - 1, MENUITEM_ICON_SIZE - 1), B_CMAP8),
    2323    fCookie(cookie)
    MethodMenuItem::MethodMenuItem(void* cookie, const char* name, const uchar* icon  
    2828}
    2929
    3030
    31 MethodMenuItem::MethodMenuItem(void* cookie, const char* name, const uchar* icon)
     31MethodMenuItem::MethodMenuItem(int32 cookie, const char* name, const uchar* icon)
    3232    : BMenuItem(name, NULL),
    3333    fIcon(BRect(0, 0, MENUITEM_ICON_SIZE - 1, MENUITEM_ICON_SIZE - 1), B_CMAP8),
    3434    fCookie(cookie)
  • src/servers/input/MethodMenuItem.h

    diff --git a/src/servers/input/MethodMenuItem.h b/src/servers/input/MethodMenuItem.h
    index 25aa5c9..f2608db 100644
    a b  
    2424
    2525class MethodMenuItem : public BMenuItem {
    2626    public:
    27         MethodMenuItem(void *cookie, const char *label, const uchar *icon, BMenu *subMenu, BMessenger &messenger);
    28         MethodMenuItem(void *cookie, const char *label, const uchar *icon);
     27        MethodMenuItem(int32 cookie, const char *label, const uchar *icon, BMenu *subMenu, BMessenger &messenger);
     28        MethodMenuItem(int32 cookie, const char *label, const uchar *icon);
    2929
    3030        virtual ~MethodMenuItem();
    3131
    class MethodMenuItem : public BMenuItem {  
    3838        void SetIcon(const uchar *icon);
    3939        const uchar *Icon() { return(uchar *)fIcon.Bits(); };
    4040
    41         void *Cookie() { return fCookie; };
     41        int32 Cookie() { return fCookie; };
    4242    private:
    4343        BBitmap fIcon;
    44         void *fCookie;
     44        int32 fCookie;
    4545        BMessenger fMessenger;
    4646};
    4747
  • src/servers/input/MethodReplicant.cpp

    diff --git a/src/servers/input/MethodReplicant.cpp b/src/servers/input/MethodReplicant.cpp
    index 18823ed..4cf5f7d 100644
    a b MethodReplicant::MouseDown(BPoint point)  
    198198
    199199    if (dynamic_cast<MethodMenuItem*>(item) != NULL) {
    200200        BMessage msg(IS_SET_METHOD);
    201         msg.AddPointer("cookie", ((MethodMenuItem*)item)->Cookie());
     201        msg.AddInt32("cookie", ((MethodMenuItem*)item)->Cookie());
    202202        BMessenger messenger(fSignature);
    203203        messenger.SendMessage(&msg);
    204204    }
    void  
    216216MethodReplicant::UpdateMethod(BMessage* message)
    217217{
    218218    CALLED();
    219     void* cookie;
    220     if (message->FindPointer("cookie", &cookie) != B_OK) {
     219    int32 cookie;
     220    if (message->FindInt32("cookie", &cookie) != B_OK) {
    221221        fprintf(stderr, "can't find cookie in message\n");
    222222        return;
    223223    }
    224224
    225225    MethodMenuItem* item = FindItemByCookie(cookie);
    226226    if (item == NULL) {
    227         fprintf(stderr, "can't find item with cookie %p\n", cookie);
     227        fprintf(stderr, "can't find item with cookie %" B_PRIx32 "\n", cookie);
    228228        return;
    229229    }
    230230    item->SetMarked(true);
    void  
    239239MethodReplicant::UpdateMethodIcon(BMessage* message)
    240240{
    241241    CALLED();
    242     void* cookie;
    243     if (message->FindPointer("cookie", &cookie) != B_OK) {
     242    int32 cookie;
     243    if (message->FindInt32("cookie", &cookie) != B_OK) {
    244244        fprintf(stderr, "can't find cookie in message\n");
    245245        return;
    246246    }
    MethodReplicant::UpdateMethodIcon(BMessage* message)  
    255255
    256256    MethodMenuItem* item = FindItemByCookie(cookie);
    257257    if (item == NULL) {
    258         fprintf(stderr, "can't find item with cookie %p\n", cookie);
     258        fprintf(stderr, "can't find item with cookie %" B_PRIx32 "\n", cookie);
    259259        return;
    260260    }
    261261
    void  
    267267MethodReplicant::UpdateMethodMenu(BMessage* message)
    268268{
    269269    CALLED();
    270     void* cookie;
    271     if (message->FindPointer("cookie", &cookie) != B_OK) {
     270    int32 cookie;
     271    if (message->FindInt32("cookie", &cookie) != B_OK) {
    272272        fprintf(stderr, "can't find cookie in message\n");
    273273        return;
    274274    }
    MethodReplicant::UpdateMethodMenu(BMessage* message)  
    294294
    295295    MethodMenuItem* item = FindItemByCookie(cookie);
    296296    if (item == NULL) {
    297         fprintf(stderr, "can't find item with cookie %p\n", cookie);
     297        fprintf(stderr, "can't find item with cookie %" B_PRIx32 "\n", cookie);
    298298        return;
    299299    }
    300300    int32 index = fMenu.IndexOf(item);
    void  
    317317MethodReplicant::UpdateMethodName(BMessage* message)
    318318{
    319319    CALLED();
    320     void* cookie;
    321     if (message->FindPointer("cookie", &cookie) != B_OK) {
     320    int32 cookie;
     321    if (message->FindInt32("cookie", &cookie) != B_OK) {
    322322        fprintf(stderr, "can't find cookie in message\n");
    323323        return;
    324324    }
    MethodReplicant::UpdateMethodName(BMessage* message)  
    331331
    332332    MethodMenuItem* item = FindItemByCookie(cookie);
    333333    if (item == NULL) {
    334         fprintf(stderr, "can't find item with cookie %p\n", cookie);
     334        fprintf(stderr, "can't find item with cookie %" B_PRIx32 "\n", cookie);
    335335        return;
    336336    }
    337337
    MethodReplicant::UpdateMethodName(BMessage* message)  
    340340
    341341
    342342MethodMenuItem*
    343 MethodReplicant::FindItemByCookie(void* cookie)
     343MethodReplicant::FindItemByCookie(int32 cookie)
    344344{
    345345    for (int32 i = 0; i < fMenu.CountItems(); i++) {
    346346        MethodMenuItem* item = (MethodMenuItem*)fMenu.ItemAt(i);
    347         PRINT(("cookie : %p\n", item->Cookie()));
     347        PRINT(("cookie : 0x%" B_PRIx32 "\n", item->Cookie()));
    348348        if (item->Cookie() == cookie)
    349349            return item;
    350350    }
    void  
    357357MethodReplicant::AddMethod(BMessage* message)
    358358{
    359359    CALLED();
    360     void* cookie;
    361     if (message->FindPointer("cookie", &cookie) != B_OK) {
     360    int32 cookie;
     361    if (message->FindInt32("cookie", &cookie) != B_OK) {
    362362        fprintf(stderr, "can't find cookie in message\n");
    363363        return;
    364364    }
    MethodReplicant::AddMethod(BMessage* message)  
    379379
    380380    MethodMenuItem* item = FindItemByCookie(cookie);
    381381    if (item != NULL) {
    382         fprintf(stderr, "item with cookie %p already exists\n", cookie);
     382        fprintf(stderr, "item with cookie %" B_PRIx32 " already exists\n", cookie);
    383383        return;
    384384    }
    385385
    void  
    396396MethodReplicant::RemoveMethod(BMessage* message)
    397397{
    398398    CALLED();
    399     void* cookie;
    400     if (message->FindPointer("cookie", &cookie) != B_OK) {
     399    int32 cookie;
     400    if (message->FindInt32("cookie", &cookie) != B_OK) {
    401401        fprintf(stderr, "can't find cookie in message\n");
    402402        return;
    403403    }
    404404
    405405    MethodMenuItem* item = FindItemByCookie(cookie);
    406406    if (item == NULL) {
    407         fprintf(stderr, "can't find item with cookie %p\n", cookie);
     407        fprintf(stderr, "can't find item with cookie %" B_PRIx32 "\n", cookie);
    408408        return;
    409409    }
    410410    fMenu.RemoveItem(item);
  • src/servers/input/MethodReplicant.h

    diff --git a/src/servers/input/MethodReplicant.h b/src/servers/input/MethodReplicant.h
    index d40c704..b826fba 100644
    a b class MethodReplicant : public BView {  
    5757        void UpdateMethodName(BMessage *);
    5858        void AddMethod(BMessage *message);
    5959        void RemoveMethod(BMessage *message);
    60         MethodMenuItem *FindItemByCookie(void *cookie);
     60        MethodMenuItem *FindItemByCookie(int32 cookie);
    6161};
    6262
    6363#endif