diff options
| author | Po Lu | 2022-07-28 13:24:10 +0000 |
|---|---|---|
| committer | Po Lu | 2022-07-28 13:25:06 +0000 |
| commit | 977aed9f7981fee0ba9ac8711a86da908fc5057e (patch) | |
| tree | 10d8239c4efb5b249a676d344f0ec101ea423a39 | |
| parent | b8fdef7aa65f5b1d2eeb726ff1627d9e169c2b3a (diff) | |
| download | emacs-977aed9f7981fee0ba9ac8711a86da908fc5057e.tar.gz emacs-977aed9f7981fee0ba9ac8711a86da908fc5057e.zip | |
Fix grab view persisting on Haiku after popup menu closes
* src/haiku_support.cc (BasicMouseUp): Improve handling of
wait_for_release_message.
(be_clear_grab_view): New function.
* src/haiku_support.h: Update prototypes.
* src/haikumenu.c (haiku_menu_show): Call it here.
| -rw-r--r-- | src/haiku_support.cc | 25 | ||||
| -rw-r--r-- | src/haiku_support.h | 1 | ||||
| -rw-r--r-- | src/haikumenu.c | 5 |
3 files changed, 27 insertions, 4 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc index cb378d2d810..b7590f68a48 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc | |||
| @@ -1930,11 +1930,14 @@ public: | |||
| 1930 | button = (grabbed_buttons & ~buttons); | 1930 | button = (grabbed_buttons & ~buttons); |
| 1931 | grabbed_buttons = buttons; | 1931 | grabbed_buttons = buttons; |
| 1932 | 1932 | ||
| 1933 | if (!grabbed_buttons && wait_for_release_message) | 1933 | if (wait_for_release_message) |
| 1934 | { | 1934 | { |
| 1935 | wait_for_release_message->SendReply (wait_for_release_message); | 1935 | if (!grabbed_buttons) |
| 1936 | delete wait_for_release_message; | 1936 | { |
| 1937 | wait_for_release_message = NULL; | 1937 | wait_for_release_message->SendReply (wait_for_release_message); |
| 1938 | delete wait_for_release_message; | ||
| 1939 | wait_for_release_message = NULL; | ||
| 1940 | } | ||
| 1938 | 1941 | ||
| 1939 | return; | 1942 | return; |
| 1940 | } | 1943 | } |
| @@ -5457,3 +5460,17 @@ be_get_explicit_workarea (int *x, int *y, int *width, int *height) | |||
| 5457 | 5460 | ||
| 5458 | return true; | 5461 | return true; |
| 5459 | } | 5462 | } |
| 5463 | |||
| 5464 | /* Clear the grab view. This has to be called manually from some | ||
| 5465 | places, since we don't get B_MOUSE_UP messages after a popup menu | ||
| 5466 | is run. */ | ||
| 5467 | |||
| 5468 | void | ||
| 5469 | be_clear_grab_view (void) | ||
| 5470 | { | ||
| 5471 | if (grab_view_locker.Lock ()) | ||
| 5472 | { | ||
| 5473 | grab_view = NULL; | ||
| 5474 | grab_view_locker.Unlock (); | ||
| 5475 | } | ||
| 5476 | } | ||
diff --git a/src/haiku_support.h b/src/haiku_support.h index 5577d2f151f..76fe071f2c9 100644 --- a/src/haiku_support.h +++ b/src/haiku_support.h | |||
| @@ -727,6 +727,7 @@ extern void be_set_window_fullscreen_mode (void *, enum haiku_fullscreen_mode); | |||
| 727 | extern void be_lock_window (void *); | 727 | extern void be_lock_window (void *); |
| 728 | extern void be_unlock_window (void *); | 728 | extern void be_unlock_window (void *); |
| 729 | extern bool be_get_explicit_workarea (int *, int *, int *, int *); | 729 | extern bool be_get_explicit_workarea (int *, int *, int *, int *); |
| 730 | extern void be_clear_grab_view (void); | ||
| 730 | #ifdef __cplusplus | 731 | #ifdef __cplusplus |
| 731 | } | 732 | } |
| 732 | 733 | ||
diff --git a/src/haikumenu.c b/src/haikumenu.c index 929ed952105..69bb56c124e 100644 --- a/src/haikumenu.c +++ b/src/haikumenu.c | |||
| @@ -432,6 +432,11 @@ haiku_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 432 | 432 | ||
| 433 | FRAME_DISPLAY_INFO (f)->grabbed = 0; | 433 | FRAME_DISPLAY_INFO (f)->grabbed = 0; |
| 434 | 434 | ||
| 435 | /* Clear the grab view manually. There is a race condition here if | ||
| 436 | the window thread receives a button press between here and the | ||
| 437 | end of BMenu_run. */ | ||
| 438 | be_clear_grab_view (); | ||
| 439 | |||
| 435 | if (menu_item_selection) | 440 | if (menu_item_selection) |
| 436 | { | 441 | { |
| 437 | prefix = entry = Qnil; | 442 | prefix = entry = Qnil; |