summaryrefslogtreecommitdiff
path: root/src/haikuterm.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement stipples for stretch glyphsPo Lu2022-05-081-12/+35
| | | | | | | | | * src/haikuterm.c (haiku_draw_stipple_background): Accept new arguments for specifying the color explicitly. All callers changed. (haiku_draw_stretch_glyph_string): Draw stipple correctly. (haiku_draw_glyph_string): Handle stipple correctly when drawing neighbors.
* Fully implement stipples for text on HaikuPo Lu2022-05-081-37/+74
| | | | | | | | | | | | | | | | | | | | | | * src/haikufont.c (haikufont_draw): Use `haiku_draw_background_rect' instead. * src/haikuterm.c (haiku_draw_plain_background): Change arguments to accept rect manually. (haiku_get_bitmap): Delete function. (haiku_get_bitmap_rec): New function. (haiku_draw_stipple_background): Accept rect instead of box sizes. (haiku_draw_background_rect): New function. (haiku_maybe_draw_background): Use that instead. (haiku_draw_image_glyph_string): Add notice. (haiku_draw_glyph_string): Set `stippled_p' correctly. * src/haikuterm.h (struct haiku_bitmap_record): New fields for keeping track of stipple state. * src/image.c (image_create_bitmap_from_data) (image_create_bitmap_from_file, free_bitmap_record): Free and set them accordingly.
* Implement bitmap loading for faces on HaikuPo Lu2022-05-081-35/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Clean up some variables in the Haiku codePo Lu2022-05-071-3/+10
| | | | | | | * src/haikuterm.c: Add comments to some variables and clean up initializers. * src/haikuterm.h (haiku_frame_param_handlers): Move here instead.
* 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.
* Fix more problems with display of composite glyph strings on HaikuPo Lu2022-05-061-0/+2
| | | | | | * src/haikuterm.c (haiku_draw_composite_glyph_string_foreground): Fix pen size of placeholder rectangle.
* Clean up Haiku file panel codePo Lu2022-05-041-30/+0
| | | | | | | | | | | | | | | | | | | | | | | * 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 display of placeholder composite string on HaikuPo Lu2022-05-041-2/+2
| | | | | | * src/haikuterm.c (haiku_draw_composite_glyph_string_foreground): Correct translation of XDrawRectangle.
* Fix glyphless glyph display on HaikuPo Lu2022-05-031-2/+2
| | | | | | * src/haikuterm.c (haiku_draw_glyphless_glyph_string_foreground): Fix rectangle width.
* Improve display of Haiku font dialogPo Lu2022-05-011-12/+4
| | | | | | | | | | | * 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.
* Prevent cursors from being set on tooltip frames on HaikuPo Lu2022-04-301-7/+10
| | | | | | | * src/haikuterm.c (haiku_show_hourglass, haiku_hide_hourglass) (haiku_define_frame_cursor, haiku_toggle_invisible_pointer): Ignore tooltip frames. Otherwise, the cursor changes every time a tooltip is mapped.
* Simplify buffer flipping code on HaikuPo Lu2022-04-281-26/+12
| | | | | | | * src/haikuterm.c (flush_dirty_back_buffers): Delete function. (haiku_flush_dirty_back_buffer_on): New function. (haiku_read_socket): Use that instead of looping over each frame at the end.
* Add simple session management support to HaikuPo Lu2022-04-271-4/+6
| | | | | | | | | | | | | | | | | | | | | | * 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.
* Cache relief colors on Haiku since their computation is expensivePo Lu2022-04-261-4/+15
| | | | | | | | | * src/haikufns.c (haiku_create_frame, haiku_create_tip_frame): Clear `relief_background'. * src/haikuterm.c (haiku_calculate_relief_colors): Cache relief colors for each frame. * src/haikuterm.h (struct haiku_output): New fields for caching the last relief color.
* Allow looking up window system colors on HaikuPo Lu2022-04-241-5/+3
| | | | | | | | | | | | * 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.
* Fix disabling double buffering on HaikuPo Lu2022-04-241-14/+12
| | | | | | | | * src/haikufns.c (haiku_set_inhibit_double_buffering): Garbage frame correctly after changing double buffering. * src/haikuterm.c (haiku_calculate_relief_colors) (haiku_draw_relief_rect, haiku_draw_underwave): Clean up coding style.
* Avoid clearing splash screen message during DND on HaikuPo Lu2022-04-231-1/+2
| | | | | * src/haikuterm.c (haiku_read_socket): Respect any_help_event_p when sending help events for DND.
* Fix default frame name on HaikuPo Lu2022-04-221-4/+24
| | | | | | | | | | | | | | | | | | | * src/haikufns.c (haiku_set_background_color) (haiku_set_cursor_color, haiku_get_pixel, haiku_put_pixel) (haiku_set_internal_border_width) (haiku_set_inhibit_double_buffering) (Fhaiku_mouse_absolute_pixel_position, Fxw_color_defined_p) (Fxw_color_values, Fx_double_buffered_p) (Fx_display_backing_store): Clean up coding style. (haiku_set_name): Use correct default name and don't cons extra string all the time. * src/haikuterm.c (haiku_read_socket): Remove unused variable. (haiku_term_init): Set default name. (mark_haiku_display): Mark new field. * src/haikuterm.h (struct haiku_display_info): New field `default_name'.
* Use a cache on Haiku to avoid constantly reading fonts during font lookupPo Lu2022-04-211-0/+11
| | | | | | | | | | | | | | | | | | | | * 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.
* Fix enabling menu bar multiple times on HaikuPo Lu2022-04-201-2/+2
| | | | | | | | | | | * src/haiku_support.cc (FrameResized): Adjust width and height appropriately when sending menu bar resize event. * src/haikufns.c (haiku_set_menu_bar_lines): Don't always reset FRAME_MENU_BAR_LINES and FRAME_MENU_BAR_HEIGHT. * src/haikumenu.c (free_frame_menubar): Clear Haiku menu bar. (set_frame_menubar): Fix coding style. * src/haikuterm.c (haiku_read_socket): Don't adjust height here anymore.
* Fix display of glyphless characters on HaikuPo Lu2022-04-191-4/+17
| | | | | | | * src/haikuterm.c (haiku_draw_glyph_string_foreground): Fix pen size when drawing composite string w/o font. (haiku_draw_glyphless_glyph_string_foreground): Correctly display glyphless character rectangle.
* Fix race conditions waiting for menu bar resize events on HaikuPo Lu2022-04-171-4/+41
| | | | | | | | | | | * src/haikufns.c (haiku_create_frame, haiku_create_tip_frame): Clear `wait_for_event_type'. (haiku_set_menu_bar_lines): Clean up coding style. * src/haikuterm.c (haiku_wait_for_event): New function. (haiku_read_socket): Implement waiting for MENU_BAR_RESIZE events. * src/haikuterm.h (struct haiku_output): New field `wait_for_event_type'.
* Get rid of unused flags on HaikuPo Lu2022-04-171-6/+4
| | | | | | | | | * src/haikufns.c (haiku_free_frame_resources): Syntax fixes. * src/haikumenu.c (set_frame_menubar, run_menu_bar_help_event): * src/haikuterm.c (haiku_read_socket): Stop setting and consulting `menu_up_to_date_p'. * src/haikuterm.h (struct haiku_output): Delete `menu_up_to_date_p'.
* Fix hangs when clicking on Haiku menu bar to activate framePo Lu2022-04-171-11/+17
| | | | | | | | | | | | | | | | | | | | | | | * 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'.
* Fix dismissal of tooltips on HaikuPo Lu2022-04-151-5/+4
| | | | | | * src/haikuterm.c (haiku_mouse_or_wdesc_frame): New argument `accept_tooltip'. (haiku_read_socket): Use it when handling MOUSE_MOTION events.
* Clean up various bits of Haiku codePo Lu2022-04-151-16/+17
| | | | | | | | | | | | | | | | | | | | * 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.
* Properly wait for app thread exit on HaikuPo Lu2022-04-151-38/+1
| | | | | | | | | | | | * 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.
* Minor cleanups to Haiku windowingPo Lu2022-04-131-10/+13
| | | | | | | | | * src/haikufns.c (haiku_create_frame, haiku_create_tip_frame): * src/haikuterm.h (struct haiku_output, struct scroll_bar) (XSCROLL_BAR): Remove used fields of various structs. * src/haikuterm.c (haiku_flash): Make input detection actually work.
* Fix freezes when trying to accelerate menu bar on HaikuPo Lu2022-04-131-20/+8
| | | | | | | | | | | | | * src/haiku_support.cc (class EmacsWindow): New field `menus_begun'. (MenusBeginning): Don't send menu bar open events when that is set, instead set it to true. (BMenuBar_start_tracking): Stop locking the menu bar here and send a special BE_MENU_BAR_OPEN event instead. * src/haiku_support.h (struct haiku_menu_bar_state_event): Delete field `no_lock'. * src/haikumenu.c (Fhaiku_menu_bar_open): * src/haikuterm.c (haiku_read_socket): Update accordingly.
* Fix last tool bar bug on Haiku as wellPo Lu2022-04-121-1/+3
| | | | | * src/haikuterm.c (haiku_read_socket): Adapt last change to Haiku.
* Respect new DND options when dragging to ourselves on HaikuPo Lu2022-04-051-0/+3
| | | | | | | | | | | | | | | * lisp/mouse.el (mouse-drag-and-drop-region): Allow dragging to the current frame if we know `return-frame' doesn't work. * lisp/term/haiku-win.el (haiku-dnd-drag-handler): New function. * src/haiku_support.cc (MouseMoved): Don't send drag motion events for the drag frame. * src/haikuselect.c (haiku_note_drag_motion_1) (haiku_note_drag_motion_2, haiku_note_drag_motion): New functions. (syms_of_haikuselect): New variable `haiku-drag-track-function'. * src/haikuterm.c (haiku_read_socket): Note mouse motion in that case.q * src/haikuterm.h: Update prototypes.
* Fix generation of extra DND events while dragging on HaikuPo Lu2022-04-041-5/+9
| | | | | | | | * src/haiku_support.cc (be_drag_message): Set new DND flag. (be_drag_and_drop_in_progress): New function. * src/haiku_support.h: Update prototypes. * src/haikuterm.c (haiku_read_socket): Don't store DND motion events if DND is in progress.
* Fix various bugs with mouse dragging on HaikuPo Lu2022-04-031-18/+32
| | | | | * src/haikuterm.c (haiku_mouse_position): Rewrite so that different track-mouse types can be handled more consistently.
* Implement (sort of) `drag-source' on HaikuPo Lu2022-04-031-2/+8
| | | | | | * src/haikuterm.c (haiku_mouse_or_wdesc_frame) (haiku_mouse_position): Behave reasonably when track_mouse is Qdrag_source.
* Implement new DND options on HaikuPo Lu2022-04-031-3/+18
| | | | | | | | | | * lisp/term/haiku-win.el (haiku-drag-and-drop): Handle special drag and drop motion events. * src/haiku_support.cc (MouseMoved): Set `dnd_message' flag. * src/haiku_support.h (struct haiku_mouse_motion_event): New member `dnd_message'. * src/haikuterm.c (haiku_read_socket): Create special DND events when the mouse moves with a drop message.
* Ignore mouse movement correctly on Haiku during drag and dropPo Lu2022-03-301-2/+3
| | | | | | | | | | * src/haikuselect.c (haiku_unwind_drag_message): New function. (Fhaiku_drag_message): Set `haiku_dnd_in_progress' to false. * src/haikuterm.c (haiku_read_socket): Fix overriding of need_flush when reading events from multiple frames. * src/haikuterm.h (haiku_dnd_in_progress): New variable. * src/xdisp.c (note_mouse_highlight): Ignore if said variable is true.
* Don't allocate duplicate cursors for each frame on HaikuPo Lu2022-03-231-0/+50
| | | | | | | | | * src/haikufns.c (haiku_create_frame) (haiku_free_frame_resources): Stop creating cursors. * src/haikuterm.c (haiku_delete_terminal, haiku_term_init): Create and free cursors here instead. * src/haikuterm.h (struct haiku_display_info): New fields for cursors.
* Simplify fullscreen management on HaikuPo Lu2022-03-221-34/+3
| | | | | | | | | | | | | | | | * src/haiku_support.cc (class EmacsWindow, Zoom, UnZoom): Track zoom state manually instead of guessing what the system currently thinks it is. (MakeFullscreen): Always unzoom first. * src/haiku_support.h (struct haiku_zoom_event): Remove all fields and add a single field `zoomed'. * src/haikufns.c (haiku_create_frame, haiku_create_tip_frame): Remove use of pending_zoom fields. * src/haikuterm.c (haiku_read_socket): Simplify handling of zoom events. (haiku_fullscreen): Simplify handling of different zoom states. * src/haikuterm.h (struct haiku_output): Remove all pending_zoom fields since they are no longer required.
* Fix starting Emacs with -mm or -fs on HaikuPo Lu2022-03-221-0/+16
| | | | | | * src/haikuterm.c (haiku_set_window_size): Disallow setting the window size if the frame is fullscreen, like most X window managers.
* Implement `haiku_delete_terminal'Po Lu2022-03-201-1/+19
| | | | | * src/haikuterm.c (haiku_delete_terminal): Actually delete the terminal instead of aborting.
* Fix creating frames with an initial value of `fullscreen' on HaikuPo Lu2022-03-171-0/+7
| | | | | | | | | * src/haikufns.c (haiku_create_frame): Set configury_done and do pending fullscreen change if any. * src/haikuterm.c (haiku_fullscreen): Defer actually setting fullscreen until configury_done is set. * src/haikuterm.h (struct haiku_output): New field `configury_done'.
* Redo Haiku DND supportPo Lu2022-03-161-7/+5
| | | | | | | | | | | | | | | | | | | | | * lisp/term/haiku-win.el (haiku-dnd-handle-drag-n-drop-event): Update for new DND event format. * src/haiku_io.c (haiku_len): Handle DRAG_AND_DROP_EVENTs. * src/haiku_select.cc (be_enum_message, be_get_refs_data) (be_get_message_data): New function. * src/haiku_support.cc (class Emacs): Remove `RefsReceived'. (MessageReceived): Generate new kind of drag-n-drop events. * src/haiku_support.h (enum haiku_event_type): Rename `REFS_EVENT' to `DRAG_AND_DROP_EVENT'. (struct haiku_refs_event): Delete struct. (struct haiku_drag_and_drop_event): New struct. * src/haikuselect.c (haiku_message_to_lisp): New function. (syms_of_haikuselect): New symbols. * src/haikuselect.h: Update prototypes. * src/haikuterm.c (haiku_read_socket): Handle new type of drag-and-drop events by serializing drop message to Lisp and letting Lisp code do the processing. * src/haikuterm.h: Update prototypes.
* Enable overscroll on Haiku horizontal scroll barsPo Lu2022-03-141-1/+1
| | | | | | | * src/haiku_support.cc (MouseMoved): Handle horizontal directions correctly. * src/haikuterm.c (haiku_set_horizontal_scroll_bar_thumb): Enable overscrolling on scroll bar widget.
* Fix scroll bar movement right before overscroll begins on HaikuPo Lu2022-03-141-24/+19
| | | | | * src/haikuterm.c (haiku_set_scroll_bar_thumb): Make sure value and size are within bounds even if portion adjustment is off.
* Fix small regression for horizontal scroll barsPo Lu2022-03-131-2/+2
| | | | | | * src/haikuterm.c (haiku_read_socket): Restore previous horizontal scrollbar code, since the change it was intended for was never made.
* Allow dragging scroll bar for overscroll on HaikuPo Lu2022-03-131-4/+7
| | | | | | | | | | | | | | | | | | * src/haiku_support.cc (class EmacsScrollBar): New fields `in_overscroll', `can_overscroll', `last_overscroll', `last_reported_overscroll_value' and `max_value'. (ValueChanged): Make very sure extraneous value are not generated. (MouseUp): Clear overscroll if enabled. (MouseMoved): If overscroll is enabled and dragging downwards fails to dislodge the maximum value, enable overscrolling. (BView_scroll_bar_update): New parameter `can_overscroll' * src/haiku_support.h: Update prototypes. * src/haikuterm.c (haiku_set_scroll_bar_thumb) (haiku_set_horizontal_scroll_bar_thumb): Adjust parameters to scroll bar update functions. (haiku_read_socket): Take ceiling of bar position if horizontal.
* Fix horizontal scroll bar updating on HaikuPo Lu2022-03-121-8/+7
| | | | | * src/haikuterm.c (haiku_set_horizontal_scroll_bar_thumb): Just take portion and position without adjustments.
* Slightly improve scrollbar position accounting on HaikuPo Lu2022-03-121-1/+1
| | | | | | | * src/haiku_support.cc (MessageReceived): Use floats for calculating portion and subtract proportion directly. * src/haikuterm.c (haiku_set_scroll_bar_thumb): Take ceiling of value instead of rounding it.
* Improve scroll bar treatment on HaikuPo Lu2022-03-111-9/+8
| | | | | | | | | * src/haiku_support.cc (MessageReceived): Subtract portion from range of scroll bar. * src/haikuterm.c (BE_SB_MAX): Adjust values for better rounding. (haiku_set_scroll_bar_thumb): Round values instead of truncating them.
* Fix inconsistent thumb position on Haiku scroll barsPo Lu2022-03-111-17/+24
| | | | | | * src/haikuterm.c (haiku_set_scroll_bar_thumb): If scroll_bar_adjust_thumb_portion is nil, directly calculate thumb portions without setting page_size.