f->output_method = output_haiku;
f->output_data.haiku = xzalloc (sizeof *f->output_data.haiku);
+ f->output_data.haiku->wait_for_event_type = -1;
fset_icon_name (f, gui_display_get_arg (dpyinfo, parms, Qicon_name,
"iconName", "Title",
counts etc. */
f->output_method = output_haiku;
f->output_data.haiku = xzalloc (sizeof *f->output_data.haiku);
+ f->output_data.haiku->wait_for_event_type = -1;
f->tooltip = true;
fset_icon_name (f, Qnil);
static void
haiku_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
+ int nlines;
+
if (FRAME_TOOLTIP_P (f))
return;
- int nlines;
+
if (TYPE_RANGED_FIXNUMP (int, value))
nlines = XFIXNUM (value);
else
unblock_input ();
}
+/* N.B. that support for TYPE must be explictly added to
+ haiku_read_socket. */
+void
+haiku_wait_for_event (struct frame *f, int type)
+{
+ int input_blocked_to;
+ object_wait_info info;
+ specpdl_ref depth;
+
+ input_blocked_to = interrupt_input_blocked;
+ info.object = port_application_to_emacs;
+ info.type = B_OBJECT_TYPE_PORT;
+ info.events = B_EVENT_READ;
+
+ depth = SPECPDL_INDEX ();
+ specbind (Qinhibit_quit, Qt);
+
+ FRAME_OUTPUT_DATA (f)->wait_for_event_type = type;
+
+ while (FRAME_OUTPUT_DATA (f)->wait_for_event_type == type)
+ {
+ if (wait_for_objects (&info, 1) < B_OK)
+ continue;
+
+ pending_signals = true;
+ /* This will call the read_socket_hook. */
+ totally_unblock_input ();
+ interrupt_input_blocked = input_blocked_to;
+ info.events = B_EVENT_READ;
+ }
+
+ unbind_to (depth, Qnil);
+}
+
static int
haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
{
break;
}
-
case MENU_BAR_RESIZE:
{
struct haiku_menu_bar_resize_event *b = buf;
if (!f || !FRAME_EXTERNAL_MENU_BAR (f))
continue;
+ if (FRAME_OUTPUT_DATA (f)->wait_for_event_type
+ == MENU_BAR_RESIZE)
+ FRAME_OUTPUT_DATA (f)->wait_for_event_type = -1;
+
int old_height = FRAME_MENU_BAR_HEIGHT (f);
FRAME_MENU_BAR_HEIGHT (f) = b->height + 1;
- FRAME_MENU_BAR_LINES (f) =
- (b->height + FRAME_LINE_HEIGHT (f)) / FRAME_LINE_HEIGHT (f);
+ FRAME_MENU_BAR_LINES (f)
+ = (b->height + FRAME_LINE_HEIGHT (f)) / FRAME_LINE_HEIGHT (f);
- if (old_height != b->height)
+ if (old_height != b->height + 1)
{
adjust_frame_size (f, -1, -1, 3, true, Qmenu_bar_lines);
haiku_clear_under_internal_border (f);
/* If non-NULL, the last menu bar click event received. */
struct haiku_menu_bar_click_event *saved_menu_event;
+
+ /* The type of any event that's being waited for. */
+ int wait_for_event_type;
};
struct x_output
Lisp_Object, const char **);
extern Lisp_Object haiku_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
extern void haiku_activate_menubar (struct frame *);
+extern void haiku_wait_for_event (struct frame *, int);
extern void haiku_note_drag_motion (void);
extern void initialize_frame_menubar (struct frame *);