summaryrefslogtreecommitdiff
path: root/src/haiku_support.h
Commit message (Collapse)AuthorAgeFilesLines
* Implement font-use-system-font on HaikuPo Lu2022-09-251-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/emacs/frames.texi (Fonts): Update documentation to say what font-use-system-font really does and where it can be used. * src/haiku_font_support.cc (language_code_points): Fix coding style. (font_style_to_flags, be_font_style_to_flags): Accept const char *. (be_send_font_settings, be_listen_font_settings) (be_lock_font_defaults, be_unlock_font_defaults) (be_get_font_default, be_get_font_size): New functions used to retrieve default font data. * src/haiku_io.c (haiku_len): Handle FONT_CHANGE_EVENT. * src/haiku_support.h (enum haiku_event_type): New event type FONT_CHANGE_EVENT. (enum haiku_what_font): New enum. (struct haiku_font_change_event): New struct. * src/haikufont.c (Ffont_get_system_normal_font) (Ffont_get_system_font, haiku_handle_font_change_event): New functions. (syms_of_haikufont): Provide `dynamic-setting' and define new variables and subrs. * src/haikuterm.c (haiku_default_font_parameter): Use system font. (haiku_read_socket): Handle FONT_CHANGE_EVENTS. (haiku_term_init): Start listening for font configuration changes. * src/haikuterm.h: Update prototypes. * src/xsettings.c (Ffont_get_system_normal_font) (Ffont_get_system_font): Update doc string. (syms_of_xsettings): Replace calls to intern with a static string.
* Implement wallpaper.el support for HaikuPo Lu2022-09-141-0/+3
| | | | | | | | | | | | | | | | * lisp/image/wallpaper.el (haiku-set-wallpaper, wallpaper-set): Use `haiku-set-wallpaper' on Haiku. * lisp/term/haiku-win.el (haiku-write-node-attribute) (haiku-send-message, haiku-set-wallpaper): New function. * src/haiku_support.cc (be_write_node_message, be_send_message): New functions. * src/haiku_support.h: Update prototypes. * src/haikuselect.c (haiku_message_to_lisp) (haiku_lisp_to_message): Fix CSTR type handling to include NULL byte. (haiku_report_system_error, Fhaiku_write_node_attribute) (Fhaiku_send_message): New functions. (syms_of_haikuselect): Add defsubrs.
* Implement primitive frame synchronization on HaikuPo Lu2022-08-011-0/+1
| | | | | | | | | | | | | | | | | | | Instead of relying on a compositor to do the work, we simply wait for VBLANK and hope that the update finishes soon enough. * doc/lispref/frames.texi (Management Parameters): Document that frame synchronization is now supported on Haiku. * src/haiku_support.cc (class EmacsView): New field `use_frame_synchronization'. (FlipBuffers): Wait for vertical blanking period. (be_set_use_frame_synchronization): New function. * src/haiku_support.h: Update prototypes. * src/haikufns.c (haiku_create_frame): Set `use-frame-synchronization'. (haiku_set_use_frame_synchronization) (haiku_frame_parm_handlers): New param handler.
* Fix grab view persisting on Haiku after popup menu closesPo Lu2022-07-281-0/+1
| | | | | | | | * src/haiku_support.cc (BasicMouseUp): Improve handling of wait_for_release_message. (be_clear_grab_view): New function. * src/haiku_support.h: Update prototypes. * src/haikumenu.c (haiku_menu_show): Call it here.
* ; Fix typosStefan Kangas2022-07-141-1/+1
|
* Improve behavior of sticky tooltips on HaikuPo Lu2022-07-081-2/+1
| | | | | | | | | | | * src/haiku_support.cc (class EmacsView, MouseMoved): Remove `tooltip_position'. (class EmacsMotionSuppressionView): New class. (BView_set_and_show_sticky_tooltip): Rename to `be_show_sticky_tooltip'. Add motion suppression view. * src/haiku_support.h: Update prototypes. * src/haikufns.c (Fx_show_tip): Update for renamed function.
* Port `x-lost-selection-functions' to HaikuPo Lu2022-07-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | * src/haiku_io.c (haiku_len): Add `CLIPBOARD_CHANGED_EVENT'. * src/haiku_select.cc (be_update_clipboard_count): Set ownership flags. (be_handle_clipboard_changed_message): (be_start_watching_selection): New functions. * src/haiku_support.cc (class Emacs): Handle B_CLIPBOARD_CHANGED. * src/haiku_support.h (enum haiku_event_type): New event `CLIPBOARD_CHANGED_EVENT'. (struct haiku_clipboard_changed_event): New struct. * src/haikuselect.c (haiku_handle_selection_clear) (haiku_selection_disowned, haiku_start_watching_selections): New functions. (syms_of_haikuselect): New defsym and defvar. * src/haikuselect.h: Update prototypes. * src/haikuterm.c (haiku_read_socket): Handle selection events. (haiku_term_init): Start watching selections. * src/haikuterm.h: Update prototypes. * src/keyboard.c (kbd_buffer_get_event, process_special_events) (mark_kboards): Handle SELECTON_CLEAR_EVENTs correctly on Haiku.
* Implement stipples for images on HaikuPo Lu2022-06-271-0/+2
| | | | | | | | | | | * src/haiku_draw_support.cc (be_draw_bitmap_with_mask): New function. * src/haiku_support.h: Add prototype. * src/haikuterm.c (haiku_draw_image_glyph_string): Draw stipple correctly. (haiku_draw_glyph_string): Fix conditions under which row->stipple_p is set.
* Implement image transform smoothing on HaikuPo Lu2022-06-251-1/+1
| | | | | | | | | * src/dispextern.h (struct image): New field `use_bilinear_filtering'. * src/haiku_draw_support.cc (BView_DrawBitmap): Accept it. * src/haiku_support.h: Update prototypes. * src/haikuterm.c (haiku_draw_image_glyph_string): * src/image.c (image_set_transform): Set it.
* Implement "flip" image transforms on HaikuPo Lu2022-06-251-4/+7
| | | | | | | | | | | | | | | | | | | | * src/dispextern.h (struct image): New field `transform', `original_width' and `original_height'. * src/haiku_draw_support.cc (BView_DrawMask): Rename to `be_draw_image_mask' and fix coding style. (rotate_bitmap_270, BBitmap_transform_bitmap, rotate_bitmap_90): Delete functions. (be_apply_affine_transform): New function. (be_apply_inverse_transform): New function. * src/haiku_support.h: Update prototypes. * src/haikuterm.c (haiku_translate_transform): New function. (haiku_draw_image_glyph_string): Use affine transforms to implement images. * src/image.c (image_set_transform): Implement using affine transforms on Haiku too.
* Allow toggling antialiasing inside the Haiku font dialogPo Lu2022-06-211-1/+2
| | | | | | | | | | | | | | | | | | | | | * src/haiku_support.cc (struct font_selection_dialog_message): New field `disable_antialias'. (MessageReceived): Handle new message SET_DISABLE_ANTIALIASING. (class DualLayoutView): Rename to `TripleLayoutView'. (class TripleLayoutView): Rename from `DualLayoutView'. (MinSize): Update computations for three views. (class EmacsFontSelectionDialog, UpdatePreview) (EmacsFontSelectionDialog): Add an antialiasing checkbox to control antialiasing. (be_select_font): New arguments `initial_antialias' and `disable_antialias'. * src/haiku_support.h: Update prototypes. * src/haikufont.c (haikufont_pattern_from_object): Set FSPEC_ANTIALIAS. (Fx_select_font): Update accordingly.
* Respect `:antialias' on HaikuPo Lu2022-06-201-0/+6
| | | | | | | | | | | | | | | * src/haiku_font_support.cc (BFont_find): Pass through FSPEC_ANTIALIAS. (be_set_font_antialiasing): New function. * src/haiku_support.h (enum haiku_font_specification): New enum FSPEC_ANTIALIAS. (struct haiku_font_pattern): New field `use_antialiasing'. * src/haikufont.c (haikufont_pattern_to_entity) (haikufont_spec_or_entity_to_pattern, haikufont_open): Respect antialiasing. (syms_of_haikufont): New defsym `:indices'.
* Fix handling of scroll bar clicks on HaikuPo Lu2022-06-121-1/+2
| | | | | | | | | | | | | | | | | | | * src/haiku_support.cc (class EmacsView, BasicMouseDown) (BasicMouseUp): Move MouseDown and MouseUp here. New parameter `scroll_bar'. (MouseDown, MouseUp): Call basic variants. (class EmacsScrollBar): New field `parent'. (BScrollBar_make_for_view): Rename to `be_create_scroll_bar_for_view'. * src/haiku_support.h (struct haiku_button_event): New field `scroll_bar'. * src/haikuterm.c (haiku_scroll_bar_from_widget): Handle NULL widget. (haiku_scroll_bar_create): Update calls. (haiku_mouse_position): Fix scroll bar part. (haiku_read_socket): Handle button events on scroll bars as scroll bar click events.
* Fix coding style of some Haiku filesPo Lu2022-06-071-2/+2
| | | | | | | | | | * src/haiku_support.cc: (FrameResized): (class EmacsView, AfterResize): Fix coding and initializer style. * src/haiku_support.h (struct haiku_resize_event): Rename confusingly named fields. * src/haikuterm.c (haiku_read_socket): Update accordingly.
* Implement monitor change functions on HaikuPo Lu2022-05-231-1/+7
| | | | | | | | | | | | | | | | * src/haiku_io.c (haiku_len): Handle new event type. * src/haiku_support.cc (class EmacsScreenChangeMonitor): New class. (class Emacs, Emacs): Create new screen change monitor. (DispatchMessage): Update fullscreen state if the screen changed. (SetFullscreen): Don't punt if fullscreen mode is identical. * src/haiku_support.h (enum haiku_event_type): New event `SCREEN_CHANGE_EVENT'. (struct haiku_screen_changed_event): New struct. * src/haikuterm.c (haiku_read_socket): Handle new event.
* Compute frame workareas on HaikuPo Lu2022-05-211-0/+1
| | | | | | | | | | | | | | * lisp/frame.el (display-monitor-attributes-list): Implement specially on Haiku as well. * src/haiku_support.cc (get_zoom_rect): New function. Extract CalculateZoomRect here. (class EmacsWindow, SetFullscreen): Use that instead of CalculateZoomRect. (be_get_explicit_workarea): New function. * src/haiku_support.h: Update prototypes. * src/haikufns.c (Fhaiku_display_monitor_attributes_list): New function. (syms_of_haikufns): Register new subr.
* Fix race conditions processing zoom events on HaikuPo Lu2022-05-201-0/+1
| | | | | | | | | * src/haiku_support.cc (Zoom): * src/haiku_support.h (struct haiku_zoom_event): Include the current fullscreen mode in the event. * src/haikuterm.c (haiku_read_socket): Use that instead of the current frame's fullscreen mode.
* Implement `cross-disabled-images' on HaikuPo Lu2022-05-201-0/+2
| | | | | | | | | | * src/haiku_draw_support.cc (be_draw_cross_on_pixmap_1) (be_draw_cross_on_pixmap): New functions. * src/haiku_support.h: Update prototypes. * src/image.c (image_pixmap_draw_cross, image_disable_image): Implement drawing cross on Haiku.
* Fix race conditions processing frame fullscreen state on HaikuPo Lu2022-05-191-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/frames.texi (Size Parameters): Remove note saying Haiku doesn't support `fullwidth' and `fullboth'. * src/haiku_support.cc (subset_windows, class EmacsWindow) (Unparent, ParentTo): Stop calling old fullscreen functions. (ClearFullscreen, FullscreenRectForMode, SetFullscreen): New functions. Completely rewrite old zoom and fullscreen handling code. (Zoom): Send a ZOOM_EVENT and don't actually zoom. (BWindow_zoom, EmacsWindow_make_fullscreen, EmacsWindow_unzoom): Delete functions. (be_set_window_fullscreen_mode): New function. * src/haiku_support.h (struct haiku_zoom_event): Remove `zoomed_p' parameter. (enum haiku_fullscreen_mode): New enum. Update prototypes. * src/haikufns.c (Fx_display_pixel_height): Return height instead of width. * src/haikuterm.c (haiku_make_fullscreen_consistent) (haiku_read_socket, haiku_fullscreen): Adjust to always set zoom and fullscreen in the main thread instead of the UI threads. * src/haikuterm.h (struct haiku_output): Remove flag `zoomed_p' and add field `fullscreen_mode'.
* Fix race conditions when calculating Haiku frame geometryPo Lu2022-05-181-0/+2
| | | | | | | | | * src/haiku_support.cc (be_lock_window, be_unlock_window): New functions. * src/haiku_support.h: Update prototypes. * src/haikufns.c (frame_geometry): Lock window before asking for its dimensions and frame.
* Avoid race conditions when computing real frame positions on HaikuPo Lu2022-05-171-2/+4
| | | | | | | | | | | | | | | | * src/haiku_support.cc (DispatchMessage): Accept SEND_MOVE_FRAME_EVENT. (class EmacsWindow, FrameMoved): Include decorator frame in MOVE_EVENT events. (be_send_move_frame_event): New function. * src/haiku_support.h (struct haiku_move_event): Include decorator dimensions. Update prototypes. * src/haikufns.c (haiku_update_after_decoration_change): Ask for a move frame event and don't do anything if configury is not yet complete. * src/haikuterm.c (haiku_read_socket): Adjust accordingly.
* Rewrite Haiku frame geometry code to handle decorator framesPo Lu2022-05-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/frames.texi (Frame Layout): Document changes to Haiku frame layout. * src/haiku_support.cc (class EmacsWindow, MoveToIncludingFrame) (EmacsMoveTo, MakeFullscreen): Move to an offset including the decorator frames. (be_get_window_decorator_dimensions): (be_get_window_decorator_frame): New functions. * src/haiku_support.h: Update prototypes. * src/haikufns.c (haiku_update_after_decoration_change): New function. (haiku_create_frame, haiku_set_undecorated) (haiku_set_override_redirect): Call that function. (frame_geometry): Actually calculate frame geometry based on decorator and frame sizes. * src/haikuterm.c (haiku_coords_from_parent): Use frame width instead. (haiku_read_socket): Set left and top positions based on decorator width and height. * src/haikuterm.h (struct haiku_output): New field `frame_x' and `frame_y'.
* Clean up Haiku code after file panel changesPo Lu2022-05-161-20/+2
| | | | | | | | * src/haiku_support.cc: * src/haiku_support.h: Stop including pthread.h and specpdl_ref. * src/haikumenu.c (run_menu_bar_help_event): Ignore invalid help events instead of aborting.
* Simplify Haiku cursor management codePo Lu2022-05-151-8/+19
| | | | | | | | | | | | | * src/haiku_support.cc (BCursor_create_default) (BCursor_create_modeline, BCursor_from_id, BCursor_create_i_beam) (BCursor_create_progress_cursor, BCursor_create_grab) (BCursor_delete): Delete specialized cursor creation functions. (be_delete_cursor, be_create_cursor_from_id): New functions. (BView_set_view_cursor): Fix coding style. * src/haiku_support.h (enum haiku_cursor): Add all cursor IDs. * src/haikufns.c (haiku_free_custom_cursors): (haiku_set_mouse_color): * src/haikuterm.c (haiku_term_init): Adjust accordingly.
* Allow actually setting cursor colors on HaikuPo Lu2022-05-131-0/+1
| | | | | | | | | | | | | | | | | | | * src/haiku_support.cc (be_create_pixmap_cursor): New function. * src/haiku_support.h: Update prototypes. * src/haikufns.c (haiku_create_frame): Change default cursor color to "font-color". (haiku_create_tip_frame): Likewise. (struct user_cursor_bitmap_info): New struct. (cursor_bitmaps): New list of bitmaps corresponding to cursors. (haiku_create_colored_cursor): New function. (haiku_free_custom_cursors): Set current cursor to the default cursor before freeing the original value. (haiku_set_mouse_color): Actually recolor cursors based on built-in bitmaps. * src/haikuterm.c (haiku_defined_color): Clean up coding style.
* Add support for changing pointer types on HaikuPo Lu2022-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/frames.texi (Pointer Shape): Document that the pointer shape can now be changed on some window systems other than X. * lisp/term/haiku-win.el (x-pointer-X-cursor, x-pointer-arrow) (x-pointer-bottom-left-corner, x-pointer-bottom-right-corner) (x-pointer-bottom-side, x-pointer-clock, x-pointer-cross) (x-pointer-cross-reverse, x-pointer-crosshair) (x-pointer-diamond-cross, x-pointer-hand1, x-pointer-hand2) (x-pointer-left-side, x-pointer-right-side) (x-pointer-sb-down-arrow, x-pointer-sb-left-arrow) (x-pointer-sb-right-arrow, x-pointer-sb-up-arrow, x-pointer-target) (x-pointer-top-left-corner, x-pointer-top-right-corner) (x-pointer-top-side, x-pointer-watch, x-pointer-invisible): New pointer constants. * src/haiku_support.cc (BCursor_from_id): Accept int instead of enum. * src/haiku_support.h: Update prototypes. * src/haikufns.c (haiku_create_frame): Stop manually assigning cursors and set default value of the mouse color property. (haiku_free_frame_resources): Free custom cursors too. (struct user_cursor_info, INIT_USER_CURSOR): New struct. (haiku_free_custom_cursors): New function. (haiku_set_mouse_color): New param handler. (haiku_frame_parm_handlers): Add param handler. (syms_of_haikufns): New cursor shape variables from X. * src/haikuterm.h: Update prototypes.
* Use default external browser by default on HaikuPo Lu2022-05-091-0/+2
| | | | | | | | | | | | | * lisp/net/browse-url.el (browse-url-default-browser): Use that by default on Haiku. (browse-url-default-haiku-browser): New function. * src/haiku_support.cc (be_roster_launch): * src/haiku_support.h: New function. Update prototypes. * src/haikuselect.c (haiku_message_to_lisp): Encode and decode files correctly. (haiku_lisp_to_message): Encode and decode files correctly. (Fhaiku_roster_launch): New function. (syms_of_haikuselect): Update defsubrs.
* Implement bitmap loading for faces on HaikuPo Lu2022-05-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Stipples don't completely work yet. * lisp/faces.el (face-valid-attribute-values): Enable `:stipple' on Haiku. * src/haiku_draw_support.cc (BView_DrawBitmap) (BView_DrawBitmapWithEraseOp, BView_DrawMask): Don't push and pop states. (BView_DrawBitmapTiled): New function. * src/haiku_support.cc (BBitmap_import_mono_bits): Delete function. * src/haiku_support.h: Update prototypes. * src/haikuterm.c (get_string_resource): Fix coding style. (haiku_get_bitmap, haiku_draw_stipple_background): Implement partially. (haiku_set_scroll_bar_default_width) (haiku_set_scroll_bar_default_height, haiku_scroll_bar_create) (haiku_set_horizontal_scroll_bar, haiku_set_vertical_scroll_bar) (haiku_create_terminal, haiku_scroll_bar_remove): Fix coding style. * src/image.c (image_create_bitmap_from_data) (image_create_bitmap_from_file): Implement on Haiku.
* Implement `sticky' frame parameter on HaikuPo Lu2022-05-071-0/+1
| | | | | | | * src/haiku_support.cc (BWindow_set_sticky): New function. * src/haiku_support.h: Update prototypes. * src/haikufns.c (haiku_set_sticky, haiku_frame_parm_handlers): New frame param handler.
* Fix calculation of display resolution on HaikuPo Lu2022-05-061-2/+2
| | | | | | | | | | | | | | * src/haiku_support.cc (BScreen_px_dim): Rename to `be_get_screen_dimensions'. (BScreen_res): Rename to `be_get_display_resolution' and fix resolution computation. * src/haiku_support.h: Update prototypes. * src/haikufns.c (compute_tip_xy, Fx_display_pixel_width) (Fx_display_pixel_height, Fx_display_mm_height) (Fx_display_mm_width): Update accordingly. * src/haikuterm.c (haiku_term_init): Likewise.
* Speed up opening fonts on HaikuPo Lu2022-05-051-5/+43
| | | | | | | | | | | | | | | * src/font.h (font_property_index): Note that some font drivers use the extra data in a font entity to store driver-specific information. * src/haiku_font_support.cc (BFont_find): Set font indices. (be_open_font_at_index): New function. (BFont_open_pattern): Clean up coding style. * src/haiku_support.h (enum haiku_font_specification) (struct haiku_font_pattern): New fields and specifications for indices. * src/haikufont.c (haikufont_pattern_to_entity, haikufont_open): Use indices to open fonts if available in the extra data.
* Set initial size in the Haiku font dialogPo Lu2022-05-041-1/+1
| | | | | | | | | * src/haiku_support.cc (class EmacsFontSelectionDialog) (EmacsFontSelectionDialog): New argument `initial_size'. (be_select_font): Likewise. * src/haiku_support.h: Update prototypes. * src/haikufont.c (Fx_select_font): Set font dialog size to the pixel size of the current font.
* Clean up Haiku file panel codePo Lu2022-05-041-12/+1
| | | | | | | | | | | | | | | | | | | | | | | * lisp/term/haiku-win.el (x-file-dialog): Fix nil values of `default-filename'. * src/haiku_io.c (haiku_len): Remove `FILE_PANEL_EVENT'. (record_c_unwind_protect_from_cxx, c_specpdl_idx_from_cxx) (c_unbind_to_nil_from_cxx): Delete functions. * src/haiku_support.cc (MessageReceived): Write pointer to buffer to file panel port instead. (struct popup_file_dialog_data): Delete strict. (unwind_popup_file_dialog): Delete functions. (be_popup_file_dialog): Accept a pointer to `process_pending_signals' and run nested event loop as usual. * src/haiku_support.h (enum haiku_event_type): Remove `FILE_PANEL_EVENT'. (struct haiku_file_panel_event): Delete struct. * src/haikufns.c (unwind_popup): Delete function. (Fhaiku_read_file_name): Update and quit on invalid filename. * src/haikuterm.c (struct unhandled_event): Delete struct. (haiku_read_socket): Remove "unhandled events".
* Fix handling of some weights in the Haiku font driverPo Lu2022-05-021-2/+0
| | | | | | | | * src/haiku_font_support.cc (font_style_to_flags): * src/haiku_support.h (enum haiku_font_weight): * src/haikufont.c (haikufont_weight_to_lisp) (haikufont_lisp_to_weight): Make `ultralight' and `extralight' mean the same thing.
* Default to currently selected font in Haiku font dialogsPo Lu2022-05-021-1/+3
| | | | | | | | | | | | | | | | | | | | * src/haiku_font_support.cc (be_find_font_indices): New function. * src/haiku_support.cc (class EmacsFontSelectionDialog) (UpdateStylesForIndex, EmacsFontSelectionDialog): Allow specifying an initial font family and style. (be_select_font): New parameters `initial_family' and `initial_style'. * src/haiku_support.h: Update prototypes. * src/haikufont.c (haikufont_lisp_to_weight) (haikufont_lisp_to_slant, haikufont_lisp_to_width): Handle `regular'. (haikufont_pattern_from_object): New function. (haikufont_spec_or_entity_to_pattern): Fix coding style. (Fx_select_font): Compute indices based on currently selected font. (syms_of_haikufont): New defsyms.
* Improve display of Haiku font dialogPo Lu2022-05-011-1/+0
| | | | | | | | | | | * src/haiku_support.cc (EmacsFontSelectionDialog) (class EmacsFontSelectionDialog, FrameResized): Set minimum size based on individual view dimensions and add label to size control. (BWindow_set_min_size): Delete function. * src/haiku_support.h: Update prototypes. * src/haikuterm.c (haiku_update_size_hints): Stop setting min size, since that doesn't work correctly on Haiku.
* Allow specifying font size in the Haiku font selection dialogPo Lu2022-05-011-1/+2
| | | | | | | | | | | | | * src/haiku_support.cc (struct font_selection_dialog_message): New fields `size' and `size_specified'. (class EmacsFontSelectionDialog): New `size_entry' control. (MessageReceived): Set size from that control if available. (EmacsFontSelectionDialog): Initialize that control. (FrameResized): Handle layout for that control. (be_select_font): New field `size'. * src/haiku_support.h: Update prototypes. * src/haikufont.c (Fx_select_font): Populate font spec with size.
* Allow quitting inside font selection dialogs on HaikuPo Lu2022-05-011-1/+1
| | | | | | | | | * src/haiku_support.cc (WaitForChoice): Accept new function for checking quit flag. (be_select_font): Pass that function. * src/haiku_support.h: Update prototypes. * src/haikufont.c (haikufont_should_quit_popup): New function. (Fx_select_font): Give said function to `be_select_font'.
* Improvements to the Haiku font dialogPo Lu2022-05-011-1/+1
| | | | | | | | | | * src/haiku_support.cc (class EmacsFontSelectionDialog) (EmacsFontSelectionDialog, FrameResized): Fix colors and respect monospace only. (be_select_font): New parameter `allow_monospace_only'. * src/haiku_support.h: Update prototype. * src/haikufont.c (Fx_select_font): Respect `exclude-proportional'.
* Implement font selection dialog on HaikuPo Lu2022-05-011-0/+4
| | | | | | | | | | | | | | | * src/haiku_font_support.cc (font_style_to_flags): Handle style allocation failures. (be_font_style_to_flags): New function. * src/haiku_support.cc (struct font_selection_dialog_message): New struct. (class EmacsFontSelectionDialog): New class. (be_select_font): New function. * src/haiku_support.h: Update prototypes. * src/haikufont.c (Fx_select_font): New function. (syms_of_haikufont): Define new subr.
* Fix colorspace calculations on HaikuPo Lu2022-04-291-0/+1
| | | | | | | | | | | | | | | | | | * src/haiku_support.cc (be_get_display_planes) (be_get_display_color_cells): Handle grayscale basic colorspaces correctly. (be_is_display_grayscale): New function. * src/haiku_support.h: Update prototypes. * src/haikufns.c (haiku_set_no_accept_focus, haiku_iconify_frame) (Fxw_display_color_p, Fxw_color_values, Fx_display_grayscale_p): Actually handle grayscale colorspaces. (Fx_display_pixel_width, Fx_display_pixel_height) (Fx_display_mm_height, Fx_display_mm_width): Clean up coding style. (Fx_display_visual_class): Handle grayscale colorspaces. (syms_of_haikufns): New defsyms.
* Add simple session management support to HaikuPo Lu2022-04-271-16/+26
| | | | | | | | | | | | | | | | | | | | | | * lisp/term/common-win.el (emacs-save-session-functions): Move from x-win.el to common-win.el. * lisp/term/haiku-win.el (haiku-save-session-reply) (emacs-session-save, handle-save-session): New functions. * lisp/term/x-win.el (emacs-save-session-functions): Delete. * src/haiku_font_support.cc (font_style_to_flags): * src/haiku_support.h (enum haiku_font_weight): Turn weight macros into enum. (struct haiku_font_pattern): Likewise. (struct haiku_session_manager_reply): New struct. * src/haiku_io.c (haiku_io_init): Create sm port. * src/haiku_support.cc (QuitRequested): Wait for reply from sm port. * src/haikufns.c (Fhaiku_save_session_reply): New function. (syms_of_haikufns): Define new subr. * src/haikuterm.c (haiku_read_socket): Send session management events. (haiku_term_init): Check new port.
* Delete some unused functions on HaikuPo Lu2022-04-251-2/+0
| | | | | | * src/haiku_support.cc (haiku_current_workspace) (BWindow_workspaces): * src/haiku_support.h: Remove unused functions and prototypes.
* Fix 32-bit Haiku buildPo Lu2022-04-251-1/+1
| | | | * src/haiku_support.h (be_get_ui_color): Fix prototype.
* Allow looking up window system colors on HaikuPo Lu2022-04-241-1/+1
| | | | | | | | | | | | * lisp/help-fns.el (help-fns--editable-variable): Fix describing variables which don't have symbol values. * lisp/term/haiku-win.el (haiku-allowed-ui-colors): Set list of allowed UI colors. * src/haiku_support.cc (be_get_ui_color): New function. * src/haiku_support.h: Update prototypes. * src/haikufns.c (haiku_get_color): Look for defined UI color. (syms_of_haikufns): New defvar `haiku-allowed-ui-colors'. * src/haikuterm.c (haiku_term_init): Fix coding style.
* Use a cache on Haiku to avoid constantly reading fonts during font lookupPo Lu2022-04-211-2/+4
| | | | | | | | | | | | | | | | | | | | * src/haiku_font_support.cc (struct font_object_cache_bucket): New struct. (language_code_points): Make `int'. (hash_string): New function. (cache_font_object_data, lookup_font_object_data) (font_object_has_chars): New functions. (font_check_wanted_chars, font_check_one_of) (font_check_language): Lookup in cached font object instead. (be_init_font_data, be_evict_font_cache): New functions. * src/haiku_support.h (struct haiku_font_pattern): Make `uint32_t's ints instead. * src/haikufont.c (haikufont_apply_registry, syms_of_haikufont): Adjust for those changes. * src/haikuterm.c (haiku_frame_up_to_date): Clear font lookup cache every 50 updates.
* Implement `above' z-group on HaikuPo Lu2022-04-201-11/+19
| | | | | | | | | | | | | | | | * src/haiku_support.cc (class EmacsWindow): New field `z_group'. (RecomputeFeel): New function. (ParentTo, BWindow_set_override_redirect): Use that instead instead of manually juggling the window feel around. (BWindow_set_z_group): New function. * src/haiku_support.h (enum haiku_z_group): New enum. * src/haikufns.c (haiku_set_parent_frame): Clean up coding style. (haiku_set_z_group): New function. (haiku_create_frame): Always set z group after window creation, like on X. (haiku_frame_parm_handlers): Add `haiku_set_z_group'.
* Minor cleanups to Haiku menu codePo Lu2022-04-191-9/+10
| | | | | | | | | | | | | * src/haiku_draw_support.cc (BView_SetHighColorForVisibleBell): Delete function. * src/haiku_font_support.cc (BFont_dat): Rename to `BFont_metrics'. * src/haiku_support.cc (DrawContent): Use correct UI color for control text. * src/haiku_support.h (HAIKU_MODIFIER_ALT): Turn into enum. (enum haiku_modifier_specification): New enum. * src/haikufont.c (haikufont_open, haikufont_close): Fix coding style.
* Fix Haiku menu bars when redisplay happens immediately after activationPo Lu2022-04-181-1/+1
| | | | | | | | | | * src/haiku_support.cc (MessageReceived): Make `REPLAY_MENU_BAR' messages synchronous. (be_replay_menu_bar_event): Return whether or not the menu bar really opened. * src/haiku_support.h: Update prototypes. * src/haikumenu.c (haiku_activate_menubar): Immediately activate menu bar after replaying event.
* Fix hangs when clicking on Haiku menu bar to activate framePo Lu2022-04-171-1/+9
| | | | | | | | | | | | | | | | | | | | | | | * src/haiku_io.c (haiku_len): Handle new event `MENU_BAR_CLICK'. * src/haiku_support.cc (class EmacsWindow): Remove most of the menu bar cv stuff. (MessageReceived): Handle REPLAY_MENU_BAR message. (EmacsWindow_signal_menu_update_complete): Delete function. (be_replay_menu_bar_event): New function. * src/haiku_support.h (enum haiku_event_type): New event type `MENU_BAR_CLICK'. (struct haiku_menu_bar_click_event): New struct. * src/haikumenu.c (haiku_activate_menubar): New function. * src/haikuterm.c (haiku_read_socket): Save a MENU_BAR_ACTIVATE_EVENT and the menu bar click event instead of handling the menu bar update synchronously. (haiku_create_terminal): Set `activate_menubar_hook'. (syms_of_haikuterm): Remove extraneous newline. * src/haikuterm.h (struct haiku_output): New field `saved_menu_event'.