aboutsummaryrefslogtreecommitdiffstats
path: root/src/haiku_support.cc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Clean up various bits of Haiku codePo Lu2022-04-151-66/+33
| | | | | | | | | | | | | | | | | | | | * 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.
* Make Haiku scroll bar behave more like other programsPo Lu2022-04-151-7/+13
| | | | | | | | * 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.
* Properly wait for app thread exit on HaikuPo Lu2022-04-151-16/+30
| | | | | | | | | | | | * 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.
* Fix races with child frame locks on HaikuPo Lu2022-04-141-13/+39
| | | | | | | * src/haiku_support.cc (CHILD_FRAME_LOCK_INSIDE_LOOPER_CALLBACK): New macro. (FrameMoved, WorkspacesChanged): Lock child frame data with that macro instead.
* Fix zoom rect computation for some deskbar positions on HaikuPo Lu2022-04-131-6/+6
| | | | | * src/haiku_support.cc (CalculateZoomRect): Fix computation for left top and right bottom.
* Fix freezes when trying to accelerate menu bar on HaikuPo Lu2022-04-131-21/+51
| | | | | | | | | | | | | * 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.
* Improve safety of haiku-drag-messagePo Lu2022-04-061-3/+30
| | | | | | | | | | | | | | | | | * lisp/term/haiku-win.el (haiku-drag-and-drop): Ignore placeholder message. * src/frame.c (delete_frame): Prevent deleting drop source frame on Haiku. * src/haiku_support.cc (RELEASE_NOW, CANCEL_DROP): New message types. (class EmacsView, MessageReceived): Handle new message types. (be_drag_message): Drag CANCEL_DROP message on quit; also send RELEASE_NOW to view if quitting. * src/haikuselect.c (syms_of_haikuselect) (haiku_unwind_drag_message): Clear new frame variable. (Fhaiku_drag_message): Set new frame variable. * src/haikuterm.h: Update prototypes.
* Respect new DND options when dragging to ourselves on HaikuPo Lu2022-04-051-2/+12
| | | | | | | | | | | | | | | * 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-2/+17
| | | | | | | | * 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.
* Implement new DND options on HaikuPo Lu2022-04-031-0/+1
| | | | | | | | | | * 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.
* Prevent signals when dragging nonexistent files on HaikuPo Lu2022-03-301-3/+0
| | | | | | | | | | * lisp/term/haiku-win.el (x-begin-drag): Bind `haiku-signal-invalid-refs' to nil. * src/haiku_support.cc (MouseMoved): Send motion events while dragging as well. * src/haikuselect.c (haiku_lisp_to_message): Respect new variable. (syms_of_haikuselect): New variable `haiku-signal-invalid-refs'.
* Fix processing of emacs:window_id inside DND messages if it already existsPo Lu2022-03-261-10/+11
| | | | | | * src/haiku_support.cc (MessageReceived): Use DropPoint instead of getting it manually. (be_drag_message): Replace window_id if it already exists.
* Implement new drag and drop parameter on HaikuPo Lu2022-03-251-2/+5
| | | | | | | | | | * lisp/term/haiku-win.el (x-begin-drag): Implement `allow-current-frame'. * src/haiku_support.cc (be_drag_message): New argument `allow_same_view'. * src/haiku_support.h: Update prototypes. * src/haikuselect.c (Fhaiku_drag_message): New parameter `allow-same-frame'.
* Allow holding down scroll bar buttons on Haiku when overscrollingPo Lu2022-03-241-7/+38
| | | | | | | | | | * src/haiku_support.cc (EmacsWindow): Set appropriate pulse rate. (class EmacsScrollBar, ValueChanged): Don't send any part events here. (MouseDown): Set dragging to a value larger than 1 if the scroll bar is at the end. (Pulse): New method.
* Fix copying font names around on HaikuPo Lu2022-03-241-1/+6
| | | | | | | | | * src/haiku_font_support.cc (font_style_to_flags) (haiku_font_fill_pattern, BFont_open_pattern) (BFont_populate_fixed_family, BFont_populate_plain_family): * src/haiku_support.cc (be_get_version_string): * src/haikufont.c (haikufont_spec_or_entity_to_pattern): Stop assuming patterns were allocated by xzalloc.
* Improvements to Haiku selection handlingPo Lu2022-03-231-1/+1
| | | | | | | | | | | | | | | | | | | | * lisp/term/haiku-win.el (haiku-selection-targets): Implement in Lisp. * src/haiku_select.cc (be_get_message_type): (be_set_message_type): (be_get_message_message): (be_add_message_message): New functions. * src/haiku_support.cc (MessageReceived): Fix typo. * src/haikuselect.c (haiku_selection_data_1) (Fhaiku_selection_targets): Delete functions. (haiku_message_to_lisp, lisp_to_type_code) (haiku_lisp_to_message): Correctly decode and encode nested messages, and fix encoding specially decoded types via numeric names. Also store and decode message types inside Lisp messages. (Fhaiku_drag_message): Update doc string. (syms_of_haikuselect): Update subrs. * src/haikuselect.h: Update prototypes.
* Simplify fullscreen management on HaikuPo Lu2022-03-221-22/+89
| | | | | | | | | | | | | | | | * 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.
* Minor fixes to Haiku DND supportPo Lu2022-03-211-5/+13
| | | | | | | | | | * src/haiku_support.cc (MessageReceived): If source is remote, don't test window ID. (MouseMoved): Don't send mouse motion if dragging. (be_drag_message): Return true if quit-flag. * src/haiku_support.h: Update prototypes. * src/haikuselect.c (haiku_should_quit_drag): New function. (Fhaiku_drag_message): If rc is true, quit.
* Ignore drag source frame on Haiku in line with documentationPo Lu2022-03-191-1/+10
| | | | | | | * src/haiku_support.cc (class EmacsWindow): New field `window_id'. (MessageReceived): Ignore dropped messages with same window id. (be_drag_message): Add source frame's window ID to message.
* Fix mouse movement on HaikuPo Lu2022-03-171-1/+1
| | | | | * src/haiku_support.cc (MouseMoved): Make sure grab view exists before comparing against it.
* Prevent delivery of duplicate events when window is grabbed on HaikuPo Lu2022-03-171-1/+34
| | | | | | | * src/haiku_support.cc (grab_view, grab_view_locker): New variables. (MouseMoved, MouseDown, MouseUp): Keep track of the grab and don't deliver motion events to any other view.
* Implement cross-program drag-and-drop on HaikuPo Lu2022-03-171-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/frames.texi (Drag and Drop): Fix documentation of `x-begin-drag' to match actual function arity. * lisp/term/haiku-win.el (haiku-dnd-selection-value): New variable. (haiku-dnd-selection-converters): New variable. (haiku-dnd-convert-string): New function. (gui-backend-get-selection, gui-backend-set-selection): Handle XdndSelection specially. (x-begin-drag): New function. * src/haiku_select.cc (be_create_simple_message) (be_add_message_data): New functions. * src/haiku_support.cc (WAIT_FOR_RELEASE): New message type. (class EmacsView, MouseUp): If waiting for release, reply and drop event. (be_drag_message, be_drag_message_thread_entry): New functions. * src/haiku_support.h: Update prototypes. * src/haikuselect.c (lisp_to_type_code, haiku_lisp_to_message) (Fhaiku_drag_message): New functions. (syms_of_haikuselect): Define new subr. * src/haikuselect.h: Update prototypes.
* Redo Haiku DND supportPo Lu2022-03-161-43/+16
| | | | | | | | | | | | | | | | | | | | | * 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.
* Fix some minor glitches with Haiku scroll barsPo Lu2022-03-151-1/+2
| | | | | * src/haiku_support.cc (MouseDown): Don't start overscroll if dragging started inside a button.
* Clean up some Haiku toolkit codePo Lu2022-03-141-1/+1
| | | | | | | | | * src/haiku_io.c (haiku_read_with_timeout): Accept `bigtime_t' instead of `time_t' for values which are cast to bigtime_t anyway. * src/haiku_support.cc (BMenu_run): Read all help events instead of just one. * src/haiku_support.h: Update prototypes.
* Fix extraneous overscroll activation on HaikuPo Lu2022-03-141-1/+6
| | | | | | | | | * src/haiku_support.cc (class EmacsScrollBar): New field `maybe_overscroll'. (MouseDown): Set that field. (MouseUp): Clear that field. (MouseMoved): Also test `maybe_overscroll' to ensure that a grab started inside the scroll bar.
* Enable overscroll on Haiku horizontal scroll barsPo Lu2022-03-141-4/+13
| | | | | | | * src/haiku_support.cc (MouseMoved): Handle horizontal directions correctly. * src/haikuterm.c (haiku_set_horizontal_scroll_bar_thumb): Enable overscrolling on scroll bar widget.
* Allow overscrolling on Haiku scroll bars that are fullPo Lu2022-03-131-1/+1
| | | | | * src/haiku_support.cc (MouseMoved): Allow overscrolling even if portion is less than 1.0.
* Fix pointer event tracking on top of Haiku scroll barsPo Lu2022-03-131-0/+3
| | | | | * src/haiku_support.cc (MouseDown): Set correct mouse event mask in case the scroll bar widget decides to not do that.
* Fix splurious button events being generated on HaikuPo Lu2022-03-131-8/+12
| | | | | * src/haiku_support.cc (MouseDown, MouseUp): Don't process if the grab is not appropriate for the buttons that were pressed.
* Improve overscrolling support on HaikuPo Lu2022-03-131-6/+10
| | | | | | | | * src/haiku_support.cc (class EmacsScrollBar): New field `real_max_value'. (MessageReceived): Set real max value. (MouseMoved): Get rid of magic numbers by using real max value instead.
* ; * haiku_support.cc (MessageReceived): Fix 32-bit build.Po Lu2022-03-131-1/+3
|
* Allow dragging scroll bar for overscroll on HaikuPo Lu2022-03-131-10/+116
| | | | | | | | | | | | | | | | | | * 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.
* Use more reasonable default timeouts in Haiku menu loopPo Lu2022-03-121-1/+1
| | | | | * src/haiku_support.cc (BMenu_run): Set default timeout to 10 seconds.
* Make C-mouse-3 on scroll bars work on HaikuPo Lu2022-03-121-1/+29
| | | | | | | * src/haiku_support.cc (class EmacsScrollBar): New field `handle_button'. (MouseDown, MouseUp): Pass button events with ControlMask to parent view.
* Slightly improve scrollbar position accounting on HaikuPo Lu2022-03-121-3/+3
| | | | | | | * 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.
* Fix a crash inside Haiku popup menusPo Lu2022-03-111-1/+2
| | | | | * src/haiku_support.cc (BMenu_run): Handle B_WOULD_BLOCK from wait_for_objects loop.
* Improve scroll bar treatment on HaikuPo Lu2022-03-111-2/+6
| | | | | | | | | * 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 scroll bar portion on Haiku scroll barsPo Lu2022-03-111-7/+24
| | | | | | | | | | | | | | | | | * src/haiku_support.cc (EmacsScrollBar): Set steps to appropriate value. (ValueChanged): Test new value against old value before sending value event. (MessageReceived): Handle portion and range. (BView_scroll_bar_update): New argument for portion. * src/haiku_support.h: Update prototypes. * src/haikuterm.c (haiku_set_scroll_bar_thumb): (haiku_set_horizontal_scroll_bar_thumb): New functions. (haiku_set_horizontal_scroll_bar): (haiku_set_vertical_scroll_bar): Use those functions to set scroll bar values. (haiku_read_socket): Handle new meanings of scroll bar values. * src/haikuterm.h (struct scroll_bar):
* Improve handling of tooltips inside menus on HaikuPo Lu2022-03-091-5/+18
| | | | | | | | | * src/haiku_support.cc (BMenu_run): Make `process_pending_signals_function' return a struct timespec. * src/haiku_support.h: Update prototypes. * src/haikumenu.c (haiku_process_pending_signals_for_menu): Return result of `timer_run'. * src/haikuterm.c (haiku_flush): Flip buffers if frame is dirty.
* Obey decorator-specified width and height of tooltip frames on HaikuPo Lu2022-03-051-0/+10
| | | | | | | | | | * src/haiku_support.cc (BWindow_dimensions): New functions. * src/haiku_support.h: Update prototypes. * src/haikufns.c (Fx_show_tip): Use actual dimensions, because the decorator might specify a minimum width and height for the tooltip frame. * src/haikuterm.c (haiku_update_size_hints): Ignore tooltip frames.
* Treat scroll bar information consistently on HaikuPo Lu2022-02-281-3/+2
| | | | | | * src/haiku_support.cc (class EmacsScrollBar): New field `info'. (EmacsScrollBar): Obtain scroll bar info on initialization. (ButtonRegionFor): Use that information instead.
* Ignore irrelevant button events on Haiku scroll barsPo Lu2022-02-261-21/+39
| | | | | * src/haiku_support.cc (MouseDown): Ignore if there are too many buttons pressed.
* Prevent crashes on event for removed scroll bar on HaikuPo Lu2022-02-261-9/+13
| | | | | | | | | | | | | | | * src/haiku_support.cc (class EmacsScrollBar): Remove field `scroll_bar'. (ValueChanged, MouseDown, MouseUp, BScrollBar_make_for_view): Adjust for changes. * src/haiku_support.h (struct haiku_scroll_bar_value_event) (struct haiku_scroll_bar_drag_event) (struct haiku_scroll_bar_part_event): New field `window'. * src/haikuterm.c (haiku_scroll_bar_from_widget): New function. (haiku_read_socket): Adjust for changes in scroll bar event structures.
* Improve scroll bar button handling on HaikuPo Lu2022-02-261-0/+121
| | | | | | | | | | | | | | | | | | | | * src/haiku_io.c (haiku_len): Add `SCROLL_BAR_PART_EVENT'. * src/haiku_support.cc (class EmacsScrollBar): New fields `dragging' and `current_state', along with `old_value' and `current_part'. (EmacsScrollBar): Set horizontal flag to `horizontal_p'. (MessageReceived): Set old_value when receiving SCROLL_BAR_UPDATE message. (ValueChanged): Don't allow scroll bar values to change while dragging. (MouseUp, MouseDown): Calculate button under mouse and act accordingly. * src/haiku_support.h (enum haiku_event_type): New event `SCROLL_BAR_PART_EVENT'. (enum haiku_scroll_bar_part): New enumerator. (struct haiku_scroll_bar_part_event): New struct. * src/haikuterm.c (haiku_read_socket): Handle SCROLL_BAR_PART_EVENTs.
* Improve tracking of modified regions on HaikuPo Lu2022-02-251-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/haiku_support.cc (class EmacsView): New field `invalid_region'. (FlipBuffers): Only invalidate that region. (SetUpDoubleBuffering): Clear that region. (BView_draw_lock): New parameters for denoting the region to invalidate. (BView_invalidate_region): New function. * src/haiku_support.h: Update prototypes. * src/haikufns.c (haiku_set_background_color): * src/haikumenu.c (digest_menu_items): * src/haikuterm.c (haiku_clip_to_string): (haiku_flip_buffers): (haiku_clear_frame_area): (haiku_clear_frame): (haiku_draw_glyph_string): (haiku_after_update_window_line): (haiku_draw_window_cursor): (haiku_draw_vertical_window_border): (haiku_draw_window_divider): (haiku_draw_fringe_bitmap): (haiku_scroll_run): (haiku_read_socket): (haiku_flash): (haiku_clear_under_internal_border): Mark appropriate region as invalid before buffer flip.
* Fix auto-lower when the mouse moves onto a scrollbar on HaikuPo Lu2022-02-241-0/+41
| | | | | | | | * src/haiku_support.cc (MouseMoved): (BView_inside_scroll_bar): New functions. * src/haiku_support.h: Update prototypes. * src/haikuterm.c (haiku_read_socket): Don't auto-lower if the pointer left the view for a scroll bar.
* Implement left-right separators for dialog boxes on HaikuPo Lu2022-02-211-0/+10
| | | | | | | | | | | * src/haiku_support.cc (BAlert_set_offset_spacing): New function. * src/haiku_support.h: Update prototypes. * src/haikumenu.c (struct submenu_stack_cell): Remove unused struct. (haiku_dialog_show): Use offset spacing if a left-right boundary was seen and make sure the user can always quit a dialog if no enabled items exist.
* Handle GUI input while inside popup dialog on HaikuPo Lu2022-02-201-3/+65
| | | | | | | | | | | | * src/haiku_support.cc (alert_popup_value): New variable. (be_alert_thread_entry): New function. (BAlert_go): Complete rewrite that allows async input to be handled while the popup is active. * src/haiku_support.h: Update prototypes. * src/haikumenu.c (haiku_dialog_show, haiku_popup_dialog): Stop blocking input and pass required callbacks to `BAlert_go'. * src/haikuterm.c (haiku_term_init): Set interrupt input mode to t.
* Fix some more hangs when parenting child frames around on HaikuPo Lu2022-02-191-2/+0
| | | | | | * src/haiku_support.cc (ParentTo): (FrameMoved): Don't sync when a recursive lock might be able to be held.