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
|
|
17 | 17 | #include <string.h> |
18 | 18 | #include "MethodMenuItem.h" |
19 | 19 | |
20 | | MethodMenuItem::MethodMenuItem(void* cookie, const char* name, const uchar* icon, BMenu* subMenu, BMessenger& messenger) |
| 20 | MethodMenuItem::MethodMenuItem(int32 cookie, const char* name, const uchar* icon, BMenu* subMenu, BMessenger& messenger) |
21 | 21 | : BMenuItem(subMenu), |
22 | 22 | fIcon(BRect(0, 0, MENUITEM_ICON_SIZE - 1, MENUITEM_ICON_SIZE - 1), B_CMAP8), |
23 | 23 | fCookie(cookie) |
… |
… |
MethodMenuItem::MethodMenuItem(void* cookie, const char* name, const uchar* icon
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | | MethodMenuItem::MethodMenuItem(void* cookie, const char* name, const uchar* icon) |
| 31 | MethodMenuItem::MethodMenuItem(int32 cookie, const char* name, const uchar* icon) |
32 | 32 | : BMenuItem(name, NULL), |
33 | 33 | fIcon(BRect(0, 0, MENUITEM_ICON_SIZE - 1, MENUITEM_ICON_SIZE - 1), B_CMAP8), |
34 | 34 | fCookie(cookie) |
diff --git a/src/servers/input/MethodMenuItem.h b/src/servers/input/MethodMenuItem.h
index 25aa5c9..f2608db 100644
a
|
b
|
|
24 | 24 | |
25 | 25 | class MethodMenuItem : public BMenuItem { |
26 | 26 | 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); |
29 | 29 | |
30 | 30 | virtual ~MethodMenuItem(); |
31 | 31 | |
… |
… |
class MethodMenuItem : public BMenuItem {
|
38 | 38 | void SetIcon(const uchar *icon); |
39 | 39 | const uchar *Icon() { return(uchar *)fIcon.Bits(); }; |
40 | 40 | |
41 | | void *Cookie() { return fCookie; }; |
| 41 | int32 Cookie() { return fCookie; }; |
42 | 42 | private: |
43 | 43 | BBitmap fIcon; |
44 | | void *fCookie; |
| 44 | int32 fCookie; |
45 | 45 | BMessenger fMessenger; |
46 | 46 | }; |
47 | 47 | |
diff --git a/src/servers/input/MethodReplicant.cpp b/src/servers/input/MethodReplicant.cpp
index 18823ed..4cf5f7d 100644
a
|
b
|
MethodReplicant::MouseDown(BPoint point)
|
198 | 198 | |
199 | 199 | if (dynamic_cast<MethodMenuItem*>(item) != NULL) { |
200 | 200 | BMessage msg(IS_SET_METHOD); |
201 | | msg.AddPointer("cookie", ((MethodMenuItem*)item)->Cookie()); |
| 201 | msg.AddInt32("cookie", ((MethodMenuItem*)item)->Cookie()); |
202 | 202 | BMessenger messenger(fSignature); |
203 | 203 | messenger.SendMessage(&msg); |
204 | 204 | } |
… |
… |
void
|
216 | 216 | MethodReplicant::UpdateMethod(BMessage* message) |
217 | 217 | { |
218 | 218 | CALLED(); |
219 | | void* cookie; |
220 | | if (message->FindPointer("cookie", &cookie) != B_OK) { |
| 219 | int32 cookie; |
| 220 | if (message->FindInt32("cookie", &cookie) != B_OK) { |
221 | 221 | fprintf(stderr, "can't find cookie in message\n"); |
222 | 222 | return; |
223 | 223 | } |
224 | 224 | |
225 | 225 | MethodMenuItem* item = FindItemByCookie(cookie); |
226 | 226 | 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); |
228 | 228 | return; |
229 | 229 | } |
230 | 230 | item->SetMarked(true); |
… |
… |
void
|
239 | 239 | MethodReplicant::UpdateMethodIcon(BMessage* message) |
240 | 240 | { |
241 | 241 | CALLED(); |
242 | | void* cookie; |
243 | | if (message->FindPointer("cookie", &cookie) != B_OK) { |
| 242 | int32 cookie; |
| 243 | if (message->FindInt32("cookie", &cookie) != B_OK) { |
244 | 244 | fprintf(stderr, "can't find cookie in message\n"); |
245 | 245 | return; |
246 | 246 | } |
… |
… |
MethodReplicant::UpdateMethodIcon(BMessage* message)
|
255 | 255 | |
256 | 256 | MethodMenuItem* item = FindItemByCookie(cookie); |
257 | 257 | 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); |
259 | 259 | return; |
260 | 260 | } |
261 | 261 | |
… |
… |
void
|
267 | 267 | MethodReplicant::UpdateMethodMenu(BMessage* message) |
268 | 268 | { |
269 | 269 | CALLED(); |
270 | | void* cookie; |
271 | | if (message->FindPointer("cookie", &cookie) != B_OK) { |
| 270 | int32 cookie; |
| 271 | if (message->FindInt32("cookie", &cookie) != B_OK) { |
272 | 272 | fprintf(stderr, "can't find cookie in message\n"); |
273 | 273 | return; |
274 | 274 | } |
… |
… |
MethodReplicant::UpdateMethodMenu(BMessage* message)
|
294 | 294 | |
295 | 295 | MethodMenuItem* item = FindItemByCookie(cookie); |
296 | 296 | 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); |
298 | 298 | return; |
299 | 299 | } |
300 | 300 | int32 index = fMenu.IndexOf(item); |
… |
… |
void
|
317 | 317 | MethodReplicant::UpdateMethodName(BMessage* message) |
318 | 318 | { |
319 | 319 | CALLED(); |
320 | | void* cookie; |
321 | | if (message->FindPointer("cookie", &cookie) != B_OK) { |
| 320 | int32 cookie; |
| 321 | if (message->FindInt32("cookie", &cookie) != B_OK) { |
322 | 322 | fprintf(stderr, "can't find cookie in message\n"); |
323 | 323 | return; |
324 | 324 | } |
… |
… |
MethodReplicant::UpdateMethodName(BMessage* message)
|
331 | 331 | |
332 | 332 | MethodMenuItem* item = FindItemByCookie(cookie); |
333 | 333 | 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); |
335 | 335 | return; |
336 | 336 | } |
337 | 337 | |
… |
… |
MethodReplicant::UpdateMethodName(BMessage* message)
|
340 | 340 | |
341 | 341 | |
342 | 342 | MethodMenuItem* |
343 | | MethodReplicant::FindItemByCookie(void* cookie) |
| 343 | MethodReplicant::FindItemByCookie(int32 cookie) |
344 | 344 | { |
345 | 345 | for (int32 i = 0; i < fMenu.CountItems(); i++) { |
346 | 346 | MethodMenuItem* item = (MethodMenuItem*)fMenu.ItemAt(i); |
347 | | PRINT(("cookie : %p\n", item->Cookie())); |
| 347 | PRINT(("cookie : 0x%" B_PRIx32 "\n", item->Cookie())); |
348 | 348 | if (item->Cookie() == cookie) |
349 | 349 | return item; |
350 | 350 | } |
… |
… |
void
|
357 | 357 | MethodReplicant::AddMethod(BMessage* message) |
358 | 358 | { |
359 | 359 | CALLED(); |
360 | | void* cookie; |
361 | | if (message->FindPointer("cookie", &cookie) != B_OK) { |
| 360 | int32 cookie; |
| 361 | if (message->FindInt32("cookie", &cookie) != B_OK) { |
362 | 362 | fprintf(stderr, "can't find cookie in message\n"); |
363 | 363 | return; |
364 | 364 | } |
… |
… |
MethodReplicant::AddMethod(BMessage* message)
|
379 | 379 | |
380 | 380 | MethodMenuItem* item = FindItemByCookie(cookie); |
381 | 381 | 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); |
383 | 383 | return; |
384 | 384 | } |
385 | 385 | |
… |
… |
void
|
396 | 396 | MethodReplicant::RemoveMethod(BMessage* message) |
397 | 397 | { |
398 | 398 | CALLED(); |
399 | | void* cookie; |
400 | | if (message->FindPointer("cookie", &cookie) != B_OK) { |
| 399 | int32 cookie; |
| 400 | if (message->FindInt32("cookie", &cookie) != B_OK) { |
401 | 401 | fprintf(stderr, "can't find cookie in message\n"); |
402 | 402 | return; |
403 | 403 | } |
404 | 404 | |
405 | 405 | MethodMenuItem* item = FindItemByCookie(cookie); |
406 | 406 | 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); |
408 | 408 | return; |
409 | 409 | } |
410 | 410 | fMenu.RemoveItem(item); |
diff --git a/src/servers/input/MethodReplicant.h b/src/servers/input/MethodReplicant.h
index d40c704..b826fba 100644
a
|
b
|
class MethodReplicant : public BView {
|
57 | 57 | void UpdateMethodName(BMessage *); |
58 | 58 | void AddMethod(BMessage *message); |
59 | 59 | void RemoveMethod(BMessage *message); |
60 | | MethodMenuItem *FindItemByCookie(void *cookie); |
| 60 | MethodMenuItem *FindItemByCookie(int32 cookie); |
61 | 61 | }; |
62 | 62 | |
63 | 63 | #endif |