diff options
Diffstat (limited to 'src/haikuterm.c')
| -rw-r--r-- | src/haikuterm.c | 90 |
1 files changed, 74 insertions, 16 deletions
diff --git a/src/haikuterm.c b/src/haikuterm.c index 3e99cc1c8d9..93ba088f5b1 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c | |||
| @@ -55,6 +55,8 @@ struct unhandled_event | |||
| 55 | uint8_t buffer[200]; | 55 | uint8_t buffer[200]; |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | static bool any_help_event_p = false; | ||
| 59 | |||
| 58 | char * | 60 | char * |
| 59 | get_keysym_name (int keysym) | 61 | get_keysym_name (int keysym) |
| 60 | { | 62 | { |
| @@ -281,7 +283,7 @@ haiku_new_font (struct frame *f, Lisp_Object font_object, int fontset) | |||
| 281 | else | 283 | else |
| 282 | FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit; | 284 | FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit; |
| 283 | 285 | ||
| 284 | if (FRAME_HAIKU_WINDOW (f)) | 286 | if (FRAME_HAIKU_WINDOW (f) && !FRAME_TOOLTIP_P (f)) |
| 285 | { | 287 | { |
| 286 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), | 288 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), |
| 287 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), | 289 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), |
| @@ -370,6 +372,13 @@ haiku_frame_raise_lower (struct frame *f, bool raise_p) | |||
| 370 | BWindow_sync (FRAME_HAIKU_WINDOW (f)); | 372 | BWindow_sync (FRAME_HAIKU_WINDOW (f)); |
| 371 | unblock_input (); | 373 | unblock_input (); |
| 372 | } | 374 | } |
| 375 | else | ||
| 376 | { | ||
| 377 | block_input (); | ||
| 378 | BWindow_send_behind (FRAME_HAIKU_WINDOW (f), NULL); | ||
| 379 | BWindow_sync (FRAME_HAIKU_WINDOW (f)); | ||
| 380 | unblock_input (); | ||
| 381 | } | ||
| 373 | } | 382 | } |
| 374 | 383 | ||
| 375 | /* Unfortunately, NOACTIVATE is not implementable on Haiku. */ | 384 | /* Unfortunately, NOACTIVATE is not implementable on Haiku. */ |
| @@ -2472,10 +2481,7 @@ haiku_default_font_parameter (struct frame *f, Lisp_Object parms) | |||
| 2472 | struct haiku_font_pattern ptn; | 2481 | struct haiku_font_pattern ptn; |
| 2473 | ptn.specified = 0; | 2482 | ptn.specified = 0; |
| 2474 | 2483 | ||
| 2475 | if (f->tooltip) | 2484 | BFont_populate_fixed_family (&ptn); |
| 2476 | BFont_populate_plain_family (&ptn); | ||
| 2477 | else | ||
| 2478 | BFont_populate_fixed_family (&ptn); | ||
| 2479 | 2485 | ||
| 2480 | if (ptn.specified & FSPEC_FAMILY) | 2486 | if (ptn.specified & FSPEC_FAMILY) |
| 2481 | font = font_open_by_name (f, build_unibyte_string (ptn.family)); | 2487 | font = font_open_by_name (f, build_unibyte_string (ptn.family)); |
| @@ -2590,6 +2596,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2590 | struct unhandled_event *unhandled_events = NULL; | 2596 | struct unhandled_event *unhandled_events = NULL; |
| 2591 | int button_or_motion_p; | 2597 | int button_or_motion_p; |
| 2592 | int need_flush = 0; | 2598 | int need_flush = 0; |
| 2599 | int do_help = 0; | ||
| 2593 | 2600 | ||
| 2594 | if (!buf) | 2601 | if (!buf) |
| 2595 | buf = xmalloc (200); | 2602 | buf = xmalloc (200); |
| @@ -2638,9 +2645,19 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2638 | int width = lrint (b->px_widthf); | 2645 | int width = lrint (b->px_widthf); |
| 2639 | int height = lrint (b->px_heightf); | 2646 | int height = lrint (b->px_heightf); |
| 2640 | 2647 | ||
| 2648 | if (FRAME_TOOLTIP_P (f)) | ||
| 2649 | { | ||
| 2650 | FRAME_PIXEL_WIDTH (f) = width; | ||
| 2651 | FRAME_PIXEL_HEIGHT (f) = height; | ||
| 2652 | |||
| 2653 | haiku_clear_under_internal_border (f); | ||
| 2654 | continue; | ||
| 2655 | } | ||
| 2656 | |||
| 2641 | BView_draw_lock (FRAME_HAIKU_VIEW (f)); | 2657 | BView_draw_lock (FRAME_HAIKU_VIEW (f)); |
| 2642 | BView_resize_to (FRAME_HAIKU_VIEW (f), width, height); | 2658 | BView_resize_to (FRAME_HAIKU_VIEW (f), width, height); |
| 2643 | BView_draw_unlock (FRAME_HAIKU_VIEW (f)); | 2659 | BView_draw_unlock (FRAME_HAIKU_VIEW (f)); |
| 2660 | |||
| 2644 | if (width != FRAME_PIXEL_WIDTH (f) | 2661 | if (width != FRAME_PIXEL_WIDTH (f) |
| 2645 | || height != FRAME_PIXEL_HEIGHT (f) | 2662 | || height != FRAME_PIXEL_HEIGHT (f) |
| 2646 | || (f->new_size_p | 2663 | || (f->new_size_p |
| @@ -2708,6 +2725,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2708 | inev.kind = inev.code > 127 ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : | 2725 | inev.kind = inev.code > 127 ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : |
| 2709 | ASCII_KEYSTROKE_EVENT; | 2726 | ASCII_KEYSTROKE_EVENT; |
| 2710 | 2727 | ||
| 2728 | inev.timestamp = b->time / 1000; | ||
| 2711 | inev.modifiers = haiku_modifiers_to_emacs (b->modifiers); | 2729 | inev.modifiers = haiku_modifiers_to_emacs (b->modifiers); |
| 2712 | XSETFRAME (inev.frame_or_window, f); | 2730 | XSETFRAME (inev.frame_or_window, f); |
| 2713 | break; | 2731 | break; |
| @@ -2746,7 +2764,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2746 | Lisp_Object frame; | 2764 | Lisp_Object frame; |
| 2747 | XSETFRAME (frame, f); | 2765 | XSETFRAME (frame, f); |
| 2748 | 2766 | ||
| 2749 | x_display_list->last_mouse_movement_time = time (NULL); | 2767 | x_display_list->last_mouse_movement_time = b->time / 1000; |
| 2750 | button_or_motion_p = 1; | 2768 | button_or_motion_p = 1; |
| 2751 | 2769 | ||
| 2752 | if (hlinfo->mouse_face_hidden) | 2770 | if (hlinfo->mouse_face_hidden) |
| @@ -2770,14 +2788,25 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2770 | } | 2788 | } |
| 2771 | 2789 | ||
| 2772 | haiku_new_focus_frame (x_display_list->focused_frame); | 2790 | haiku_new_focus_frame (x_display_list->focused_frame); |
| 2773 | help_echo_string = Qnil; | 2791 | |
| 2774 | gen_help_event (Qnil, frame, Qnil, Qnil, 0); | 2792 | if (any_help_event_p) |
| 2793 | do_help = -1; | ||
| 2775 | } | 2794 | } |
| 2776 | else | 2795 | else |
| 2777 | { | 2796 | { |
| 2778 | struct haiku_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); | 2797 | struct haiku_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 2779 | struct haiku_rect r = dpyinfo->last_mouse_glyph; | 2798 | struct haiku_rect r = dpyinfo->last_mouse_glyph; |
| 2780 | 2799 | ||
| 2800 | /* For an unknown reason Haiku sends phantom motion events when a | ||
| 2801 | tooltip frame is visible. FIXME */ | ||
| 2802 | if (FRAMEP (tip_frame) | ||
| 2803 | && FRAME_LIVE_P (XFRAME (tip_frame)) | ||
| 2804 | && FRAME_VISIBLE_P (XFRAME (tip_frame)) | ||
| 2805 | && f == dpyinfo->last_mouse_motion_frame | ||
| 2806 | && b->x == dpyinfo->last_mouse_motion_x | ||
| 2807 | && b->y == dpyinfo->last_mouse_motion_y) | ||
| 2808 | continue; | ||
| 2809 | |||
| 2781 | dpyinfo->last_mouse_motion_x = b->x; | 2810 | dpyinfo->last_mouse_motion_x = b->x; |
| 2782 | dpyinfo->last_mouse_motion_y = b->y; | 2811 | dpyinfo->last_mouse_motion_y = b->y; |
| 2783 | dpyinfo->last_mouse_motion_frame = f; | 2812 | dpyinfo->last_mouse_motion_frame = f; |
| @@ -2816,9 +2845,9 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2816 | remember_mouse_glyph (f, b->x, b->y, | 2845 | remember_mouse_glyph (f, b->x, b->y, |
| 2817 | &FRAME_DISPLAY_INFO (f)->last_mouse_glyph); | 2846 | &FRAME_DISPLAY_INFO (f)->last_mouse_glyph); |
| 2818 | dpyinfo->last_mouse_glyph_frame = f; | 2847 | dpyinfo->last_mouse_glyph_frame = f; |
| 2819 | gen_help_event (help_echo_string, frame, help_echo_window, | ||
| 2820 | help_echo_object, help_echo_pos); | ||
| 2821 | } | 2848 | } |
| 2849 | else | ||
| 2850 | help_echo_string = previous_help_echo_string; | ||
| 2822 | 2851 | ||
| 2823 | if (!NILP (Vmouse_autoselect_window)) | 2852 | if (!NILP (Vmouse_autoselect_window)) |
| 2824 | { | 2853 | { |
| @@ -2838,6 +2867,10 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2838 | 2867 | ||
| 2839 | last_mouse_window = window; | 2868 | last_mouse_window = window; |
| 2840 | } | 2869 | } |
| 2870 | |||
| 2871 | if (!NILP (help_echo_string) | ||
| 2872 | || !NILP (previous_help_echo_string)) | ||
| 2873 | do_help = 1; | ||
| 2841 | } | 2874 | } |
| 2842 | break; | 2875 | break; |
| 2843 | } | 2876 | } |
| @@ -2857,7 +2890,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2857 | inev.modifiers = haiku_modifiers_to_emacs (b->modifiers); | 2890 | inev.modifiers = haiku_modifiers_to_emacs (b->modifiers); |
| 2858 | 2891 | ||
| 2859 | x_display_list->last_mouse_glyph_frame = 0; | 2892 | x_display_list->last_mouse_glyph_frame = 0; |
| 2860 | x_display_list->last_mouse_movement_time = time (NULL); | 2893 | x_display_list->last_mouse_movement_time = b->time / 1000; |
| 2861 | button_or_motion_p = 1; | 2894 | button_or_motion_p = 1; |
| 2862 | 2895 | ||
| 2863 | /* Is this in the tab-bar? */ | 2896 | /* Is this in the tab-bar? */ |
| @@ -3262,20 +3295,20 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3262 | 3295 | ||
| 3263 | if (inev.kind != NO_EVENT) | 3296 | if (inev.kind != NO_EVENT) |
| 3264 | { | 3297 | { |
| 3265 | if (inev.kind != HELP_EVENT) | 3298 | if (inev.kind != HELP_EVENT && !inev.timestamp) |
| 3266 | inev.timestamp = (button_or_motion_p | 3299 | inev.timestamp = (button_or_motion_p |
| 3267 | ? x_display_list->last_mouse_movement_time | 3300 | ? x_display_list->last_mouse_movement_time |
| 3268 | : time (NULL)); | 3301 | : system_time () / 1000); |
| 3269 | kbd_buffer_store_event_hold (&inev, hold_quit); | 3302 | kbd_buffer_store_event_hold (&inev, hold_quit); |
| 3270 | ++message_count; | 3303 | ++message_count; |
| 3271 | } | 3304 | } |
| 3272 | 3305 | ||
| 3273 | if (inev2.kind != NO_EVENT) | 3306 | if (inev2.kind != NO_EVENT) |
| 3274 | { | 3307 | { |
| 3275 | if (inev2.kind != HELP_EVENT) | 3308 | if (inev2.kind != HELP_EVENT && !inev.timestamp) |
| 3276 | inev2.timestamp = (button_or_motion_p | 3309 | inev2.timestamp = (button_or_motion_p |
| 3277 | ? x_display_list->last_mouse_movement_time | 3310 | ? x_display_list->last_mouse_movement_time |
| 3278 | : time (NULL)); | 3311 | : system_time () / 1000); |
| 3279 | kbd_buffer_store_event_hold (&inev2, hold_quit); | 3312 | kbd_buffer_store_event_hold (&inev2, hold_quit); |
| 3280 | ++message_count; | 3313 | ++message_count; |
| 3281 | } | 3314 | } |
| @@ -3289,6 +3322,28 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3289 | xfree (old); | 3322 | xfree (old); |
| 3290 | } | 3323 | } |
| 3291 | 3324 | ||
| 3325 | if (do_help && !(hold_quit && hold_quit->kind != NO_EVENT)) | ||
| 3326 | { | ||
| 3327 | Lisp_Object help_frame = Qnil; | ||
| 3328 | |||
| 3329 | if (x_display_list->last_mouse_frame) | ||
| 3330 | XSETFRAME (help_frame, | ||
| 3331 | x_display_list->last_mouse_frame); | ||
| 3332 | |||
| 3333 | if (do_help > 0) | ||
| 3334 | { | ||
| 3335 | any_help_event_p = true; | ||
| 3336 | gen_help_event (help_echo_string, help_frame, | ||
| 3337 | help_echo_window, help_echo_object, | ||
| 3338 | help_echo_pos); | ||
| 3339 | } | ||
| 3340 | else | ||
| 3341 | { | ||
| 3342 | help_echo_string = Qnil; | ||
| 3343 | gen_help_event (Qnil, help_frame, Qnil, Qnil, 0); | ||
| 3344 | } | ||
| 3345 | } | ||
| 3346 | |||
| 3292 | if (need_flush) | 3347 | if (need_flush) |
| 3293 | flush_dirty_back_buffers (); | 3348 | flush_dirty_back_buffers (); |
| 3294 | 3349 | ||
| @@ -3507,7 +3562,10 @@ put_xrm_resource (Lisp_Object name, Lisp_Object val) | |||
| 3507 | void | 3562 | void |
| 3508 | haiku_clear_under_internal_border (struct frame *f) | 3563 | haiku_clear_under_internal_border (struct frame *f) |
| 3509 | { | 3564 | { |
| 3510 | if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0) | 3565 | if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0 |
| 3566 | /* This is needed because tooltip frames set up the internal | ||
| 3567 | border before init_frame_faces. */ | ||
| 3568 | && FRAME_FACE_CACHE (f)) | ||
| 3511 | { | 3569 | { |
| 3512 | int border = FRAME_INTERNAL_BORDER_WIDTH (f); | 3570 | int border = FRAME_INTERNAL_BORDER_WIDTH (f); |
| 3513 | int width = FRAME_PIXEL_WIDTH (f); | 3571 | int width = FRAME_PIXEL_WIDTH (f); |