~emacs/emacs

278bacad691f4d5ba05b55c83e3e8ccd7f524e59 — Po Lu 3 months ago c4e66bb
Write a dummy event on each popup menu event

* src/haiku_io.c (haiku_len): Add new event.
* src/haiku_support.cc (be_popup_menu_thread_entry):
(Highlight): Write a dummy event to the event port.
* src/haiku_support.h (enum haiku_event_type): New `DUMMY_EVENT'
type.
(struct haiku_dummy_event): New structure.
* src/haikuterm.c (haiku_read_socket): Handle dummy events.
4 files changed, 20 insertions(+), 8 deletions(-)

M src/haiku_io.c
M src/haiku_support.cc
M src/haiku_support.h
M src/haikuterm.c
M src/haiku_io.c => src/haiku_io.c +2 -0
@@ 94,6 94,8 @@ haiku_len (enum haiku_event_type type)
      return sizeof (struct haiku_refs_event);
    case APP_QUIT_REQUESTED_EVENT:
      return sizeof (struct haiku_app_quit_requested_event);
    case DUMMY_EVENT:
      return sizeof (struct haiku_dummy_event);
    }

  emacs_abort ();

M src/haiku_support.cc => src/haiku_support.cc +10 -7
@@ 149,6 149,7 @@ static int32
be_popup_menu_thread_entry (void *thread_data)
{
  struct be_popup_menu_data *data;
  struct haiku_dummy_event dummy;
  BMenuItem *it;

  data = (struct be_popup_menu_data *) thread_data;


@@ 160,6 161,7 @@ be_popup_menu_thread_entry (void *thread_data)
  else
    popup_track_message = NULL;

  haiku_write (DUMMY_EVENT, &dummy);
  return 0;
}



@@ 1697,6 1699,7 @@ public:
  Highlight (bool highlight_p)
  {
    struct haiku_menu_bar_help_event rq;
    struct haiku_dummy_event dummy;
    BMenu *menu = Menu ();
    BRect r;
    BPoint pt;


@@ 1719,7 1722,10 @@ public:
	    if (menu_bar_id > 0)
	      haiku_write (MENU_BAR_HELP_EVENT, &rq);
	    else
	      haiku_write_without_signal (MENU_BAR_HELP_EVENT, &rq, true);
	      {
		haiku_write_without_signal (MENU_BAR_HELP_EVENT, &rq, true);
		haiku_write (DUMMY_EVENT, &dummy);
	      }
	  }
      }



@@ 2490,16 2496,13 @@ BMenu_run (void *menu, int x, int y,

  while (true)
    {
      process_pending_signals_function ();

      if ((stat = wait_for_objects_etc ((object_wait_info *) &infos, 2,
					B_RELATIVE_TIMEOUT, 10000)) < B_OK)
	{
	  if (stat == B_INTERRUPTED)
	  if (stat == B_INTERRUPTED || stat == B_TIMED_OUT)
	    continue;
	  else if (stat == B_TIMED_OUT)
	    {
	      process_pending_signals_function ();
	      continue;
	    }
	  else
	    gui_abort ("Failed to wait for popup");
	}

M src/haiku_support.h => src/haiku_support.h +7 -1
@@ 86,7 86,8 @@ enum haiku_event_type
    MENU_BAR_HELP_EVENT,
    ZOOM_EVENT,
    REFS_EVENT,
    APP_QUIT_REQUESTED_EVENT
    APP_QUIT_REQUESTED_EVENT,
    DUMMY_EVENT
  };

struct haiku_quit_requested_event


@@ 123,6 124,11 @@ struct haiku_app_quit_requested_event
  char dummy;
};

struct haiku_dummy_event
{
  char dummy;
};

#define HAIKU_MODIFIER_ALT (1)
#define HAIKU_MODIFIER_CTRL (1 << 1)
#define HAIKU_MODIFIER_SHIFT (1 << 2)

M src/haikuterm.c => src/haikuterm.c +1 -0
@@ 3263,6 3263,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
	  }
	case APP_QUIT_REQUESTED_EVENT:
	case KEY_UP:
	case DUMMY_EVENT:
	default:
	  break;
	}