commit 095a776d0642bced88a6357f2d889c8980e0b83a (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Fri Apr 15 06:34:42 2022 +0000 Clean up various bits of Haiku code * src/haiku_font_support.cc (BFont_string_width): Delete unused function. * src/haiku_support.cc (BWindow_new): Clean up type of `view'. (BWindow_quit): Clean up coding style. (BView_mouse_down, BView_mouse_up, BView_mouse_moved): Delete unused functions. (unwind_popup_file_dialog): Clean up coding style. (be_popup_file_dialog_safe_set_target): Delete function. (be_popup_file_dialog): Improve code clarity. * src/haiku_support.h: Fix coding style. * src/haikufns.c (haiku_get_color, haiku_display_info_for_name) (check_haiku_display_info, Fhaiku_read_file_name) (Fx_display_save_under, Fhaiku_frame_restack): Remove references to "Be displays" and replace them with "Haiku displays". * src/haikuselect.h: Clean up coding style. * src/haikuterm.c (haiku_read_socket): Clean up coding style and fix a few latent bugs. diff --git a/src/haiku_font_support.cc b/src/haiku_font_support.cc index fd41ee71f0..d3e1128e09 100644 --- a/src/haiku_font_support.cc +++ b/src/haiku_font_support.cc @@ -622,12 +622,6 @@ BFont_populate_plain_family (struct haiku_font_pattern *ptn) ptn->family[sizeof ptn->family - 1] = '\0'; } -int -BFont_string_width (void *font, const char *utf8) -{ - return ((BFont *) font)->StringWidth (utf8); -} - haiku_font_family_or_style * be_list_font_families (size_t *length) { diff --git a/src/haiku_support.cc b/src/haiku_support.cc index d92e3d95ac..4fd2fc4aa5 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -2458,20 +2458,22 @@ BApplication_setup (void) /* Set up and return a window with its view put in VIEW. */ void * -BWindow_new (void *_view) +BWindow_new (void **view) { - BWindow *window = new (std::nothrow) EmacsWindow; - BView **v = (BView **) _view; + BWindow *window; + BView *vw; + + window = new (std::nothrow) EmacsWindow; if (!window) { - *v = NULL; + *view = NULL; return window; } - BView *vw = new (std::nothrow) EmacsView; + vw = new (std::nothrow) EmacsView; if (!vw) { - *v = NULL; + *view = NULL; window->LockLooper (); window->Quit (); return NULL; @@ -2485,15 +2487,17 @@ BWindow_new (void *_view) the first time. */ window->UnlockLooper (); window->AddChild (vw); - *v = vw; + *view = vw; return window; } void BWindow_quit (void *window) { - ((BWindow *) window)->LockLooper (); - ((BWindow *) window)->Quit (); + BWindow *w = (BWindow *) window; + + w->LockLooper (); + w->Quit (); } /* Set WINDOW's offset to X, Y. */ @@ -2814,42 +2818,6 @@ BWindow_center_on_screen (void *window) w->CenterOnScreen (); } -/* Tell VIEW it has been clicked at X by Y. */ -void -BView_mouse_down (void *view, int x, int y) -{ - BView *vw = (BView *) view; - if (vw->LockLooper ()) - { - vw->MouseDown (BPoint (x, y)); - vw->UnlockLooper (); - } -} - -/* Tell VIEW the mouse has been released at X by Y. */ -void -BView_mouse_up (void *view, int x, int y) -{ - BView *vw = (BView *) view; - if (vw->LockLooper ()) - { - vw->MouseUp (BPoint (x, y)); - vw->UnlockLooper (); - } -} - -/* Tell VIEW that the mouse has moved to Y by Y. */ -void -BView_mouse_moved (void *view, int x, int y, uint32_t transit) -{ - BView *vw = (BView *) view; - if (vw->LockLooper ()) - { - vw->MouseMoved (BPoint (x, y), transit, NULL); - vw->UnlockLooper (); - } -} - /* Import fringe bitmap (short array, low bit rightmost) BITS into BITMAP using the B_GRAY1 colorspace. */ void @@ -3715,44 +3683,45 @@ struct popup_file_dialog_data static void unwind_popup_file_dialog (void *ptr) { - struct popup_file_dialog_data *data = - (struct popup_file_dialog_data *) ptr; + struct popup_file_dialog_data *data + = (struct popup_file_dialog_data *) ptr; BFilePanel *panel = data->panel; + delete panel; delete data->entry; delete data->msg; } -static void -be_popup_file_dialog_safe_set_target (BFilePanel *dialog, BWindow *window) -{ - dialog->SetTarget (BMessenger (window)); -} - /* Popup a file dialog. */ char * -be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, int dir_only_p, - void *window, const char *save_text, const char *prompt, - void (*block_input_function) (void), +be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, + int dir_only_p, void *window, const char *save_text, + const char *prompt, void (*block_input_function) (void), void (*unblock_input_function) (void), void (*maybe_quit_function) (void)) { specpdl_ref idx = c_specpdl_idx_from_cxx (); /* setjmp/longjmp is UB with automatic objects. */ - block_input_function (); BWindow *w = (BWindow *) window; - uint32_t mode = dir_only_p ? B_DIRECTORY_NODE : B_FILE_NODE | B_DIRECTORY_NODE; + uint32_t mode = (dir_only_p + ? B_DIRECTORY_NODE + : B_FILE_NODE | B_DIRECTORY_NODE); BEntry *path = new BEntry; BMessage *msg = new BMessage ('FPSE'); BFilePanel *panel = new BFilePanel (open_p ? B_OPEN_PANEL : B_SAVE_PANEL, NULL, NULL, mode); - + void *buf; + enum haiku_event_type type; + char *ptr; struct popup_file_dialog_data dat; + ssize_t b_s; + dat.entry = path; dat.msg = msg; dat.panel = panel; record_c_unwind_protect_from_cxx (unwind_popup_file_dialog, &dat); + if (default_dir) { if (path->SetTo (default_dir, 0) != B_OK) @@ -3760,22 +3729,21 @@ be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, int } panel->SetMessage (msg); + if (default_dir) panel->SetPanelDirectory (path); if (save_text) panel->SetSaveText (save_text); + panel->SetHideWhenDone (0); panel->Window ()->SetTitle (prompt); - be_popup_file_dialog_safe_set_target (panel, w); - + panel->SetTarget (BMessenger (w)); panel->Show (); - unblock_input_function (); - void *buf = alloca (200); + buf = alloca (200); while (1) { - enum haiku_event_type type; - char *ptr = NULL; + ptr = NULL; if (!haiku_read_with_timeout (&type, buf, 200, 1000000, false)) { @@ -3789,7 +3757,6 @@ be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, int maybe_quit_function (); } - ssize_t b_s; block_input_function (); haiku_read_size (&b_s, false); if (!b_s || ptr || panel->Window ()->IsHidden ()) diff --git a/src/haiku_support.h b/src/haiku_support.h index 1de135c55b..eb54fe75dd 100644 --- a/src/haiku_support.h +++ b/src/haiku_support.h @@ -372,7 +372,6 @@ struct haiku_menu_bar_state_event to bind to the specpdl and handle quitting correctly. */ #ifdef __cplusplus - #if SIZE_MAX > 0xffffffff #define WRAP_SPECPDL_REF 1 #endif @@ -394,572 +393,249 @@ extern "C" #include #ifdef __cplusplus - typedef void *haiku; +typedef void *haiku; - extern void - haiku_put_pixel (haiku bitmap, int x, int y, unsigned long pixel); +extern void +haiku_put_pixel (haiku, int, int, unsigned long); - extern unsigned long - haiku_get_pixel (haiku bitmap, int x, int y); +extern unsigned long +haiku_get_pixel (haiku, int, int); #endif - extern port_id port_application_to_emacs; - extern port_id port_popup_menu_to_emacs; - - extern void haiku_io_init (void); - extern void haiku_io_init_in_app_thread (void); - - extern void - haiku_read_size (ssize_t *len, bool popup_menu_p); - - extern int - haiku_read (enum haiku_event_type *type, void *buf, ssize_t len); - - extern int - haiku_read_with_timeout (enum haiku_event_type *type, void *buf, ssize_t len, - bigtime_t timeout, bool popup_menu_p); - - extern int - haiku_write (enum haiku_event_type type, void *buf); - - extern int - haiku_write_without_signal (enum haiku_event_type type, void *buf, - bool popup_menu_p); - - extern void - rgb_color_hsl (uint32_t rgb, double *h, double *s, double *l); - - extern void - hsl_color_rgb (double h, double s, double l, uint32_t *rgb); - - extern void * - BBitmap_new (int width, int height, int mono_p); - - extern void * - BBitmap_data (void *bitmap); - - extern int - BBitmap_convert (void *bitmap, void **new_bitmap); - - extern void - BBitmap_free (void *bitmap); - - extern void - BBitmap_dimensions (void *bitmap, int *left, int *top, - int *right, int *bottom, int32_t *bytes_per_row, - int *mono_p); - - extern void * - BApplication_setup (void); - - extern void * - BWindow_new (void *view); - - extern void - BWindow_quit (void *window); - - extern void - BWindow_set_offset (void *window, int x, int y); - - extern void - BWindow_iconify (void *window); - - extern void - BWindow_set_visible (void *window, int visible_p); - - extern void - BFont_close (void *font); - - extern void - BFont_dat (void *font, int *px_size, int *min_width, int *max_width, - int *avg_width, int *height, int *space_width, int *ascent, - int *descent, int *underline_position, int *underline_thickness); - - extern int - BFont_have_char_p (void *font, int32_t chr); - - extern int - BFont_have_char_block (void *font, int32_t beg, int32_t end); - - extern void - BFont_char_bounds (void *font, const char *mb_str, int *advance, - int *lb, int *rb); - - extern void - BFont_nchar_bounds (void *font, const char *mb_str, int *advance, - int *lb, int *rb, int32_t n); - - extern void - BWindow_retitle (void *window, const char *title); - - extern void - BWindow_resize (void *window, int width, int height); - - extern void - BWindow_activate (void *window); - - extern void - BView_StartClip (void *view); - - extern void - BView_EndClip (void *view); - - extern void - BView_SetHighColor (void *view, uint32_t color); - - extern void - BView_SetHighColorForVisibleBell (void *view, uint32_t color); - - extern void - BView_SetLowColor (void *view, uint32_t color); - - extern void - BView_SetPenSize (void *view, int u); - - extern void - BView_SetFont (void *view, void *font); - - extern void - BView_MovePenTo (void *view, int x, int y); - - extern void - BView_DrawString (void *view, const char *chr, ptrdiff_t len); - - extern void - BView_DrawChar (void *view, char chr); - - extern void - BView_FillRectangle (void *view, int x, int y, int width, int height); - - extern void - BView_FillRectangleAbs (void *view, int x, int y, int x1, int y1); - - extern void - BView_FillTriangle (void *view, int x1, int y1, - int x2, int y2, int x3, int y3); - - extern void - BView_StrokeRectangle (void *view, int x, int y, int width, int height); - - extern void - BView_SetViewColor (void *view, uint32_t color); - - extern void - BView_ClipToRect (void *view, int x, int y, int width, int height); - - extern void - BView_ClipToInverseRect (void *view, int x, int y, int width, int height); - - extern void - BView_StrokeLine (void *view, int sx, int sy, int tx, int ty); - - extern void - BView_CopyBits (void *view, int x, int y, int width, int height, - int tox, int toy, int towidth, int toheight); - - extern void - BView_DrawBitmap (void *view, void *bitmap, int x, int y, - int width, int height, int vx, int vy, int vwidth, - int vheight); - - extern void - BView_DrawBitmapWithEraseOp (void *view, void *bitmap, int x, - int y, int width, int height); - - extern void - BView_DrawMask (void *src, void *view, - int x, int y, int width, int height, - int vx, int vy, int vwidth, int vheight, - uint32_t color); - - extern void - BView_InvertRect (void *view, int x, int y, int width, int height); - - extern void * - BBitmap_transform_bitmap (void *bitmap, void *mask, uint32_t m_color, - double rot, int desw, int desh); - - extern void - BScreen_px_dim (int *width, int *height); - - extern void - BView_resize_to (void *view, int width, int height); - - /* Functions for creating and freeing cursors. */ - extern void * - BCursor_create_default (void); - - extern void * - BCursor_from_id (enum haiku_cursor cursor); - - extern void * - BCursor_create_modeline (void); - - extern void * - BCursor_create_i_beam (void); - - extern void * - BCursor_create_progress_cursor (void); - - extern void * - BCursor_create_grab (void); - - extern void - BCursor_delete (void *cursor); - - extern void - BView_set_view_cursor (void *view, void *cursor); - - extern void - BWindow_Flush (void *window); - - extern void * - BScrollBar_make_for_view (void *view, int horizontal_p, - int x, int y, int x1, int y1, - void *scroll_bar_ptr); - - extern void - BScrollBar_delete (void *sb); - - extern void - BView_move_frame (void *view, int x, int y, int x1, int y1); - - extern void - BView_scroll_bar_update (void *sb, int portion, int whole, int position, - int dragging, bool can_overscroll); - - extern int - BScrollBar_default_size (int horizontal_p); - - extern void - BView_invalidate (void *view); - - extern void - BView_draw_lock (void *view, bool invalidate_region, - int x, int y, int width, int height); - - extern void - BView_invalidate_region (void *view, int x, int y, int width, int height); - - extern void - BView_draw_unlock (void *view); - - extern void - BWindow_center_on_screen (void *window); - - extern void - BView_mouse_moved (void *view, int x, int y, uint32_t transit); - - extern void - BView_mouse_down (void *view, int x, int y); - - extern void - BView_mouse_up (void *view, int x, int y); - - extern void - BBitmap_import_fringe_bitmap (void *bitmap, unsigned short *bits, - int wd, int h); - - extern void - BBitmap_import_mono_bits (void *bitmap, void *bits, int wd, int h); - - extern void - haiku_font_pattern_free (struct haiku_font_pattern *pt); - - extern struct haiku_font_pattern * - BFont_find (struct haiku_font_pattern *pt); - - extern int - BFont_open_pattern (struct haiku_font_pattern *pat, void **font, float size); - - extern void - BFont_populate_fixed_family (struct haiku_font_pattern *ptn); - - extern void - BFont_populate_plain_family (struct haiku_font_pattern *ptn); - - extern void - BView_publish_scroll_bar (void *view, int x, int y, int width, int height); - - extern void - BView_forget_scroll_bar (void *view, int x, int y, int width, int height); - - extern bool - BView_inside_scroll_bar (void *view, int x, int y); - - extern void - BView_get_mouse (void *view, int *x, int *y); - - extern void - BView_convert_to_screen (void *view, int *x, int *y); - - extern void - BView_convert_from_screen (void *view, int *x, int *y); - - extern void - BWindow_change_decoration (void *window, int decorate_p); - - extern void - BWindow_set_tooltip_decoration (void *window); - - extern void - BWindow_set_avoid_focus (void *window, int avoid_focus_p); - - extern void - BView_emacs_delete (void *view); - - extern uint32_t - haiku_current_workspace (void); - - extern uint32_t - BWindow_workspaces (void *window); - - extern void * - BPopUpMenu_new (const char *name); - - extern void - BMenu_add_item (void *menu, const char *label, void *ptr, bool enabled_p, - bool marked_p, bool mbar_p, void *mbw_ptr, const char *key, - const char *help); - - extern void - BMenu_add_separator (void *menu); - - extern void * - BMenu_new_submenu (void *menu, const char *label, bool enabled_p); - - extern void * - BMenu_new_menu_bar_submenu (void *menu, const char *label); - - extern int - BMenu_count_items (void *menu); - - extern void * - BMenu_item_at (void *menu, int idx); - - extern void * - BMenu_run (void *menu, int x, int y, - void (*run_help_callback) (void *, void *), - void (*block_input_function) (void), - void (*unblock_input_function) (void), - struct timespec (*process_pending_signals_function) (void), - void *run_help_callback_data); - - extern void - BPopUpMenu_delete (void *menu); - - extern void * - BMenuBar_new (void *view); - - extern void - BMenu_delete_all (void *menu); - - extern void - BMenuBar_delete (void *menubar); - - extern void - BMenu_item_set_label (void *item, const char *label); - - extern void * - BMenu_item_get_menu (void *item); - - extern void - BMenu_delete_from (void *menu, int start, int count); - - extern void - haiku_ring_bell (void); - - extern void * - BAlert_new (const char *text, enum haiku_alert_type type); - - extern void * - BAlert_add_button (void *alert, const char *text); - - extern void - BAlert_set_offset_spacing (void *alert); - - extern int32 - BAlert_go (void *alert, - void (*block_input_function) (void), - void (*unblock_input_function) (void), - void (*process_pending_signals_function) (void)); - - extern void - BButton_set_enabled (void *button, int enabled_p); - - extern void - BView_set_tooltip (void *view, const char *tooltip); - - extern void - BAlert_delete (void *alert); - - extern void - BScreen_res (double *rrsx, double *rrsy); - - extern void - EmacsWindow_parent_to (void *window, void *other_window); - - extern void - EmacsWindow_unparent (void *window); - - extern int - BFont_string_width (void *font, const char *utf8); - - extern void - be_get_version_string (char *version, int len); - - extern int - be_get_display_planes (void); - - extern int - be_get_display_color_cells (void); - - extern void - be_warp_pointer (int x, int y); - - extern void - EmacsWindow_move_weak_child (void *window, void *child, int xoff, int yoff); - - extern void - EmacsView_set_up_double_buffering (void *vw); - - extern void - EmacsView_disable_double_buffering (void *vw); - - extern void - EmacsView_flip_and_blit (void *vw); - - extern int - EmacsView_double_buffered_p (void *vw); - - extern char * - be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, - int dir_only_p, void *window, const char *save_text, - const char *prompt, - void (*block_input_function) (void), - void (*unblock_input_function) (void), - void (*maybe_quit_function) (void)); - - extern void - record_c_unwind_protect_from_cxx (void (*) (void *), void *); - - extern specpdl_ref c_specpdl_idx_from_cxx (void); - - extern void - c_unbind_to_nil_from_cxx (specpdl_ref idx); - - extern void - BWindow_zoom (void *window); - - extern void - EmacsWindow_make_fullscreen (void *window, int fullscreen_p); - - extern void - EmacsWindow_unzoom (void *window); +extern port_id port_application_to_emacs; +extern port_id port_popup_menu_to_emacs; + +extern void haiku_io_init (void); +extern void haiku_io_init_in_app_thread (void); + +extern void haiku_read_size (ssize_t *, bool); + +extern int haiku_read (enum haiku_event_type *, void *, ssize_t); +extern int haiku_read_with_timeout (enum haiku_event_type *, void *, ssize_t, + bigtime_t, bool); +extern int haiku_write (enum haiku_event_type, void *); +extern int haiku_write_without_signal (enum haiku_event_type, void *, bool); + +extern void rgb_color_hsl (uint32_t, double *, double *, double *); +extern void hsl_color_rgb (double, double, double, uint32_t *); + +extern void *BBitmap_new (int, int, int); +extern void *BBitmap_data (void *); +extern int BBitmap_convert (void *, void **); + +extern void BBitmap_free (void *); + +extern void BBitmap_dimensions (void *, int *, int *, int *, int *, + int32_t *, int *); +extern void *BApplication_setup (void); +extern void *BWindow_new (void **); +extern void BWindow_quit (void *); + +extern void BWindow_set_offset (void *, int, int); +extern void BWindow_iconify (void *); +extern void BWindow_set_visible (void *, int); +extern void BWindow_retitle (void *, const char *); +extern void BWindow_resize (void *, int, int); +extern void BWindow_activate (void *); +extern void BWindow_center_on_screen (void *); +extern void BWindow_change_decoration (void *, int); +extern void BWindow_set_tooltip_decoration (void *); +extern void BWindow_set_avoid_focus (void *, int); +extern uint32_t BWindow_workspaces (void *); +extern void BWindow_zoom (void *); +extern void BWindow_set_min_size (void *, int, int); +extern void BWindow_set_size_alignment (void *, int, int); +extern void BWindow_sync (void *); +extern void BWindow_send_behind (void *, void *); +extern bool BWindow_is_active (void *); +extern void BWindow_set_override_redirect (void *, bool); +extern void BWindow_dimensions (void *, int *, int *); +extern void BWindow_Flush (void *); + +extern void BFont_close (void *); +extern void BFont_dat (void *, int *, int *, int *, int *, + int *, int *, int *, int *, int *, int *); +extern int BFont_have_char_p (void *, int32_t); +extern int BFont_have_char_block (void *, int32_t, int32_t); +extern void BFont_char_bounds (void *, const char *, int *, int *, int *); +extern void BFont_nchar_bounds (void *, const char *, int *, int *, + int *, int32_t); +extern struct haiku_font_pattern *BFont_find (struct haiku_font_pattern *); + + +extern void BView_StartClip (void *); +extern void BView_EndClip (void *); +extern void BView_SetHighColor (void *, uint32_t); +extern void BView_SetHighColorForVisibleBell (void *, uint32_t); +extern void BView_SetLowColor (void *, uint32_t); +extern void BView_SetPenSize (void *, int); +extern void BView_SetFont (void *, void *); +extern void BView_MovePenTo (void *, int, int); +extern void BView_DrawString (void *, const char *, ptrdiff_t); +extern void BView_DrawChar (void *, char); +extern void BView_FillRectangle (void *, int, int, int, int); +extern void BView_FillRectangleAbs (void *, int, int, int, int); +extern void BView_FillTriangle (void *, int, int, int, int, int, int); +extern void BView_StrokeRectangle (void *, int, int, int, int); +extern void BView_SetViewColor (void *, uint32_t); +extern void BView_ClipToRect (void *, int, int, int, int); +extern void BView_ClipToInverseRect (void *, int, int, int, int); +extern void BView_StrokeLine (void *, int, int, int, int); +extern void BView_CopyBits (void *, int, int, int, int, int, int, int, int); +extern void BView_InvertRect (void *, int, int, int, int); +extern void BView_DrawBitmap (void *, void *, int, int, int, int, int, int, + int, int); +extern void BView_DrawBitmapWithEraseOp (void *, void *, int, int, int, int); +extern void BView_DrawMask (void *, void *, int, int, int, int, int, int, + int, int, uint32_t); + +extern void BView_resize_to (void *, int, int); +extern void BView_set_view_cursor (void *, void *); +extern void BView_move_frame (void *, int, int, int, int); +extern void BView_scroll_bar_update (void *, int, int, int, int, bool); + +extern void *BBitmap_transform_bitmap (void *, void *, uint32_t, double, + int, int); + +extern void BScreen_px_dim (int *, int *); +extern void BScreen_res (double *, double *); + +/* Functions for creating and freeing cursors. */ +extern void *BCursor_create_default (void); +extern void *BCursor_from_id (enum haiku_cursor); +extern void *BCursor_create_modeline (void); +extern void *BCursor_create_i_beam (void); +extern void *BCursor_create_progress_cursor (void); +extern void *BCursor_create_grab (void); +extern void BCursor_delete (void *); + +extern void *BScrollBar_make_for_view (void *, int, int, int, int, int, void *); +extern void BScrollBar_delete (void *); +extern int BScrollBar_default_size (int); + +extern void BView_invalidate (void *); +extern void BView_draw_lock (void *, bool, int, int, int, int); +extern void BView_invalidate_region (void *, int, int, int, int); +extern void BView_draw_unlock (void *); + +extern void BBitmap_import_fringe_bitmap (void *, unsigned short *, int, int); +extern void BBitmap_import_mono_bits (void *, void *, int, int); + +extern void haiku_font_pattern_free (struct haiku_font_pattern *); + +extern int BFont_open_pattern (struct haiku_font_pattern *, void **, float); +extern void BFont_populate_fixed_family (struct haiku_font_pattern *); +extern void BFont_populate_plain_family (struct haiku_font_pattern *); + +extern void BView_publish_scroll_bar (void *, int, int, int, int); +extern void BView_forget_scroll_bar (void *, int, int, int, int); +extern bool BView_inside_scroll_bar (void *, int, int); +extern void BView_get_mouse (void *, int *, int *); +extern void BView_convert_to_screen (void *, int *, int *); +extern void BView_convert_from_screen (void *, int *, int *); + +extern void BView_emacs_delete (void *); +extern uint32_t haiku_current_workspace (void); + +extern void *BPopUpMenu_new (const char *); + +extern void BMenu_add_item (void *, const char *, void *, bool, + bool, bool, void *, const char *, + const char *); +extern void BMenu_add_separator (void *); +extern void *BMenu_new_submenu (void *, const char *, bool); +extern void *BMenu_new_menu_bar_submenu (void *, const char *); +extern int BMenu_count_items (void *); +extern void *BMenu_item_at (void *, int); +extern void *BMenu_run (void *, int, int, void (*) (void *, void *), + void (*) (void), void (*) (void), + struct timespec (*) (void), void *); +extern void BPopUpMenu_delete (void *); +extern void *BMenuBar_new (void *); +extern void BMenu_delete_all (void *); +extern void BMenuBar_delete (void *); +extern void BMenu_item_set_label (void *, const char *); +extern void *BMenu_item_get_menu (void *); +extern void BMenu_delete_from (void *, int, int); + +extern void haiku_ring_bell (void); + +extern void *BAlert_new (const char *, enum haiku_alert_type); +extern void *BAlert_add_button (void *, const char *); +extern void BAlert_set_offset_spacing (void *); +extern int32 BAlert_go (void *, void (*) (void), void (*) (void), + void (*) (void)); +extern void BButton_set_enabled (void *, int); +extern void BView_set_tooltip (void *, const char *); +extern void BView_show_tooltip (void *); +extern void BView_set_and_show_sticky_tooltip (void *, const char *, + int, int); + +extern void BAlert_delete (void *); + +extern void EmacsWindow_parent_to (void *, void *); +extern void EmacsWindow_unparent (void *); +extern void EmacsWindow_move_weak_child (void *, void *, int, int); +extern void EmacsWindow_make_fullscreen (void *, int); +extern void EmacsWindow_unzoom (void *); +extern void EmacsWindow_signal_menu_update_complete (void *); + +extern void be_get_version_string (char *, int); +extern int be_get_display_planes (void); +extern int be_get_display_color_cells (void); +extern void be_warp_pointer (int, int); + +extern void EmacsView_set_up_double_buffering (void *); +extern void EmacsView_disable_double_buffering (void *); +extern void EmacsView_flip_and_blit (void *); +extern int EmacsView_double_buffered_p (void *); + +extern char *be_popup_file_dialog (int, const char *, int, + int, void *, const char *, + const char *, void (*) (void), + void (*) (void), void (*) (void)); + +extern void record_c_unwind_protect_from_cxx (void (*) (void *), void *); +extern specpdl_ref c_specpdl_idx_from_cxx (void); +extern void c_unbind_to_nil_from_cxx (specpdl_ref); #ifdef HAVE_NATIVE_IMAGE_API - extern int - be_can_translate_type_to_bitmap_p (const char *mime); - - extern void * - be_translate_bitmap_from_file_name (const char *filename); - - extern void * - be_translate_bitmap_from_memory (const void *buf, size_t bytes); +extern int be_can_translate_type_to_bitmap_p (const char *); +extern void *be_translate_bitmap_from_file_name (const char *); +extern void *be_translate_bitmap_from_memory (const void *, size_t); #endif - extern bool - BMenuBar_start_tracking (void *mbar); - - extern size_t - BBitmap_bytes_length (void *bitmap); - - extern void - BView_show_tooltip (void *view); +extern bool BMenuBar_start_tracking (void *); +extern size_t BBitmap_bytes_length (void *); #ifdef USE_BE_CAIRO - extern cairo_t * - EmacsView_cairo_context (void *view); - - extern void - BView_cr_dump_clipping (void *view, cairo_t *ctx); - - extern void - EmacsWindow_begin_cr_critical_section (void *window); - - extern void - EmacsWindow_end_cr_critical_section (void *window); +extern cairo_t *EmacsView_cairo_context (void *); +extern void BView_cr_dump_clipping (void *, cairo_t *); +extern void EmacsWindow_begin_cr_critical_section (void *); +extern void EmacsWindow_end_cr_critical_section (void *); #endif - extern void - BView_set_and_show_sticky_tooltip (void *view, const char *tooltip, - int x, int y); - - extern void - BMenu_add_title (void *menu, const char *text); - - extern int - be_plain_font_height (void); - - extern int - be_string_width_with_plain_font (const char *str); - - extern int - be_get_display_screens (void); - - extern void - BWindow_set_min_size (void *window, int width, int height); - - extern void - BWindow_set_size_alignment (void *window, int align_width, int align_height); +extern void BMenu_add_title (void *, const char *); - extern void - BWindow_sync (void *window); +extern int be_plain_font_height (void); +extern int be_string_width_with_plain_font (const char *); +extern int be_get_display_screens (void); +extern bool be_use_subpixel_antialiasing (void); +extern const char *be_find_setting (const char *); +extern haiku_font_family_or_style *be_list_font_families (size_t *); - extern void - BWindow_send_behind (void *window, void *other_window); +extern void BMessage_delete (void *); - extern bool - BWindow_is_active (void *window); - - extern bool - be_use_subpixel_antialiasing (void); - - extern void - BWindow_set_override_redirect (void *window, bool override_redirect_p); - - extern const char * - be_find_setting (const char *name); - - extern void - EmacsWindow_signal_menu_update_complete (void *window); - - extern haiku_font_family_or_style * - be_list_font_families (size_t *length); - - extern void - BWindow_dimensions (void *window, int *width, int *height); - - extern void - BMessage_delete (void *message); - - extern bool - be_drag_message (void *view, void *message, bool allow_same_view, - void (*block_input_function) (void), - void (*unblock_input_function) (void), - void (*process_pending_signals_function) (void), - bool (*should_quit_function) (void)); - - extern bool - be_drag_and_drop_in_progress (void); +extern bool be_drag_message (void *, void *, bool, void (*) (void), + void (*) (void), void (*) (void), + bool (*) (void)); +extern bool be_drag_and_drop_in_progress (void); #ifdef __cplusplus - extern void * - find_appropriate_view_for_draw (void *vw); +extern void *find_appropriate_view_for_draw (void *vw); } -extern _Noreturn void -gui_abort (const char *msg); +extern _Noreturn void gui_abort (const char *msg); #endif /* _cplusplus */ /* Borrowed from X.Org keysymdef.h */ @@ -1001,3 +677,7 @@ gui_abort (const char *msg); #define XK_F1 0xffbe #endif /* _HAIKU_SUPPORT_H_ */ + +// Local Variables: +// eval: (setf (alist-get 'inextern-lang c-offsets-alist) 0) +// End: diff --git a/src/haikufns.c b/src/haikufns.c index b282cf292a..874ebaaf91 100644 --- a/src/haikufns.c +++ b/src/haikufns.c @@ -64,11 +64,8 @@ static Lisp_Object tip_last_frame; /* PARMS argument of last `x-show-tip' call. */ static Lisp_Object tip_last_parms; -static void -haiku_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval); -static void -haiku_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name); - +static void haiku_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); +static void haiku_set_title (struct frame *, Lisp_Object, Lisp_Object); static ptrdiff_t image_cache_refcount; static Lisp_Object @@ -255,7 +252,8 @@ int haiku_get_color (const char *name, Emacs_Color *color) { unsigned short r16, g16, b16; - Lisp_Object tem; + Lisp_Object tem, col; + int32 clr; if (parse_color_spec (name, &r16, &g16, &b16)) { @@ -272,10 +270,11 @@ haiku_get_color (const char *name, Emacs_Color *color) tem = x_display_list->color_map; for (; CONSP (tem); tem = XCDR (tem)) { - Lisp_Object col = XCAR (tem); + col = XCAR (tem); + if (CONSP (col) && !xstrcasecmp (SSDATA (XCAR (col)), name)) { - int32_t clr = XFIXNUM (XCDR (col)); + clr = XFIXNUM (XCDR (col)); color->pixel = clr; color->red = RED_FROM_ULONG (clr) * 257; color->green = GREEN_FROM_ULONG (clr) * 257; @@ -301,10 +300,10 @@ haiku_display_info_for_name (Lisp_Object name) if (!x_display_list) return x_display_list; - error ("Be windowing not initialized"); + error ("Haiku windowing not initialized"); } - error ("Be displays can only be named \"be\""); + error ("Haiku displays can only be named \"be\""); } static struct haiku_display_info * @@ -321,14 +320,14 @@ check_haiku_display_info (Lisp_Object object) else if (x_display_list) dpyinfo = x_display_list; else - error ("Be windowing not present"); + error ("Haiku windowing not present"); } else if (TERMINALP (object)) { struct terminal *t = decode_live_terminal (object); if (t->type != output_haiku) - error ("Terminal %d is not a Be display", t->id); + error ("Terminal %d is not a Haiku display", t->id); dpyinfo = t->display_info.haiku; } @@ -2412,7 +2411,7 @@ Optional arg SAVE_TEXT, if non-nil, specifies some text to show in the entry fie Lisp_Object dir_only_p, Lisp_Object save_text) { if (!x_display_list) - error ("Be windowing not initialized"); + error ("Haiku windowing not initialized"); if (!NILP (dir)) CHECK_STRING (dir); @@ -2513,13 +2512,15 @@ DEFUN ("x-display-save-under", Fx_display_save_under, doc: /* SKIP: real doc in xfns.c. */) (Lisp_Object terminal) { + struct frame *f; check_haiku_display_info (terminal); if (FRAMEP (terminal)) { - struct frame *f = decode_window_system_frame (terminal); - return FRAME_HAIKU_VIEW (f) && EmacsView_double_buffered_p (FRAME_HAIKU_VIEW (f)) ? - Qt : Qnil; + f = decode_window_system_frame (terminal); + return ((FRAME_HAIKU_VIEW (f) + && EmacsView_double_buffered_p (FRAME_HAIKU_VIEW (f))) + ? Qt : Qnil); } return Qnil; @@ -2536,11 +2537,8 @@ frames overlap, FRAME1 (partially) obscures FRAME2. Some window managers may refuse to restack windows. */) (Lisp_Object frame1, Lisp_Object frame2, Lisp_Object above) { - struct frame *f1 = decode_live_frame (frame1); - struct frame *f2 = decode_live_frame (frame2); - - check_window_system (f1); - check_window_system (f2); + struct frame *f1 = decode_window_system_frame (frame1); + struct frame *f2 = decode_window_system_frame (frame2); block_input (); diff --git a/src/haikuselect.h b/src/haikuselect.h index bac9663c70..a99721dd22 100644 --- a/src/haikuselect.h +++ b/src/haikuselect.h @@ -36,86 +36,53 @@ enum haiku_clipboard #include extern "C" { - extern void init_haiku_select (void); +extern void init_haiku_select (void); #endif - - /* Whether or not the selection was recently changed. */ - extern int selection_state_flag; - - /* Find a string with the MIME type TYPE in the system clipboard. */ - extern char * - BClipboard_find_system_data (const char *type, ssize_t *len); - - /* Ditto, but for the primary selection and not clipboard. */ - extern char * - BClipboard_find_primary_selection_data (const char *type, ssize_t *len); - - /* Ditto, this time for the secondary selection. */ - extern char * - BClipboard_find_secondary_selection_data (const char *type, ssize_t *len); - - extern void - BClipboard_set_system_data (const char *type, const char *data, ssize_t len, - bool clear); - - extern void - BClipboard_set_primary_selection_data (const char *type, const char *data, - ssize_t len, bool clear); - - extern void - BClipboard_set_secondary_selection_data (const char *type, const char *data, - ssize_t len, bool clear); - - extern void - BClipboard_system_targets (char **buf, int len); - - extern void - BClipboard_primary_targets (char **buf, int len); - - extern void - BClipboard_secondary_targets (char **buf, int len); - - extern bool - BClipboard_owns_clipboard (void); - - extern bool - BClipboard_owns_primary (void); - - extern bool BClipboard_owns_secondary (void); - - /* Free the returned data. */ - extern void BClipboard_free_data (void *ptr); - - extern int be_enum_message (void *message, int32 *tc, int32 index, - int32 *count, const char **name_return); - extern int be_get_message_data (void *message, const char *name, - int32 type_code, int32 index, - const void **buf_return, - ssize_t *size_return); - extern int be_get_refs_data (void *message, const char *name, - int32 index, char **path_buffer); - extern int be_get_point_data (void *message, const char *name, - int32 index, float *x, float *y); - extern uint32 be_get_message_type (void *message); - extern void be_set_message_type (void *message, uint32 what); - extern void *be_get_message_message (void *message, const char *name, - int32 index); - extern void *be_create_simple_message (void); - extern int be_add_message_data (void *message, const char *name, - int32 type_code, const void *buf, - ssize_t buf_size); - extern int be_add_refs_data (void *message, const char *name, - const char *filename); - extern int be_add_point_data (void *message, const char *name, - float x, float y); - extern int be_add_message_message (void *message, const char *name, - void *data); - extern int be_lock_clipboard_message (enum haiku_clipboard clipboard, - void **message_return, - bool clear); - extern void be_unlock_clipboard (enum haiku_clipboard clipboard, - bool discard); +/* Whether or not the selection was recently changed. */ +extern int selection_state_flag; + +/* Find a string with the MIME type TYPE in the system clipboard. */ +extern char *BClipboard_find_system_data (const char *, ssize_t *); +extern char *BClipboard_find_primary_selection_data (const char *, ssize_t *); +extern char *BClipboard_find_secondary_selection_data (const char *, ssize_t *); + +extern void BClipboard_set_system_data (const char *, const char *, ssize_t, bool); +extern void BClipboard_set_primary_selection_data (const char *, const char *, + ssize_t, bool); +extern void BClipboard_set_secondary_selection_data (const char *, const char *, + ssize_t, bool); + +extern void BClipboard_system_targets (char **, int); +extern void BClipboard_primary_targets (char **, int); +extern void BClipboard_secondary_targets (char **, int); + +extern bool BClipboard_owns_clipboard (void); +extern bool BClipboard_owns_primary (void); +extern bool BClipboard_owns_secondary (void); + +/* Free the returned data. */ +extern void BClipboard_free_data (void *); + +extern int be_enum_message (void *, int32 *, int32, int32 *, const char **); +extern int be_get_message_data (void *, const char *, int32, int32, + const void **, ssize_t *); +extern int be_get_refs_data (void *, const char *, int32, char **); +extern int be_get_point_data (void *, const char *, int32, float *, float *); +extern uint32 be_get_message_type (void *); +extern void be_set_message_type (void *, uint32); +extern void *be_get_message_message (void *, const char *, int32); +extern void *be_create_simple_message (void); +extern int be_add_message_data (void *, const char *, int32, const void *, ssize_t); +extern int be_add_refs_data (void *, const char *, const char *); +extern int be_add_point_data (void *, const char *, float, float); +extern int be_add_message_message (void *, const char *, void *); +extern int be_lock_clipboard_message (enum haiku_clipboard, void **, bool); +extern void be_unlock_clipboard (enum haiku_clipboard, bool); #ifdef __cplusplus }; #endif #endif /* _HAIKU_SELECT_H_ */ + +// Local Variables: +// eval: (setf (alist-get 'inextern-lang c-offsets-alist) 0) +// End: diff --git a/src/haikuterm.c b/src/haikuterm.c index 6137e985b4..74a34fdb4b 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -2769,23 +2769,26 @@ flush_dirty_back_buffers (void) static int haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) { - block_input (); - int message_count = 0; - static void *buf = NULL; + int message_count; + static void *buf; ssize_t b_size; struct unhandled_event *unhandled_events = NULL; - int button_or_motion_p; - int need_flush = 0; - int do_help = 0; + int button_or_motion_p, need_flush, do_help; + enum haiku_event_type type; + struct input_event inev, inev2; + message_count = 0; + need_flush = 0; + button_or_motion_p = 0; + do_help = 0; + buf = NULL; + + block_input (); if (!buf) buf = xmalloc (200); haiku_read_size (&b_size, false); while (b_size >= 0) { - enum haiku_event_type type; - struct input_event inev, inev2; - if (b_size > 200) emacs_abort (); @@ -2797,7 +2800,6 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) inev2.arg = Qnil; button_or_motion_p = 0; - haiku_read (&type, buf, b_size); switch (type) @@ -2864,7 +2866,6 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) continue; expose_frame (f, b->x, b->y, b->width, b->height); - haiku_clear_under_internal_border (f); break; } @@ -2874,6 +2875,9 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) Mouse_HLInfo *hlinfo = &x_display_list->mouse_highlight; struct frame *f = haiku_window_to_frame (b->window); + if (!f) + continue; + /* If mouse-highlight is an integer, input clears out mouse highlighting. */ if (!hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight) @@ -2886,9 +2890,6 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) need_flush = 1; } - if (!f) - continue; - inev.code = b->keysym ? b->keysym : b->multibyte_char; if (b->keysym) @@ -2917,8 +2918,8 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) if (!f) continue; - if ((x_display_list->focus_event_frame != f && b->activated_p) || - (x_display_list->focus_event_frame == f && !b->activated_p)) + if ((x_display_list->focus_event_frame != f && b->activated_p) + || (x_display_list->focus_event_frame == f && !b->activated_p)) { haiku_new_focus_frame (b->activated_p ? f : NULL); if (b->activated_p) commit 2c5b4ae93a8dadad37a147bfde5369e0ad5de01a Author: Po Lu Date: Fri Apr 15 14:08:40 2022 +0800 Add missing extern declarations to headers * src/xterm.h (xi_device_from_id, xi_frame_selected_for): Add `extern' declaration. diff --git a/src/xterm.h b/src/xterm.h index defeaacc0d..a04596cdb1 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -1574,8 +1574,8 @@ extern bool x_dnd_in_progress; extern struct frame *x_dnd_frame; #ifdef HAVE_XINPUT2 -struct xi_device_t *xi_device_from_id (struct x_display_info *, int); -bool xi_frame_selected_for (struct frame *, unsigned long); +extern struct xi_device_t *xi_device_from_id (struct x_display_info *, int); +extern bool xi_frame_selected_for (struct frame *, unsigned long); #endif extern void mark_xterm (void); commit 24df0273e926b499445daa7d4ad90cc6f73e3a15 Author: Po Lu Date: Fri Apr 15 02:38:19 2022 +0000 Make Haiku scroll bar behave more like other programs * haiku_support.cc (class EmacsScrollBar): New field `repeater_start'. (Pulse): Wait for time to pass repeater_delay. (MouseDown): Set it to the current time + the system repeater delay. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 0642dbacff..d92e3d95ac 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -1787,6 +1787,7 @@ class EmacsScrollBar : public BScrollBar int last_reported_overscroll_value; int max_value, real_max_value; int overscroll_start_value; + bigtime_t repeater_start; EmacsScrollBar (int x, int y, int x1, int y1, bool horizontal_p) : BScrollBar (BRect (x, y, x1, y1), NULL, NULL, 0, 0, horizontal_p ? @@ -1874,14 +1875,17 @@ class EmacsScrollBar : public BScrollBar return; } - GetMouse (&point, &buttons, false); - - if (ButtonRegionFor (current_part).Contains (point)) + if (repeater_start < system_time ()) { - rq.scroll_bar = this; - rq.window = Window (); - rq.part = current_part; - haiku_write (SCROLL_BAR_PART_EVENT, &rq); + GetMouse (&point, &buttons, false); + + if (ButtonRegionFor (current_part).Contains (point)) + { + rq.scroll_bar = this; + rq.window = Window (); + rq.part = current_part; + haiku_write (SCROLL_BAR_PART_EVENT, &rq); + } } BScrollBar::Pulse (); @@ -2015,6 +2019,8 @@ class EmacsScrollBar : public BScrollBar return; } + repeater_start = system_time () + 300000; + if (buttons == B_PRIMARY_MOUSE_BUTTON) { r = ButtonRegionFor (HAIKU_SCROLL_BAR_UP_BUTTON); commit 567051410e61a25e3bfacac43bc071049cf6a285 Author: Paul Eggert Date: Thu Apr 14 19:08:56 2022 -0700 Port new tests to leap seconds or (TICKS . HZ) * test/lisp/mail/ietf-drums-date-tests.el (ietf-drums-date-tests): Don’t assume leap seconds are ignored, or that timestamps are in (HI LO) format. diff --git a/test/lisp/mail/ietf-drums-date-tests.el b/test/lisp/mail/ietf-drums-date-tests.el index 5b798077ff..781d72d352 100644 --- a/test/lisp/mail/ietf-drums-date-tests.el +++ b/test/lisp/mail/ietf-drums-date-tests.el @@ -52,52 +52,34 @@ ;; Start with some compatible RFC822 dates. (dolist (case '(("Mon, 22 Feb 2016 19:35:42 +0100" - (42 35 19 22 2 2016 1 -1 3600) - (22219 21758)) + (42 35 19 22 2 2016 1 -1 3600)) ("22 Feb 2016 19:35:42 +0100" - (42 35 19 22 2 2016 nil -1 3600) - (22219 21758)) + (42 35 19 22 2 2016 nil -1 3600)) ("Mon, 22 February 2016 19:35:42 +0100" - (42 35 19 22 2 2016 1 -1 3600) - (22219 21758)) + (42 35 19 22 2 2016 1 -1 3600)) ("Mon, 22 feb 2016 19:35:42 +0100" - (42 35 19 22 2 2016 1 -1 3600) - (22219 21758)) + (42 35 19 22 2 2016 1 -1 3600)) ("Monday, 22 february 2016 19:35:42 +0100" - (42 35 19 22 2 2016 1 -1 3600) - (22219 21758)) + (42 35 19 22 2 2016 1 -1 3600)) ("Monday, 22 february 2016 19:35:42 PST" - (42 35 19 22 2 2016 1 nil -28800) - (22219 54158)) + (42 35 19 22 2 2016 1 nil -28800)) ("Friday, 21 Sep 2018 13:47:58 PDT" - (58 47 13 21 9 2018 5 t -25200) - (23461 22782)) + (58 47 13 21 9 2018 5 t -25200)) ("Friday, 21 Sep 2018 13:47:58 EDT" - (58 47 13 21 9 2018 5 t -14400) - (23461 11982)))) + (58 47 13 21 9 2018 5 t -14400)) + ("Mon, 22 Feb 2016 19:35:42" + (42 35 19 22 2 2016 1 -1 nil)) + ("Friday, 21 Sep 2018 13:47:58" + (58 47 13 21 9 2018 5 -1 nil)))) (let* ((input (car case)) - (parsed (cadr case)) - (encoded (caddr case))) + (parsed (cadr case))) ;; The input should parse the same without RFC822. (should (equal (ietf-drums-parse-date-string input) parsed)) (should (equal (ietf-drums-parse-date-string input nil t) parsed)) ;; Check the encoded date (the official output, though the ;; decoded-time is easier to debug). - (should (equal (ietf-drums-parse-date input) encoded)))) - - ;; Test a few without timezones. - (dolist (case '(("Mon, 22 Feb 2016 19:35:42" - (42 35 19 22 2 2016 1 -1 nil)) - ("Friday, 21 Sep 2018 13:47:58" - (58 47 13 21 9 2018 5 -1 nil)))) - (let* ((input (car case)) - (parsed (cadr case))) - ;; The input should parse the same without RFC822. - (should (equal (ietf-drums-parse-date-string input) parsed)) - (should (equal (ietf-drums-parse-date-string input nil t) parsed)) - ;; We can't check the encoded date here because it will differ - ;; depending on the TZ of the test environment. - )) + (should (time-equal-p (ietf-drums-parse-date input) + (encode-time parsed))))) ;; Two-digit years are not allowed by the "modern" format. (should (equal (ietf-drums-parse-date-string "22 Feb 16 19:35:42 +0100") commit 7c17bd2a6d8d7cf710051cd7ca00260c1e557609 Author: Paul Eggert Date: Thu Apr 14 19:03:41 2022 -0700 New time-equal-p test * test/src/timefns-tests.el (time-equal-p-NaN-NaN): New test. diff --git a/src/timefns.c b/src/timefns.c index 6cfb787af8..b061be0a78 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -1221,7 +1221,8 @@ time_cmp (Lisp_Object a, Lisp_Object b) /* Compare nil to nil correctly, and handle other eq values quicker while we're at it. Compare here rather than earlier, to handle - NaNs and check formats. */ + NaNs. This means (time-equal-p X X) does not signal an error if + X is not a valid time value, but that's OK. */ if (EQ (a, b)) return 0; diff --git a/test/src/timefns-tests.el b/test/src/timefns-tests.el index 1b49e0622f..e7c464472d 100644 --- a/test/src/timefns-tests.el +++ b/test/src/timefns-tests.el @@ -169,6 +169,10 @@ a fixed place on the right and are padded on the left." (ert-deftest time-equal-p-nil-nil () (should (time-equal-p nil nil))) +(ert-deftest time-equal-p-NaN-NaN () + (let ((x 0.0e+NaN)) + (should (not (time-equal-p x x))))) + (ert-deftest time-arith-tests () (let ((time-values (list 0 -1 1 0.0 -0.0 -1.0 1.0 most-negative-fixnum most-positive-fixnum commit 6c4559d13865cb5761071ac59f395718b85eb41c Author: Po Lu Date: Fri Apr 15 01:23:27 2022 +0000 Properly wait for app thread exit on Haiku * src/haiku_support.cc (MessageReceived): Handle QUIT_APPLICATION. (start_running_application): Clean up code a little. (wait_for_exit_of_app_thread): New function. (BApplication_setup): Add atexit handler to clean up app thread. (be_app_quit): Delete function. * src/haikuterm.c (haiku_delete_terminal): Un-implement function. * src/haikuterm.h: Update prototypes. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index f0db852e26..0642dbacff 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -89,6 +89,7 @@ enum CANCEL_DROP = 3003, SHOW_MENU_BAR = 3004, BE_MENU_BAR_OPEN = 3005, + QUIT_APPLICATION = 3006, }; static color_space dpy_color_space = B_NO_COLOR_SPACE; @@ -418,6 +419,15 @@ class Emacs : public BApplication haiku_write (APP_QUIT_REQUESTED_EVENT, &rq); return 0; } + + void + MessageReceived (BMessage *msg) + { + if (msg->what == QUIT_APPLICATION) + Quit (); + else + BApplication::MessageReceived (msg); + } }; class EmacsWindow : public BWindow @@ -2328,13 +2338,15 @@ class EmacsPopUpMenu : public BPopUpMenu static int32 start_running_application (void *data) { + Emacs *app = (Emacs *) data; + haiku_io_init_in_app_thread (); - if (!((Emacs *) data)->Lock ()) + if (!app->Lock ()) gui_abort ("Failed to lock application"); - ((Emacs *) data)->Run (); - ((Emacs *) data)->Unlock (); + app->Run (); + app->Unlock (); return 0; } @@ -2404,25 +2416,37 @@ BBitmap_dimensions (void *bitmap, int *left, int *top, *mono_p = (((BBitmap *) bitmap)->ColorSpace () == B_GRAY1); } +static void +wait_for_exit_of_app_thread (void) +{ + status_t ret; + + be_app->PostMessage (QUIT_APPLICATION); + wait_for_thread (app_thread, &ret); +} + /* Set up an application and return it. If starting the application thread fails, abort Emacs. */ void * BApplication_setup (void) { - if (be_app) - return be_app; thread_id id; Emacs *app; + if (be_app) + return be_app; + app = new Emacs; app->Unlock (); + if ((id = spawn_thread (start_running_application, "Emacs app thread", B_DEFAULT_MEDIA_PRIORITY, app)) < 0) gui_abort ("spawn_thread failed"); resume_thread (id); - app_thread = id; + + atexit (wait_for_exit_of_app_thread); return app; } @@ -3772,16 +3796,6 @@ be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, int } } -void -be_app_quit (void) -{ - if (be_app) - { - while (!be_app->Lock ()); - be_app->Quit (); - } -} - /* Zoom WINDOW. */ void BWindow_zoom (void *window) diff --git a/src/haikuterm.c b/src/haikuterm.c index bc21276437..6137e985b4 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -115,44 +115,7 @@ haiku_toolkit_position (struct frame *f, int x, int y, static void haiku_delete_terminal (struct terminal *terminal) { - struct haiku_display_info *dpyinfo = terminal->display_info.haiku; - struct terminal *t; - - if (!terminal->name) - return; - - block_input (); - - be_app_quit (); - delete_port (port_application_to_emacs); - - BCursor_delete (dpyinfo->text_cursor); - BCursor_delete (dpyinfo->nontext_cursor); - BCursor_delete (dpyinfo->modeline_cursor); - BCursor_delete (dpyinfo->hand_cursor); - BCursor_delete (dpyinfo->hourglass_cursor); - BCursor_delete (dpyinfo->horizontal_drag_cursor); - BCursor_delete (dpyinfo->vertical_drag_cursor); - BCursor_delete (dpyinfo->left_edge_cursor); - BCursor_delete (dpyinfo->top_left_corner_cursor); - BCursor_delete (dpyinfo->top_edge_cursor); - BCursor_delete (dpyinfo->top_right_corner_cursor); - BCursor_delete (dpyinfo->right_edge_cursor); - BCursor_delete (dpyinfo->bottom_right_corner_cursor); - BCursor_delete (dpyinfo->bottom_edge_cursor); - BCursor_delete (dpyinfo->bottom_left_corner_cursor); - BCursor_delete (dpyinfo->no_cursor); - - /* Close all frames and delete the generic struct terminal. */ - for (t = terminal_list; t; t = t->next_terminal) - { - if (t->type == output_haiku && t->display_info.haiku == dpyinfo) - { - delete_terminal (t); - break; - } - } - unblock_input (); + error ("The Haiku terminal cannot be deleted"); } static const char * diff --git a/src/haikuterm.h b/src/haikuterm.h index 5f905ab400..7022ea77de 100644 --- a/src/haikuterm.h +++ b/src/haikuterm.h @@ -260,8 +260,6 @@ extern void syms_of_haikufont (void); extern void syms_of_haikuselect (void); extern void init_haiku_select (void); -extern void be_app_quit (void); - extern void haiku_iconify_frame (struct frame *); extern void haiku_visualize_frame (struct frame *); extern void haiku_unvisualize_frame (struct frame *); commit 804d919ac5ca228164bf3a74b3911fa2f946fc7a Author: Po Lu Date: Fri Apr 15 08:55:22 2022 +0800 Fix calls to XKB functions without testing for server support * src/xterm.c (x_dnd_cleanup_drag_and_drop): (x_dnd_begin_drag_and_drop): Never call XkbSelectEvents if the X server doesn't have XKB. diff --git a/src/xterm.c b/src/xterm.c index da4af8bff7..289ea06d92 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3615,8 +3615,9 @@ x_dnd_cleanup_drag_and_drop (void *frame) x_dnd_old_window_attrs.your_event_mask); #ifdef HAVE_XKB - XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, - XkbStateNotifyMask, 0); + if (FRAME_DISPLAY_INFO (f)->supports_xkb) + XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + XkbStateNotifyMask, 0); #endif unblock_input (); @@ -9760,8 +9761,9 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, FRAME_DISPLAY_INFO (f)->root_window, root_window_attrs.your_event_mask); #ifdef HAVE_XKB - XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, - XkbStateNotifyMask, 0); + if (FRAME_DISPLAY_INFO (f)->supports_xkb) + XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + XkbStateNotifyMask, 0); #endif quit (); } @@ -9781,8 +9783,9 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, FRAME_DISPLAY_INFO (f)->root_window, root_window_attrs.your_event_mask); #ifdef HAVE_XKB - XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, - XkbStateNotifyMask, 0); + if (FRAME_DISPLAY_INFO (f)->supports_xkb) + XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + XkbStateNotifyMask, 0); #endif unblock_input (); commit 807682de1e427ec5a9b43e8fb6a4c9befa73fed3 Author: Lars Ingebrigtsen Date: Thu Apr 14 19:48:47 2022 +0200 Allow dragging dividers in vtable * lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Allow dragging dividers. (vtable--drag-resize-column): Adjust function. diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index 5900d886e8..9201fea365 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -574,16 +574,22 @@ This also updates the displayed table." (defun vtable--insert-header-line (table widths spacer) ;; Insert the header directly into the buffer. (let ((start (point)) - (divider (vtable-divider table))) + (divider (vtable-divider table)) + (cmap (define-keymap + " " #'vtable--drag-resize-column + " " #'ignore)) + (dmap (define-keymap + " " + (lambda (e) + (interactive "e") + (vtable--drag-resize-column e t)) + " " #'ignore))) (seq-do-indexed (lambda (column index) (let* ((name (propertize (vtable-column-name column) 'face (list 'header-line (vtable-face table)) - 'keymap (define-keymap - " " - #'vtable--drag-resize-column - " " #'ignore))) + 'keymap cmap)) (start (point)) (indicator (vtable--indicator table index)) (indicator-width (string-pixel-width indicator)) @@ -604,14 +610,15 @@ This also updates the displayed table." (string-pixel-width displayed)) (if last 0 spacer)))))) (when (and divider (not last)) - (insert divider)) + (insert (propertize divider 'keymap dmap))) (put-text-property start (point) 'vtable-column index))) (vtable-columns table)) (insert "\n") (add-face-text-property start (point) 'header-line))) -(defun vtable--drag-resize-column (e) - "Resize the column by dragging." +(defun vtable--drag-resize-column (e &optional next) + "Resize the column by dragging. +If NEXT, do the next column." (interactive "e") (let* ((pos-start (event-start e)) (obj (posn-object pos-start))) @@ -623,9 +630,11 @@ This also updates the displayed table." (car obj))) (start-x (car (posn-x-y pos-start))) (end-x (car (posn-x-y (event-end e))))) - (when (> column 0) + (when (or (> column 0) next) (vtable--alter-column-width (vtable-current-table) - (1- column) + (if next + column + (1- column)) (- end-x start-x))))))) (defun vtable--recompute-numerical (table line) commit 67e7870a621aacd8fd5d096fe673d86cc1f3a0f5 Author: Eli Zaretskii Date: Thu Apr 14 20:40:24 2022 +0300 Fix mouse clicks in hscrolled window with variable-height fonts * src/xdisp.c (move_it_in_display_line_to): Fix calculation of height of a screen-line that is completely hscrolled out of view. Reported by Yasushi SHOJI . diff --git a/src/xdisp.c b/src/xdisp.c index 6a0d0ea879..2dbc68f657 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9910,6 +9910,18 @@ move_it_in_display_line_to (struct it *it, } else result = MOVE_NEWLINE_OR_CR; + /* If lines are truncated, and the line we moved across is + completely hscrolled out of view, reset the line metrics + to those of the newline we've just processed, so that + glyphs not on display don't affect the line's height. */ + if (it->line_wrap == TRUNCATE + && it->current_x <= it->first_visible_x + && result == MOVE_NEWLINE_OR_CR + && it->char_to_display == '\n') + { + it->max_ascent = it->ascent; + it->max_descent = it->descent; + } /* If we've processed the newline, make sure this flag is reset, as it must only be set when the newline itself is processed. */ commit be54c25dbb42425701cee3d669d37acdacfa17ce Author: Lars Ingebrigtsen Date: Thu Apr 14 19:36:08 2022 +0200 Allow resizing vtable columns by dragging * lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Allow resizing by dragging headers. (vtable--drag-resize-column): New function. (vtable-narrow-current-column): Refactor out common bits. (vtable--alter-column-width): To here. (vtable-widen-current-column): Rewrite to use vtable-narrow-current-column. diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index d53f8b0745..5900d886e8 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -579,7 +579,11 @@ This also updates the displayed table." (lambda (column index) (let* ((name (propertize (vtable-column-name column) - 'face (list 'header-line (vtable-face table)))) + 'face (list 'header-line (vtable-face table)) + 'keymap (define-keymap + " " + #'vtable--drag-resize-column + " " #'ignore))) (start (point)) (indicator (vtable--indicator table index)) (indicator-width (string-pixel-width indicator)) @@ -606,6 +610,24 @@ This also updates the displayed table." (insert "\n") (add-face-text-property start (point) 'header-line))) +(defun vtable--drag-resize-column (e) + "Resize the column by dragging." + (interactive "e") + (let* ((pos-start (event-start e)) + (obj (posn-object pos-start))) + (with-current-buffer (window-buffer (posn-window pos-start)) + (let ((column + (get-text-property (if obj (cdr obj) + (posn-point pos-start)) + 'vtable-column + (car obj))) + (start-x (car (posn-x-y pos-start))) + (end-x (car (posn-x-y (event-end e))))) + (when (> column 0) + (vtable--alter-column-width (vtable-current-table) + (1- column) + (- end-x start-x))))))) + (defun vtable--recompute-numerical (table line) "Recompute numericalness of columns if necessary." (let ((columns (vtable-columns table)) @@ -768,14 +790,17 @@ If N isn't given, N defaults to 1. Interactively, N is the prefix argument." (interactive "p") (let* ((table (vtable-current-table)) - (column (vtable-current-column)) - (widths (vtable--widths table))) + (column (vtable-current-column))) (unless column (user-error "No column under point")) + (vtable--alter-column-width table column + (- (* (vtable--char-width table) (or n 1)))))) + +(defun vtable--alter-column-width (table column delta) + (let ((widths (vtable--widths table))) (setf (aref widths column) (max (* (vtable--char-width table) 2) - (- (aref widths column) - (* (vtable--char-width table) (or n 1))))) + (+ (aref widths column) delta))) ;; Store the width so it'll be respected on a revert. (setf (vtable-column-width (elt (vtable-columns table) column)) (format "%dpx" (aref widths column))) @@ -787,17 +812,7 @@ If N isn't given, N defaults to 1. Interactively, N is the prefix argument." (interactive "p") - (let* ((table (vtable-current-table)) - (column (vtable-current-column)) - (widths (vtable--widths table))) - (unless column - (user-error "No column under point")) - (cl-incf (aref widths column) - (* (vtable--char-width table) (or n 1))) - ;; Store the width so it'll be respected on a revert. - (setf (vtable-column-width (elt (vtable-columns table) column)) - (format "%dpx" (aref widths column))) - (vtable-revert))) + (vtable-narrow-current-column (- n))) (defun vtable-previous-column () "Go to the previous column." commit eab0105696f6cd306842e3ede1830fbf1c7057ec Author: Stefan Monnier Date: Thu Apr 14 12:55:23 2022 -0400 * lisp/gnus/gnus.el (toplevel autoloads): Fix file name `score-mode` does not define `gnus-score-edit-all-score`, it's defined in `gnus-score` instead. diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 0daecf7df5..4754a14147 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -2529,7 +2529,8 @@ are always t.") ("nnmail" nnmail-split-fancy nnmail-article-group) ("nnvirtual" nnvirtual-catchup-group nnvirtual-convert-headers) ("gnus-xmas" gnus-xmas-splash) - ("score-mode" :interactive t gnus-score-mode gnus-score-edit-all-score) + ("score-mode" :interactive t gnus-score-mode) + ("gnus-score" :interactive t gnus-score-edit-all-score) ("gnus-mh" gnus-summary-save-article-folder gnus-Folder-save-name gnus-folder-save-name) ("gnus-mh" :interactive (gnus-summary-mode) gnus-summary-save-in-folder) commit bd67ffa1790b620b2beebdc32080d70b76e71029 Author: Philip Kaludercic Date: Thu Apr 14 12:13:27 2022 +0200 Have submit-emacs-patch prompt for patch file before subject * emacsbug.el (submit-emacs-patch): Prompt for patch file and use that to guess the subject. diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index 1bda609d10..8cb4a00009 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -488,7 +488,14 @@ and send the mail again%s." Interactively, you will be prompted for SUBJECT and a patch FILE name (which will be attached to the mail). You will end up in a Message buffer where you can explain more about the patch." - (interactive "sThis patch is about: \nfPatch file name: ") + (interactive + (let* ((file (read-file-name "Patch file name: ")) + (guess (with-temp-buffer + (insert-file-contents file) + (mail-fetch-field "Subject")))) + (list (read-string (format-prompt "This patch is about" guess) + nil nil guess) + file))) (switch-to-buffer "*Patch Help*") (let ((inhibit-read-only t)) (erase-buffer) commit 17b639aabb457ca6ffbcb6fdb73c03571fb0e360 Author: Philip Kaludercic Date: Thu Apr 14 11:00:07 2022 +0200 Avoid possibly unnecessary lisp_time_struct call * timefns.c (time_cmp): Defer the calculation of the time struct, in case A and B are eq to one another. diff --git a/src/timefns.c b/src/timefns.c index 9e8592d35a..6cfb787af8 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -1219,8 +1219,6 @@ time_cmp (Lisp_Object a, Lisp_Object b) return da < db ? -1 : da != db; } - struct lisp_time ta = lisp_time_struct (a, 0); - /* Compare nil to nil correctly, and handle other eq values quicker while we're at it. Compare here rather than earlier, to handle NaNs and check formats. */ @@ -1229,6 +1227,7 @@ time_cmp (Lisp_Object a, Lisp_Object b) /* Compare (ATICKS . AZ) to (BTICKS . BHZ) by comparing ATICKS * BHZ to BTICKS * AHZ. */ + struct lisp_time ta = lisp_time_struct (a, 0); struct lisp_time tb = lisp_time_struct (b, 0); mpz_t const *za = bignum_integer (&mpz[0], ta.ticks); mpz_t const *zb = bignum_integer (&mpz[1], tb.ticks); commit 346749f67db3fd2c0cca0b5615d9fc3f878aa65f Author: Lars Ingebrigtsen Date: Thu Apr 14 18:08:00 2022 +0200 Handle non-ASCII domains correctly in url-https-proxy-connect * lisp/url/url-http.el (url-https-proxy-connect) (url-https-proxy-after-change-function): Handle IDNA domains correctly. diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index daeba17031..96a4742956 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -1405,10 +1405,10 @@ The return value of this function is the retrieval buffer." (and proxy-auth (concat "Proxy-Authorization: " proxy-auth "\r\n"))) "\r\n") - (url-host url-current-object) + (puny-encode-domain (url-host url-current-object)) (or (url-port url-current-object) url-https-default-port) - (url-host url-current-object)))) + (puny-encode-domain (url-host url-current-object))))) (defun url-https-proxy-after-change-function (_st _nd _length) (let* ((process-buffer (current-buffer)) @@ -1430,12 +1430,12 @@ The return value of this function is the retrieval buffer." (condition-case e (let ((tls-connection (gnutls-negotiate :process proc - :hostname (url-host url-current-object) + :hostname (puny-encode-domain (url-host url-current-object)) :verify-error nil))) ;; check certificate validity (setq tls-connection (nsm-verify-connection tls-connection - (url-host url-current-object) + (puny-encode-domain (url-host url-current-object)) (url-port url-current-object))) (with-current-buffer process-buffer (erase-buffer)) (set-process-buffer tls-connection process-buffer) commit f498d055a4bd8f7b650faddd8033100069750d78 Author: Lars Ingebrigtsen Date: Thu Apr 14 18:03:58 2022 +0200 Make vtable remember user-altered column widths * lisp/emacs-lisp/vtable.el (vtable-narrow-current-column) (vtable-widen-current-column): Store the size to that it's respected on `g'. diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index 66feec4e69..d53f8b0745 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -776,6 +776,9 @@ Interactively, N is the prefix argument." (max (* (vtable--char-width table) 2) (- (aref widths column) (* (vtable--char-width table) (or n 1))))) + ;; Store the width so it'll be respected on a revert. + (setf (vtable-column-width (elt (vtable-columns table) column)) + (format "%dpx" (aref widths column))) (vtable-revert))) (defun vtable-widen-current-column (&optional n) @@ -791,6 +794,9 @@ Interactively, N is the prefix argument." (user-error "No column under point")) (cl-incf (aref widths column) (* (vtable--char-width table) (or n 1))) + ;; Store the width so it'll be respected on a revert. + (setf (vtable-column-width (elt (vtable-columns table) column)) + (format "%dpx" (aref widths column))) (vtable-revert))) (defun vtable-previous-column () commit e7f7930a61e6603a3d489b5d09db24ac48870f49 Author: Lars Ingebrigtsen Date: Thu Apr 14 16:25:31 2022 +0200 Ensure that commands like { work on all frames in vtable * lisp/emacs-lisp/vtable.el (vtable--recompute-cache) (vtable--ensure-cache): New functions. (vtable-insert): Use it. (vtable--widths): Ditto. diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index f14c9ae9a6..66feec4e69 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -383,6 +383,16 @@ This also updates the displayed table." (defun vtable--spacer (table) (vtable--compute-width table (vtable-separator-width table))) +(defun vtable--recompute-cache (table) + (let* ((data (vtable--compute-cache table)) + (widths (vtable--compute-widths table data))) + (setf (gethash (vtable--cache-key) (slot-value table '-cache)) + (list data widths)))) + +(defun vtable--ensure-cache (table) + (or (vtable--cache table) + (vtable--recompute-cache table))) + (defun vtable-insert (table) (let* ((spacer (vtable--spacer table)) (start (point)) @@ -391,17 +401,10 @@ This also updates the displayed table." 'face (vtable-face table)) "")) (ellipsis-width (string-pixel-width ellipsis)) - data widths) - ;; We maintain a cache per screen/window width, so that we render - ;; correctly if Emacs is open on two different screens (or the - ;; user resizes the frame). - (if-let ((cache (vtable--cache table))) - (setq data (nth 0 cache) - widths (nth 1 cache)) - (setq data (vtable--compute-cache table) - widths (vtable--compute-widths table data)) - (setf (gethash (vtable--cache-key) (slot-value table '-cache)) - (list data widths))) + ;; We maintain a cache per screen/window width, so that we render + ;; correctly if Emacs is open on two different screens (or the + ;; user resizes the frame). + (widths (nth 1 (vtable--ensure-cache table)))) (if (vtable-use-header-line table) (vtable--set-header-line table widths spacer) ;; Insert the header line directly into the buffer, and put a @@ -746,7 +749,7 @@ This also updates the displayed table." (vtable-goto-column column)))) (defun vtable--widths (table) - (nth 1 (vtable--cache table))) + (nth 1 (vtable--ensure-cache table))) ;;; Commands. @@ -783,7 +786,7 @@ Interactively, N is the prefix argument." (interactive "p") (let* ((table (vtable-current-table)) (column (vtable-current-column)) - (widths (nth 1 (vtable--cache table)))) + (widths (vtable--widths table))) (unless column (user-error "No column under point")) (cl-incf (aref widths column) commit 831314b08b8d48d181691c913c094ad98e735181 Author: Filipp Gunbin Date: Thu Apr 14 16:47:32 2022 +0300 ldap-search-internal cleanup * lisp/net/ldap.el (ldap-ldapsearch-args): Change -LL to -LLL to suppress ldif version output. (ldap-search-internal): Remove skipping of version output. Remove redundand ws skipping. diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el index 9463282135..da45457891 100644 --- a/lisp/net/ldap.el +++ b/lisp/net/ldap.el @@ -148,7 +148,7 @@ Valid properties include: "The name of the ldapsearch command line program." :type '(string :tag "`ldapsearch' Program")) -(defcustom ldap-ldapsearch-args '("-LL" "-tt") +(defcustom ldap-ldapsearch-args '("-LLL" "-tt") "A list of additional arguments to pass to `ldapsearch'." :type '(repeat :tag "`ldapsearch' Arguments" (string :tag "Argument"))) @@ -682,7 +682,7 @@ an alist of attribute/value pairs." (while (re-search-forward (concat "[\t\n\f]+ \\|" ldap-ldapsearch-password-prompt-regexp) nil t) - (replace-match "" nil nil)) + (replace-match "")) (goto-char (point-min)) (if (looking-at "usage") @@ -691,7 +691,6 @@ an alist of attribute/value pairs." ;; Skip error message when retrieving attribute list (if (looking-at "Size limit exceeded") (forward-line 1)) - (if (looking-at "version:") (forward-line 1)) ;bug#12724. (while (progn (skip-chars-forward " \t\n") (not (eobp))) @@ -724,7 +723,6 @@ an alist of attribute/value pairs." (record (push (nreverse record) result))) (setq record nil) - (skip-chars-forward " \t\n") (message "Parsing results... %d" numres) (setq numres (1+ numres))) (message "Parsing results... done") commit 2a2f5530fa230e2b994be5683e63763833bb6a0a Author: Filipp Gunbin Date: Wed Apr 13 23:10:35 2022 +0300 Fix eudc-get-attribute-list * lisp/net/eudc-vars.el (eudc-ldap-no-wildcard-attributes): New defcustom. * doc/misc/eudc.texi (LDAP Configuration): Mention it. * lisp/net/eudcb-ldap.el (eudc-ldap-format-query-as-rfc1558): Use it. (eudc-ldap-get-field-list): Set scope and sizelimit, instead of overriding the whole ldap-host-parameters-alist. * lisp/net/ldap.el (ldap-search-internal): Allow "size limit exceeded" exit code. Allow empty attribute values. diff --git a/doc/misc/eudc.texi b/doc/misc/eudc.texi index 71e3e6b9ed..d2850282fe 100644 --- a/doc/misc/eudc.texi +++ b/doc/misc/eudc.texi @@ -254,7 +254,9 @@ To: * Smith @noindent will return all LDAP entries with surnames that begin with @code{Smith}. In every LDAP query it makes, EUDC implicitly appends -the wildcard character to the end of the last word. +the wildcard character to the end of the last word, except if the word +corresponds to an attribute which is a member of +`eudc-ldap-no-wildcard-attributes'. @menu * Emacs-only Configuration:: Configure with @file{.emacs} diff --git a/lisp/net/eudc-vars.el b/lisp/net/eudc-vars.el index d58fab896e..90d89e87fb 100644 --- a/lisp/net/eudc-vars.el +++ b/lisp/net/eudc-vars.el @@ -425,6 +425,15 @@ BBDB fields. SPECs are sexps which are evaluated: (symbol :tag "BBDB Field") (sexp :tag "Conversion Spec")))) +(defcustom eudc-ldap-no-wildcard-attributes + '(objectclass objectcategory) + "LDAP attributes which are always searched for without wildcard character. +This is the list of special dictionary-valued attributes, where +wildcarded search may fail. For example, it fails with +objectclass in Active Directory servers." + :type '(repeat (symbol :tag "Directory attribute"))) + + ;;}}} ;;{{{ BBDB Custom Group diff --git a/lisp/net/eudcb-ldap.el b/lisp/net/eudcb-ldap.el index 365dace961..1201c84f2d 100644 --- a/lisp/net/eudcb-ldap.el +++ b/lisp/net/eudcb-ldap.el @@ -151,16 +151,20 @@ attribute names are returned. Default to `person'." (interactive) (or eudc-server (call-interactively 'eudc-set-server)) - (let ((ldap-host-parameters-alist - (list (cons eudc-server - '(scope subtree sizelimit 1))))) - (mapcar #'eudc-ldap-cleanup-record-filtering-addresses - (ldap-search - (eudc-ldap-format-query-as-rfc1558 - (list (cons "objectclass" - (or objectclass - "person")))) - eudc-server nil t)))) + (let ((plist (copy-sequence + (alist-get eudc-server ldap-host-parameters-alist + nil nil #'equal)))) + (plist-put plist 'scope 'subtree) + (plist-put plist 'sizelimit '1) + (let ((ldap-host-parameters-alist + (list (cons eudc-server plist)))) + (mapcar #'eudc-ldap-cleanup-record-filtering-addresses + (ldap-search + (eudc-ldap-format-query-as-rfc1558 + (list (cons 'objectclass + (or objectclass + "person")))) + eudc-server nil t))))) (defun eudc-ldap-escape-query-special-chars (string) "Value is STRING with characters forbidden in LDAP queries escaped." @@ -178,12 +182,17 @@ attribute names are returned. Default to `person'." (defun eudc-ldap-format-query-as-rfc1558 (query) "Format the EUDC QUERY list as a RFC1558 LDAP search filter." - (let ((formatter (lambda (item &optional wildcard) - (format "(%s=%s)" - (car item) - (concat - (eudc-ldap-escape-query-special-chars - (cdr item)) (if wildcard "*" "")))))) + (let ((formatter + (lambda (item &optional wildcard) + (format "(%s=%s)" + (car item) + (concat + (eudc-ldap-escape-query-special-chars + (cdr item)) + (if (and wildcard + (not (memq (car item) + eudc-ldap-no-wildcard-attributes))) + "*" "")))))) (format "(&%s)" (concat (mapconcat formatter (butlast query) "") diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el index ce6c270e0b..9463282135 100644 --- a/lisp/net/ldap.el +++ b/lisp/net/ldap.el @@ -663,7 +663,7 @@ an alist of attribute/value pairs." (while (not (memq (process-status proc) '(exit signal))) (sit-for 0.1)) (let ((status (process-exit-status proc))) - (when (not (eq status 0)) + (when (not (memql status '(0 4))) ; 4 = Size limit exceeded ;; Handle invalid credentials exit status specially ;; for ldap-password-read. (if (eq status 49) @@ -699,7 +699,7 @@ an alist of attribute/value pairs." (forward-line 1) (while (looking-at "^\\([A-Za-z][-A-Za-z0-9]*\ \\|[0-9]+\\(?:\\.[0-9]+\\)*\\)\\(;[-A-Za-z0-9]+\\)*[=:\t ]+\ -\\(<[\t ]*file://\\)\\(.*\\)$") +\\(<[\t ]*file://\\)?\\(.*\\)$") (setq name (match-string 1) value (match-string 4)) ;; Need to handle file:///D:/... as generated by OpenLDAP commit 36da6ceb926b684e4cee5888175924ccd79fac83 Author: Nobuyoshi Nakada Date: Thu Apr 14 15:51:04 2022 +0200 Fix electric-help-map problem when help-char has meta-prefix * lisp/ehelp.el (electric-help-map): Fix problem when help-char has meta-prefix (bug#54932). diff --git a/lisp/ehelp.el b/lisp/ehelp.el index 8c1555249c..0c2f02639f 100644 --- a/lisp/ehelp.el +++ b/lisp/ehelp.el @@ -76,7 +76,10 @@ (define-key map [?\C-7] 'electric-help-undefined) (define-key map [?\C-8] 'electric-help-undefined) (define-key map [?\C-9] 'electric-help-undefined) - (define-key map (char-to-string help-char) 'electric-help-help) + (define-key map (if (characterp help-char) + (char-to-string help-char) + (vector help-char)) + 'electric-help-help) (define-key map "?" 'electric-help-help) (define-key map " " 'scroll-up) (define-key map [?\S-\ ] 'scroll-down) commit a9b8ebf34c97098631bf0f4a0fb254ff2f2d898d Author: Po Lu Date: Thu Apr 14 13:14:32 2022 +0000 Fix races with child frame locks on Haiku * src/haiku_support.cc (CHILD_FRAME_LOCK_INSIDE_LOOPER_CALLBACK): New macro. (FrameMoved, WorkspacesChanged): Lock child frame data with that macro instead. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 599ff305ae..f0db852e26 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -131,6 +131,29 @@ static void *grab_view = NULL; static BLocker grab_view_locker; static bool drag_and_drop_in_progress; +/* Many places require us to lock the child frame data, and then lock + the locker of some random window. Unfortunately, locking such a + window might be delayed due to an arriving message, which then + calls a callback inside that window that tries to lock the child + frame data but doesn't finish since the child frame lock is already + held, not letting the code that held the child frame lock proceed, + thereby causing a deadlock. + + Rectifying that problem is simple: all code in a looper callback + must lock the child frame data with this macro instead. + + IOW, If some other code is already running with the child frame + lock held, don't interfere: wait until it's finished before + continuing. */ +#define CHILD_FRAME_LOCK_INSIDE_LOOPER_CALLBACK \ + if (child_frame_lock.LockWithTimeout (200) != B_OK) \ + { \ + /* The Haiku equivalent of XPutBackEvent. */ \ + if (CurrentMessage ()) \ + PostMessage (CurrentMessage ()); \ + } \ + else + /* This could be a private API, but it's used by (at least) the Qt port, so it's probably here to stay. */ extern status_t get_subpixel_antialiasing (bool *); @@ -968,25 +991,28 @@ class EmacsWindow : public BWindow haiku_write (MOVE_EVENT, &rq); - if (!child_frame_lock.Lock ()) - gui_abort ("Failed to lock child frame state lock"); - for (struct child_frame *f = subset_windows; - f; f = f->next) - DoMove (f); - child_frame_lock.Unlock (); + CHILD_FRAME_LOCK_INSIDE_LOOPER_CALLBACK + { + for (struct child_frame *f = subset_windows; + f; f = f->next) + DoMove (f); + child_frame_lock.Unlock (); - BWindow::FrameMoved (newPosition); + BWindow::FrameMoved (newPosition); + } } void WorkspacesChanged (uint32_t old, uint32_t n) { - if (!child_frame_lock.Lock ()) - gui_abort ("Failed to lock child frames for changing workspaces"); - for (struct child_frame *f = subset_windows; - f; f = f->next) - DoUpdateWorkspace (f); - child_frame_lock.Unlock (); + CHILD_FRAME_LOCK_INSIDE_LOOPER_CALLBACK + { + for (struct child_frame *f = subset_windows; + f; f = f->next) + DoUpdateWorkspace (f); + + child_frame_lock.Unlock (); + } } void commit e5ef0fe832a0514f83fea47fa16aab4b1a5d11a4 Author: Po Lu Date: Thu Apr 14 19:02:13 2022 +0800 Keep track of keyboard state during drag and drop * src/xterm.c (x_dnd_cleanup_drag_and_drop): Deselect for keyboard state changes. (x_dnd_begin_drag_and_drop): Select for keyboard state changes when XKB is available. (x_dnd_update_state, handle_one_xevent): Use current XKB state if it is available. (x_term_init): Reformat code a little. diff --git a/src/xterm.c b/src/xterm.c index 94f8ce33bb..da4af8bff7 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -986,6 +986,11 @@ static struct frame *x_dnd_movement_frame; with. */ static int x_dnd_movement_x, x_dnd_movement_y; +#ifdef HAVE_XKB +/* The keyboard state during the drag-and-drop operation. */ +static unsigned int x_dnd_keyboard_state; +#endif + struct x_client_list_window { Window window; @@ -3608,6 +3613,11 @@ x_dnd_cleanup_drag_and_drop (void *frame) XSelectInput (FRAME_X_DISPLAY (f), FRAME_DISPLAY_INFO (f)->root_window, x_dnd_old_window_attrs.your_event_mask); + +#ifdef HAVE_XKB + XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + XkbStateNotifyMask, 0); +#endif unblock_input (); x_dnd_frame = NULL; @@ -9447,6 +9457,9 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, XTextProperty prop; xm_drop_start_message dmsg; Lisp_Object frame_object, x, y, frame, local_value; +#ifdef HAVE_XKB + XkbStateRec keyboard_state; +#endif if (!FRAME_VISIBLE_P (f)) { @@ -9557,6 +9570,20 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, x_dnd_toplevels = NULL; x_dnd_allow_current_frame = allow_current_frame; x_dnd_movement_frame = NULL; +#ifdef HAVE_XKB + x_dnd_keyboard_state = 0; + + if (FRAME_DISPLAY_INFO (f)->supports_xkb) + { + XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + XkbStateNotifyMask, XkbStateNotifyMask); + XkbGetState (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + &keyboard_state); + + x_dnd_keyboard_state = (keyboard_state.mods + | keyboard_state.ptr_buttons); + } +#endif if (x_dnd_use_toplevels) { @@ -9573,10 +9600,6 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, if (EQ (return_frame, Qnow)) x_dnd_return_frame = 2; -#ifdef USE_GTK - current_count = 0; -#endif - /* Now select for SubstructureNotifyMask and PropertyNotifyMask on the root window, so we can get notified when window stacking changes, a common operation during drag-and-drop. */ @@ -9600,6 +9623,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, #ifdef USE_GTK current_finish = X_EVENT_NORMAL; current_hold_quit = &hold_quit; + current_count = 0; #endif block_input (); @@ -9735,6 +9759,10 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, XSelectInput (FRAME_X_DISPLAY (f), FRAME_DISPLAY_INFO (f)->root_window, root_window_attrs.your_event_mask); +#ifdef HAVE_XKB + XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + XkbStateNotifyMask, 0); +#endif quit (); } } @@ -9752,6 +9780,10 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, XSelectInput (FRAME_X_DISPLAY (f), FRAME_DISPLAY_INFO (f)->root_window, root_window_attrs.your_event_mask); +#ifdef HAVE_XKB + XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + XkbStateNotifyMask, 0); +#endif unblock_input (); if (x_dnd_return_frame == 3 @@ -13506,7 +13538,13 @@ x_dnd_update_state (struct x_display_info *dpyinfo, Time timestamp) x_dnd_last_protocol_version, root_x, root_y, x_dnd_selection_timestamp, - x_dnd_wanted_action, 0, 0); + x_dnd_wanted_action, 0, +#ifdef HAVE_XKB + x_dnd_keyboard_state +#else + 0 +#endif + ); else if (XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) && target != None) { if (!x_dnd_motif_setup_p) @@ -18531,6 +18569,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XkbRefreshKeyboardMapping (&xkbevent->map); x_find_modifier_meanings (dpyinfo); } + else if (x_dnd_in_progress + && xkbevent->any.xkb_type == XkbStateNotify) + x_dnd_keyboard_state = (xkbevent->state.mods + | xkbevent->state.ptr_buttons); } #endif #ifdef HAVE_XSHAPE @@ -23001,8 +23043,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) XkbGroupNamesMask | XkbVirtualModNamesMask, dpyinfo->xkb_desc); - XkbSelectEvents (dpyinfo->display, - XkbUseCoreKbd, + XkbSelectEvents (dpyinfo->display, XkbUseCoreKbd, XkbNewKeyboardNotifyMask | XkbMapNotifyMask, XkbNewKeyboardNotifyMask | XkbMapNotifyMask); } commit 203c503ff22e6c3c7b75d0e30d1974bb0ca9e60a Author: Po Lu Date: Thu Apr 14 16:02:12 2022 +0800 Minor fixes to menus on XI2 * src/xfns.c (Fx_create_frame): Populate `xi_masks'. * src/xmenu.c (x_activate_menubar) (create_and_show_popup_menu, x_menu_show): Only clear input extension grabs if we (or the toolkit) actually selected for XI_ButtonPress events. * src/xterm.c (xi_frame_selected_for): New function. (xi_populate_device_from_info, handle_one_xevent): Store device use instead of just whether or not it's a master device. (x_dnd_begin_drag_and_drop): Clean up block_input stuff. * src/xterm.h: Update prototypes. (struct xi_device_t): Rename `master_p' to `use'. diff --git a/src/xfns.c b/src/xfns.c index 5cf3eb4199..195af1381b 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4845,6 +4845,13 @@ This function is an internal primitive--use `make-frame' instead. */) x_icon (f, parms); x_make_gc (f); +#ifdef HAVE_XINPUT2 + if (dpyinfo->supports_xi2) + FRAME_X_OUTPUT (f)->xi_masks + = XIGetSelectedEvents (dpyinfo->display, FRAME_X_WINDOW (f), + &FRAME_X_OUTPUT (f)->num_xi_masks); +#endif + /* Now consider the frame official. */ f->terminal->reference_count++; FRAME_DISPLAY_INFO (f)->reference_count++; diff --git a/src/xmenu.c b/src/xmenu.c index d19fe13c29..94cd9dab69 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -634,15 +634,15 @@ x_activate_menubar (struct frame *f) Otherwise some versions of Motif will emit a warning and hang, and lwlib will fail to destroy the menu window. */ - if (dpyinfo->num_devices) + if (dpyinfo->supports_xi2 + && xi_frame_selected_for (f, XI_ButtonPress)) { for (int i = 0; i < dpyinfo->num_devices; ++i) { if (dpyinfo->devices[i].grab) - { - XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id, - CurrentTime); - } + XIUngrabDevice (dpyinfo->display, + dpyinfo->devices[i].device_id, + CurrentTime); } } #endif @@ -1528,7 +1528,8 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv, } #if !defined HAVE_GTK3 && defined HAVE_XINPUT2 - if (FRAME_DISPLAY_INFO (f)->num_devices) + if (FRAME_DISPLAY_INFO (f)->supports_xi2 + && xi_frame_selected_for (f, XI_ButtonPress)) { for (int i = 0; i < FRAME_DISPLAY_INFO (f)->num_devices; ++i) { @@ -1696,7 +1697,8 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv, if (dpyinfo->supports_xi2) XGrabServer (dpyinfo->display); - if (dpyinfo->num_devices) + if (dpyinfo->supports_xi2 + && xi_frame_selected_for (f, XI_ButtonPress)) { for (int i = 0; i < dpyinfo->num_devices; ++i) { @@ -2677,7 +2679,8 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); /* Clear the XI2 grab so a core grab can be set. */ - if (dpyinfo->num_devices) + if (dpyinfo->supports_xi2 + && xi_frame_selected_for (f, XI_ButtonPress)) { for (int i = 0; i < dpyinfo->num_devices; ++i) { diff --git a/src/xterm.c b/src/xterm.c index 367659d3c1..94f8ce33bb 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3704,6 +3704,29 @@ record_event (char *locus, int type) #endif +#ifdef HAVE_XINPUT2 +bool +xi_frame_selected_for (struct frame *f, unsigned long event) +{ + XIEventMask *masks; + int i; + + masks = FRAME_X_OUTPUT (f)->xi_masks; + + if (!masks) + return false; + + for (i = 0; i < FRAME_X_OUTPUT (f)->num_xi_masks; ++i) + { + if (masks[i].mask_len >= XIMaskLen (event) + && XIMaskIsSet (masks[i].mask, event)) + return true; + } + + return false; +} +#endif + static void x_toolkit_position (struct frame *f, int x, int y, bool *menu_bar_p, bool *tool_bar_p) @@ -3886,8 +3909,7 @@ xi_populate_device_from_info (struct xi_device_t *xi_device, xi_device->touchpoints = NULL; #endif - xi_device->master_p = (device->use == XIMasterKeyboard - || device->use == XIMasterPointer); + xi_device->use = device->use; #ifdef HAVE_XINPUT2_2 xi_device->direct_p = false; #endif @@ -9559,7 +9581,6 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, the root window, so we can get notified when window stacking changes, a common operation during drag-and-drop. */ - block_input (); XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_DISPLAY_INFO (f)->root_window, &root_window_attrs); @@ -9581,6 +9602,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, current_hold_quit = &hold_quit; #endif + block_input (); #ifdef USE_GTK gtk_main_iteration (); #else @@ -9612,6 +9634,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, &next_event, &finish, &hold_quit); #endif #endif + unblock_input (); if (x_dnd_movement_frame) { @@ -9712,7 +9735,6 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, XSelectInput (FRAME_X_DISPLAY (f), FRAME_DISPLAY_INFO (f)->root_window, root_window_attrs.your_event_mask); - unblock_input (); quit (); } } @@ -9725,11 +9747,11 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, #endif x_dnd_movement_frame = NULL; + block_input (); /* Restore the old event mask. */ XSelectInput (FRAME_X_DISPLAY (f), FRAME_DISPLAY_INFO (f)->root_window, root_window_attrs.your_event_mask); - unblock_input (); if (x_dnd_return_frame == 3 @@ -18024,8 +18046,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (info) { if (device && info->enabled) - device->master_p = (info->use == XIMasterKeyboard - || info->use == XIMasterPointer); + device->use = info->use; else if (device) disabled[n_disabled++] = hev->info[i].deviceid; @@ -21666,9 +21687,6 @@ x_free_frame_resources (struct frame *f) #ifdef HAVE_X_I18N if (FRAME_XIC (f)) free_frame_xic (f); - - if (f->output_data.x->preedit_chars) - xfree (f->output_data.x->preedit_chars); #endif #ifdef USE_CAIRO @@ -21821,6 +21839,17 @@ x_destroy_window (struct frame *f) xfree (f->output_data.x->saved_menu_event); xfree (f->output_data.x); + +#ifdef HAVE_X_I18N + if (f->output_data.x->preedit_chars) + xfree (f->output_data.x->preedit_chars); +#endif + +#ifdef HAVE_XINPUT2 + if (f->output_data.x->xi_masks) + XFree (f->output_data.x->xi_masks); +#endif + f->output_data.x = NULL; dpyinfo->reference_count--; diff --git a/src/xterm.h b/src/xterm.h index 7509408268..defeaacc0d 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -232,8 +232,7 @@ struct xi_device_t #ifdef HAVE_XINPUT2_1 int scroll_valuator_count; #endif - int grab; - bool master_p; + int grab, use; #ifdef HAVE_XINPUT2_2 bool direct_p; #endif @@ -977,6 +976,11 @@ struct x_output bool preedit_active; int preedit_caret; #endif + +#ifdef HAVE_XINPUT2 + XIEventMask *xi_masks; + int num_xi_masks; +#endif }; enum @@ -1571,6 +1575,7 @@ extern struct frame *x_dnd_frame; #ifdef HAVE_XINPUT2 struct xi_device_t *xi_device_from_id (struct x_display_info *, int); +bool xi_frame_selected_for (struct frame *, unsigned long); #endif extern void mark_xterm (void);